Skip to main content

Tool for converting Nipype tasks and workflows into Pydra syntax

Project description

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 is a command-line tool for semi-automatically porting command interfaces and workflows written from the Nipype workflow engine to its successor Pydra. It has been designed so that any required manual-specifications are stored in separate YAML specification files, which is read ahead of the conversion, so once designed the conversion can be re-run to pick up changes in newer versions of the Nipype code without having to redo the manual steps.

Basic Usage

To convert a Nipype interface to a Pydra task run the nipype2pydra task command and pass it the conversion specification YAML file and the root of the package to save the generated module, e.g.:

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

This will create a module file under the package root directory based on the output_module field in the specification, e.g:

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

If that is missing and the nipype interface is in the standard nipype.interfaces package, then it will be stored at pydra.tasks. with the same path end.

Conversion Specifications

While the conversions aim to as automatic as possible, there are structural differences between Nipype and Pydra that require manual specification, and it might be desirable to rename some of the inputs/outputs to more intuitive names. Such specifications are stored in YAML format, such as the ANTs registration conversion specification,

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

Detailed description of the different options to go here

Installation

Nipype2Pydra can be installed for Python >= 3.7 from PyPI with

$ python3 -m pip install nipype2pydra

License

This work is licensed under a Creative Commons Attribution 4.0 International License

Creative Commons Attribution 4.0 International License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nipype2pydra-0.5.0.tar.gz (108.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nipype2pydra-0.5.0-py3-none-any.whl (141.3 kB view details)

Uploaded Python 3

File details

Details for the file nipype2pydra-0.5.0.tar.gz.

File metadata

  • Download URL: nipype2pydra-0.5.0.tar.gz
  • Upload date:
  • Size: 108.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nipype2pydra-0.5.0.tar.gz
Algorithm Hash digest
SHA256 52eaf00470b66ddf0d8cef212b47dc4b09f9220781f64757ee39e261cd56af95
MD5 beb6d111f361ef7b783164b15cb2aea1
BLAKE2b-256 9ff46cfdbe5b466e0f0602618302434f988d21b01fdfbf87b516caacb0ed9904

See more details on using hashes here.

File details

Details for the file nipype2pydra-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nipype2pydra-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 141.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nipype2pydra-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a63ea10713163fa8bf48ae97bcdbf75d5c66f88aa9f4862fda9b5afdedc98a59
MD5 c6009810a9e612929e8e6c1b6279fb50
BLAKE2b-256 32d26db7f288cd6e5e0836b1bef6f34a1ed6318974ff582a57a549f62c15dfa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page