Skip to content

Updated interface conversions for new-syntax #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: run-tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 20 additions & 27 deletions example-specs/interface/nipype/afni/a_boverlap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
# Docs
# ----
# Output (to screen) is a count of various things about how
# the automasks of datasets A and B overlap or don't overlap.
# the automasks of datasets A and B overlap or don't overlap.
#
# For complete details, see the `3dABoverlap Documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dABoverlap.html>`_
# For complete details, see the `3dABoverlap Documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dABoverlap.html>`_
#
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> aboverlap = afni.ABoverlap()
# >>> aboverlap.inputs.in_file_a = 'functional.nii'
# >>> aboverlap.inputs.in_file_b = 'structural.nii'
# >>> aboverlap.inputs.out_file = 'out.mask_ae_overlap.txt'
# >>> aboverlap.cmdline
# '3dABoverlap functional.nii structural.nii |& tee out.mask_ae_overlap.txt'
# >>> res = aboverlap.run() # doctest: +SKIP
#
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> aboverlap = afni.ABoverlap()
# >>> aboverlap.inputs.in_file_a = 'functional.nii'
# >>> aboverlap.inputs.in_file_b = 'structural.nii'
# >>> aboverlap.inputs.out_file = 'out.mask_ae_overlap.txt'
# >>> aboverlap.cmdline
# '3dABoverlap functional.nii structural.nii |& tee out.mask_ae_overlap.txt'
# >>> res = aboverlap.run() # doctest: +SKIP
#
#
task_name: ABoverlap
nipype_name: ABoverlap
nipype_module: nipype.interfaces.afni.utils
Expand All @@ -39,11 +39,8 @@ inputs:
# passed to the field in the automatically generated unittests.
in_file_a: medimage/nifti1
# type=file|default=<undefined>: input file A
in_file_b: medimage/nifti1
in_file_b: generic/file
# type=file|default=<undefined>: input file B
out_file: Path
# type=file: output file
# type=file|default=<undefined>: collect output to a file
callable_defaults:
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
# to set as the `default` method of input fields
Expand All @@ -67,7 +64,7 @@ outputs:
# 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
# dict[str, str] - `path_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
tests:
Expand Down Expand Up @@ -96,7 +93,7 @@ tests:
environ:
# type=dict|default={}: Environment variables
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -115,13 +112,11 @@ tests:
# (if not specified, will try to choose a sensible value)
in_file_a:
# type=file|default=<undefined>: input file A
in_file_b:
# type=file|default=<undefined>: input file B
out_file: ' "out.mask_ae_overlap.txt"'
# type=file: output file
# type=file|default=<undefined>: collect output to a file
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -136,21 +131,19 @@ tests:
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
doctests:
- cmdline: 3dABoverlap functional.nii structural.nii |& tee out.mask_ae_overlap.txt
- cmdline:
# str - the expected cmdline output
inputs:
# dict[str, str] - name-value pairs for inputs to be provided to the doctest.
# If the field is of file-format type and the value is None, then the
# '.mock()' method of the corresponding class is used instead.
in_file_a: '"functional.nii"'
# type=file|default=<undefined>: input file A
in_file_b: '"structural.nii"'
# type=file|default=<undefined>: input file B
out_file: ' "out.mask_ae_overlap.txt"'
# type=file: output file
# type=file|default=<undefined>: collect output to a file
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
directive:
# str - any doctest directive to place on the cmdline call, e.g. # doctest: +ELLIPSIS
49 changes: 20 additions & 29 deletions example-specs/interface/nipype/afni/afn_ito_nifti.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
# Docs
# ----
# Converts AFNI format files to NIFTI format. This can also convert 2D or
# 1D data, which you can numpy.squeeze() to remove extra dimensions.
# 1D data, which you can numpy.squeeze() to remove extra dimensions.
#
# For complete details, see the `3dAFNItoNIFTI Documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAFNItoNIFTI.html>`_
# For complete details, see the `3dAFNItoNIFTI Documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAFNItoNIFTI.html>`_
#
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> a2n = afni.AFNItoNIFTI()
# >>> a2n.inputs.in_file = 'afni_output.3D'
# >>> a2n.inputs.out_file = 'afni_output.nii'
# >>> a2n.cmdline
# '3dAFNItoNIFTI -prefix afni_output.nii afni_output.3D'
# >>> res = a2n.run() # doctest: +SKIP
#
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> a2n = afni.AFNItoNIFTI()
# >>> a2n.inputs.in_file = 'afni_output.3D'
# >>> a2n.inputs.out_file = 'afni_output.nii'
# >>> a2n.cmdline
# '3dAFNItoNIFTI -prefix afni_output.nii afni_output.3D'
# >>> res = a2n.run() # doctest: +SKIP
#
#
task_name: AFNItoNIFTI
nipype_name: AFNItoNIFTI
nipype_module: nipype.interfaces.afni.utils
Expand All @@ -36,11 +36,8 @@ inputs:
# 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.
in_file: medimage-afni/three-d
in_file: fileformats.medimage_afni.ThreeD
# type=file|default=<undefined>: input file to 3dAFNItoNIFTI
out_file: Path
# type=file: output file
# type=file|default=<undefined>: output image file name
callable_defaults:
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
# to set as the `default` method of input fields
Expand All @@ -57,14 +54,14 @@ outputs:
# 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.
out_file: medimage/nifti1
out_file: generic/file
# type=file: output file
# type=file|default=<undefined>: output image file name
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
# dict[str, str] - `path_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
tests:
Expand Down Expand Up @@ -93,7 +90,7 @@ tests:
environ:
# type=dict|default={}: Environment variables
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -112,11 +109,8 @@ tests:
# (if not specified, will try to choose a sensible value)
in_file:
# type=file|default=<undefined>: input file to 3dAFNItoNIFTI
out_file: ' "afni_output.nii"'
# type=file: output file
# type=file|default=<undefined>: output image file name
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -131,19 +125,16 @@ tests:
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
doctests:
- cmdline: 3dAFNItoNIFTI -prefix afni_output.nii afni_output.3D
- cmdline:
# str - the expected cmdline output
inputs:
# dict[str, str] - name-value pairs for inputs to be provided to the doctest.
# If the field is of file-format type and the value is None, then the
# '.mock()' method of the corresponding class is used instead.
in_file: '"afni_output.3D"'
# type=file|default=<undefined>: input file to 3dAFNItoNIFTI
out_file: ' "afni_output.nii"'
# type=file: output file
# type=file|default=<undefined>: output image file name
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
directive:
# str - any doctest directive to place on the cmdline call, e.g. # doctest: +ELLIPSIS
104 changes: 46 additions & 58 deletions example-specs/interface/nipype/afni/align_epi_anat_py.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,55 @@
# ----
# Align EPI to anatomical datasets or vice versa.
#
# This Python script computes the alignment between two datasets, typically
# an EPI and an anatomical structural dataset, and applies the resulting
# transformation to one or the other to bring them into alignment.
# This Python script computes the alignment between two datasets, typically
# an EPI and an anatomical structural dataset, and applies the resulting
# transformation to one or the other to bring them into alignment.
#
# This script computes the transforms needed to align EPI and
# anatomical datasets using a cost function designed for this purpose. The
# script combines multiple transformations, thereby minimizing the amount of
# interpolation applied to the data.
# This script computes the transforms needed to align EPI and
# anatomical datasets using a cost function designed for this purpose. The
# script combines multiple transformations, thereby minimizing the amount of
# interpolation applied to the data.
#
# Basic Usage::
# Basic Usage::
#
# align_epi_anat.py -anat anat+orig -epi epi+orig -epi_base 5
# align_epi_anat.py -anat anat+orig -epi epi+orig -epi_base 5
#
# The user must provide :abbr:`EPI (echo-planar imaging)` and anatomical datasets
# and specify the EPI sub-brick to use as a base in the alignment.
# The user must provide :abbr:`EPI (echo-planar imaging)` and anatomical datasets
# and specify the EPI sub-brick to use as a base in the alignment.
#
# Internally, the script always aligns the anatomical to the EPI dataset,
# and the resulting transformation is saved to a 1D file.
# As a user option, the inverse of this transformation may be applied to the
# EPI dataset in order to align it to the anatomical data instead.
# Internally, the script always aligns the anatomical to the EPI dataset,
# and the resulting transformation is saved to a 1D file.
# As a user option, the inverse of this transformation may be applied to the
# EPI dataset in order to align it to the anatomical data instead.
#
# This program generates several kinds of output in the form of datasets
# and transformation matrices which can be applied to other datasets if
# needed. Time-series volume registration, oblique data transformations and
# Talairach (standard template) transformations will be combined as needed
# and requested (with options to turn on and off each of the steps) in
# order to create the aligned datasets.
# This program generates several kinds of output in the form of datasets
# and transformation matrices which can be applied to other datasets if
# needed. Time-series volume registration, oblique data transformations and
# Talairach (standard template) transformations will be combined as needed
# and requested (with options to turn on and off each of the steps) in
# order to create the aligned datasets.
#
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> al_ea = afni.AlignEpiAnatPy()
# >>> al_ea.inputs.anat = "structural.nii"
# >>> al_ea.inputs.in_file = "functional.nii"
# >>> al_ea.inputs.epi_base = 0
# >>> al_ea.inputs.epi_strip = '3dAutomask'
# >>> al_ea.inputs.volreg = 'off'
# >>> al_ea.inputs.tshift = 'off'
# >>> al_ea.inputs.save_skullstrip = True
# >>> al_ea.cmdline # doctest: +ELLIPSIS
# 'python2 ...align_epi_anat.py -anat structural.nii -epi_base 0 -epi_strip 3dAutomask -epi functional.nii -save_skullstrip -suffix _al -tshift off -volreg off'
# >>> res = allineate.run() # doctest: +SKIP
# Examples
# --------
# >>> from nipype.interfaces import afni
# >>> al_ea = afni.AlignEpiAnatPy()
# >>> al_ea.inputs.anat = "structural.nii"
# >>> al_ea.inputs.in_file = "functional.nii"
# >>> al_ea.inputs.epi_base = 0
# >>> al_ea.inputs.epi_strip = '3dAutomask'
# >>> al_ea.inputs.volreg = 'off'
# >>> al_ea.inputs.tshift = 'off'
# >>> al_ea.inputs.save_skullstrip = True
# >>> al_ea.cmdline # doctest: +ELLIPSIS
# 'python2 ...align_epi_anat.py -anat structural.nii -epi_base 0 -epi_strip 3dAutomask -epi functional.nii -save_skullstrip -suffix _al -tshift off -volreg off'
# >>> res = al_ea.run() # doctest: +SKIP
#
# See Also
# --------
# For complete details, see the `align_epi_anat.py documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/align_epi_anat.py.html>`__.
#
# See Also
# --------
# For complete details, see the `align_epi_anat.py documentation.
# <https://afni.nimh.nih.gov/pub/dist/doc/program_help/align_epi_anat.py.html>`__.
#
#
task_name: AlignEpiAnatPy
nipype_name: AlignEpiAnatPy
nipype_module: nipype.interfaces.afni.preprocess
Expand All @@ -72,7 +72,7 @@ inputs:
# passed to the field in the automatically generated unittests.
anat: medimage/nifti1
# type=file|default=<undefined>: name of structural dataset
in_file: medimage/nifti1
in_file: generic/file
# type=file|default=<undefined>: EPI dataset to align
callable_defaults:
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
Expand Down Expand Up @@ -114,7 +114,7 @@ outputs:
# 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
# dict[str, str] - `path_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
tests:
Expand Down Expand Up @@ -150,7 +150,7 @@ tests:
environ:
# type=dict|default={}: Environment variables
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -169,20 +169,14 @@ tests:
# (if not specified, will try to choose a sensible value)
anat:
# type=file|default=<undefined>: name of structural dataset
in_file:
# type=file|default=<undefined>: EPI dataset to align
epi_base: '0'
# type=traitcompound|default=None: the epi base used in alignmentshould be one of (0/mean/median/max/subbrick#)
epi_strip: '"3dAutomask"'
# type=enum|default='3dSkullStrip'|allowed['3dAutomask','3dSkullStrip','None']: method to mask brain in EPI datashould be one of[3dSkullStrip]/3dAutomask/None)
volreg: '"off"'
# type=enum|default='on'|allowed['off','on']: do volume registration on EPI dataset before alignmentshould be 'on' or 'off', defaults to 'on'
tshift: '"off"'
# type=enum|default='on'|allowed['off','on']: do time shifting of EPI dataset before alignmentshould be 'on' or 'off', defaults to 'on'
save_skullstrip: 'True'
# type=bool|default=False: save skull-stripped (not aligned)
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
Expand All @@ -197,28 +191,22 @@ tests:
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
doctests:
- cmdline: python2 ...align_epi_anat.py -anat structural.nii -epi_base 0 -epi_strip 3dAutomask -epi functional.nii -save_skullstrip -suffix _al -tshift off -volreg off
- cmdline:
# str - the expected cmdline output
inputs:
# dict[str, str] - name-value pairs for inputs to be provided to the doctest.
# If the field is of file-format type and the value is None, then the
# '.mock()' method of the corresponding class is used instead.
anat: '"structural.nii"'
# type=file|default=<undefined>: name of structural dataset
in_file: '"functional.nii"'
# type=file|default=<undefined>: EPI dataset to align
epi_base: '0'
# type=traitcompound|default=None: the epi base used in alignmentshould be one of (0/mean/median/max/subbrick#)
epi_strip: '"3dAutomask"'
# type=enum|default='3dSkullStrip'|allowed['3dAutomask','3dSkullStrip','None']: method to mask brain in EPI datashould be one of[3dSkullStrip]/3dAutomask/None)
volreg: '"off"'
# type=enum|default='on'|allowed['off','on']: do volume registration on EPI dataset before alignmentshould be 'on' or 'off', defaults to 'on'
tshift: '"off"'
# type=enum|default='on'|allowed['off','on']: do time shifting of EPI dataset before alignmentshould be 'on' or 'off', defaults to 'on'
save_skullstrip: 'True'
# type=bool|default=False: save skull-stripped (not aligned)
imports:
# list[nipype2pydra.task.base.importstatement] - list import statements required by the test, with each list item
# list[nipype2pydra.statements.imports.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
directive:
# str - any doctest directive to place on the cmdline call, e.g. # doctest: +ELLIPSIS
Loading