跳转到主要内容

将Nipype任务和工作流程转换为Pydra语法的工具

项目描述

https://github.com/nipype/nipype2pydra/actions/workflows/ci-cd.yml/badge.svg https://codecov.io/gh/nipype/nipype2pydra/branch/main/graph/badge.svg?token=UIS0OGPST7 Supported Python versions Latest Version

Nipype2Pydra是一个命令行工具,用于将使用Nipype工作流程引擎编写的命令接口和工作流程半自动地移植到其继任者Pydra。它被设计成将任何必需的手动规格存储在单独的YAML规格文件中,在转换之前读取,这样一旦设计好,就可以重新运行转换来获取Nipype代码的新版本中的更改,而无需重做手动步骤。

基本用法

要将Nipype接口转换为Pydra任务,请运行nipype2pydra task命令,并将转换规格YAML文件和要保存生成的模块的包根传递给它,例如

$ nipype2pydra task ants_registration_registration.yaml /path/to/package/root

这将根据规格中的output_module字段在包根目录下创建一个模块文件,例如

/path/to/package/root/output/module/path

如果缺少此文件,并且nipype界面位于标准nipype.interfaces包中,那么它将被存储在pydra.tasks下,路径相同。

转换规范

虽然转换旨在尽可能自动化,但Nipype和Pydra之间存在结构差异,需要手动指定,可能需要将一些输入/输出重命名为更直观的名称。这些规范存储在YAML格式中,例如ANTs配准转换规范。

task_name: n4_bias_field_correction
nipype_name: N4BiasFieldCorrection
nipype_module: nipype.interfaces.ants.segmentation
inputs:
    omit:
    # list[str] - fields to omit from the Pydra interface
    rename:
    # dict[str, str] - fields to rename in the Pydra interface
    types:
    # dict[str, type] - override inferred types (use "mime-like" string for file-format types,
    # e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
    # from the nipype interface, but you may want to be more specific, particularly
    # for file types, where specifying the format also specifies the file that will be
    # passed to the field in the automatically generated unittests.
        input_image: medimage/nifti1
        mask_image: medimage/nifti1
        weight_image: medimage/nifti1
        bias_image: medimage/nifti1
    metadata:
    # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1)
outputs:
    omit:
    # list[str] - fields to omit from the Pydra interface
    rename:
    # dict[str, str] - fields to rename in the Pydra interface
    types:
    # dict[str, type] - override inferred types (use "mime-like" string for file-format types,
    # e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
    # from the nipype interface, but you may want to be more specific, particularly
    # for file types, where specifying the format also specifies the file that will be
    # passed to the field in the automatically generated unittests.
        output_image: medimage/nifti1
        bias_image: medimage/nifti1
    callables:
    # dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
    # to set to the `callable` attribute of output fields
    templates:
    # dict[str, str] - `output_file_template` values to be provided to output fields
    requirements:
    # dict[str, list[str]] - input fields that are required to be provided for the output field to be present

在此处提供不同选项的详细描述

安装

Nipype2Pydra可以从PyPI安装Python >= 3.7,使用以下命令:

$ python3 -m pip install nipype2pydra

许可证

本作品受Creative Commons Attribution 4.0国际许可证许可。

Creative Commons Attribution 4.0 International License

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

nipype2pydra-0.4.4.tar.gz (96.5 kB 查看哈希值)

上传时间:

构建分布

nipype2pydra-0.4.4-py3-none-any.whl (128.8 kB 查看哈希值)

上传时间: Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面