From 1537199c874a1d76c7554211ac3db6bf3dd09daf Mon Sep 17 00:00:00 2001 From: adsouza Date: Tue, 19 Mar 2024 14:52:49 +1100 Subject: [PATCH 1/9] updated add_x_form_to_header.yaml --- .../specs/add_x_form_to_header.yaml | 10 ++--- related-packages/conftest.py | 37 ------------------- .../extras/medimage_freesurfer/_version.py | 16 ++++++++ .../medimage_freesurfer/_version.py | 16 ++++++++ 4 files changed, 37 insertions(+), 42 deletions(-) delete mode 100644 related-packages/conftest.py create mode 100644 related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py create mode 100644 related-packages/fileformats/fileformats/medimage_freesurfer/_version.py diff --git a/nipype-auto-conv/specs/add_x_form_to_header.yaml b/nipype-auto-conv/specs/add_x_form_to_header.yaml index b7d9856c..00945a3d 100644 --- a/nipype-auto-conv/specs/add_x_form_to_header.yaml +++ b/nipype-auto-conv/specs/add_x_form_to_header.yaml @@ -87,11 +87,11 @@ tests: out_file: # type=file: output volume # type=file|default='output.mgz': output volume - copy_name: + copy_name: "False" # type=bool|default=False: do not try to load the xfmfile, just copy name - verbose: + verbose: "False" # type=bool|default=False: be verbose - subjects_dir: + # subjects_dir: # type=directory|default=: subjects directory args: # type=str|default='': Additional parameters to the command @@ -137,7 +137,7 @@ tests: - inputs: # dict[str, str] - values to provide to inputs fields in the task initialisation # (if not specified, will try to choose a sensible value) - copy_name: 'True' + copy_name: "False" # type=bool|default=False: do not try to load the xfmfile, just copy name imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -176,7 +176,7 @@ doctests: # 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. - copy_name: 'True' + copy_name: "False" # type=bool|default=False: do not try to load the xfmfile, just copy name imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item diff --git a/related-packages/conftest.py b/related-packages/conftest.py deleted file mode 100644 index 2a703c05..00000000 --- a/related-packages/conftest.py +++ /dev/null @@ -1,37 +0,0 @@ -import os -import logging -from pathlib import Path -import tempfile -import pytest - -# Set DEBUG logging for unittests - -log_level = logging.WARNING - -logger = logging.getLogger("fileformats") -logger.setLevel(log_level) - -sch = logging.StreamHandler() -sch.setLevel(log_level) -formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -sch.setFormatter(formatter) -logger.addHandler(sch) - - -# For debugging in IDE's don't catch raised exceptions and let the IDE -# break at it -if os.getenv("_PYTEST_RAISE", "0") != "0": - - @pytest.hookimpl(tryfirst=True) - def pytest_exception_interact(call): - raise call.excinfo.value - - @pytest.hookimpl(tryfirst=True) - def pytest_internalerror(excinfo): - raise excinfo.value - - -@pytest.fixture -def work_dir(): - work_dir = tempfile.mkdtemp() - return Path(work_dir) diff --git a/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py b/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py new file mode 100644 index 00000000..7b855d18 --- /dev/null +++ b/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py @@ -0,0 +1,16 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '0.1.1.dev35+g4a0195b' +__version_tuple__ = version_tuple = (0, 1, 1, 'dev35', 'g4a0195b') diff --git a/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py b/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py new file mode 100644 index 00000000..7b855d18 --- /dev/null +++ b/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py @@ -0,0 +1,16 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '0.1.1.dev35+g4a0195b' +__version_tuple__ = version_tuple = (0, 1, 1, 'dev35', 'g4a0195b') From 3cf97d6e0f2012756dd06be750793ec0a5551bae Mon Sep 17 00:00:00 2001 From: adsouza Date: Tue, 19 Mar 2024 14:52:49 +1100 Subject: [PATCH 2/9] updated aparc_2_aseg.yaml --- nipype-auto-conv/specs/aparc_2_aseg.yaml | 216 +++++++++++------------ 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/nipype-auto-conv/specs/aparc_2_aseg.yaml b/nipype-auto-conv/specs/aparc_2_aseg.yaml index 1eba8a25..2f55692c 100644 --- a/nipype-auto-conv/specs/aparc_2_aseg.yaml +++ b/nipype-auto-conv/specs/aparc_2_aseg.yaml @@ -57,30 +57,30 @@ inputs: # passed to the field in the automatically generated unittests. out_file: medimage/mgh-gz # type=file: Output aseg file - # type=file|default=: Full path of file to save the output segmentation in - lh_white: medimage-freesurfer/pial - # type=file|default=: Input file must be /surf/lh.white - rh_white: medimage-freesurfer/pial - # type=file|default=: Input file must be /surf/rh.white - lh_pial: medimage-freesurfer/pial - # type=file|default=: Input file must be /surf/lh.pial - rh_pial: medimage-freesurfer/pial - # type=file|default=: Input file must be /surf/rh.pial - lh_ribbon: medimage/mgh-gz - # type=file|default=: Input file must be /mri/lh.ribbon.mgz - rh_ribbon: medimage/mgh-gz - # type=file|default=: Input file must be /mri/rh.ribbon.mgz - ribbon: medimage/mgh-gz - # type=file|default=: Input file must be /mri/ribbon.mgz - lh_annotation: medimage-freesurfer/pial - # type=file|default=: Input file must be /label/lh.aparc.annot - rh_annotation: medimage-freesurfer/pial - # type=file|default=: Input file must be /label/rh.aparc.annot - filled: generic/file - # type=file|default=: Implicit input filled file. Only required with FS v5.3. - aseg: generic/file - # type=file|default=: Input aseg file - ctxseg: generic/file + # # type=file|default=: Full path of file to save the output segmentation in + # lh_white: medimage-freesurfer/pial + # # type=file|default=: Input file must be /surf/lh.white + # rh_white: medimage-freesurfer/pial + # # type=file|default=: Input file must be /surf/rh.white + # lh_pial: medimage-freesurfer/pial + # # type=file|default=: Input file must be /surf/lh.pial + # rh_pial: medimage-freesurfer/pial + # # type=file|default=: Input file must be /surf/rh.pial + # lh_ribbon: medimage/mgh-gz + # # type=file|default=: Input file must be /mri/lh.ribbon.mgz + # rh_ribbon: medimage/mgh-gz + # # type=file|default=: Input file must be /mri/rh.ribbon.mgz + # ribbon: medimage/mgh-gz + # # type=file|default=: Input file must be /mri/ribbon.mgz + # lh_annotation: medimage-freesurfer/pial + # # type=file|default=: Input file must be /label/lh.aparc.annot + # rh_annotation: medimage-freesurfer/pial + # # type=file|default=: Input file must be /label/rh.aparc.annot + # filled: generic/file + # # type=file|default=: Implicit input filled file. Only required with FS v5.3. + # aseg: generic/file + # # type=file|default=: Input aseg file + # ctxseg: generic/file # type=file|default=: metadata: # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1) @@ -114,47 +114,47 @@ tests: out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - lh_white: - # type=file|default=: Input file must be /surf/lh.white - rh_white: - # type=file|default=: Input file must be /surf/rh.white - lh_pial: - # type=file|default=: Input file must be /surf/lh.pial - rh_pial: - # type=file|default=: Input file must be /surf/rh.pial - lh_ribbon: - # type=file|default=: Input file must be /mri/lh.ribbon.mgz - rh_ribbon: - # type=file|default=: Input file must be /mri/rh.ribbon.mgz - ribbon: - # type=file|default=: Input file must be /mri/ribbon.mgz - lh_annotation: - # type=file|default=: Input file must be /label/lh.aparc.annot - rh_annotation: - # type=file|default=: Input file must be /label/rh.aparc.annot - filled: - # type=file|default=: Implicit input filled file. Only required with FS v5.3. - aseg: - # type=file|default=: Input aseg file - volmask: - # type=bool|default=False: Volume mask flag - ctxseg: - # type=file|default=: - label_wm: - # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - hypo_wm: - # type=bool|default=False: Label hypointensities as WM - rip_unknown: - # type=bool|default=False: Do not label WM based on 'unknown' corical label - a2009s: - # type=bool|default=False: Using the a2009s atlas - copy_inputs: - # type=bool|default=False: If running as a node, set this to True.This will copy the input files to the node directory. - subjects_dir: - # type=directory|default=: subjects directory - args: - # type=str|default='': Additional parameters to the command - environ: + # lh_white: + # # type=file|default=: Input file must be /surf/lh.white + # rh_white: + # # type=file|default=: Input file must be /surf/rh.white + # lh_pial: + # # type=file|default=: Input file must be /surf/lh.pial + # rh_pial: + # # type=file|default=: Input file must be /surf/rh.pial + # lh_ribbon: + # # type=file|default=: Input file must be /mri/lh.ribbon.mgz + # rh_ribbon: + # # type=file|default=: Input file must be /mri/rh.ribbon.mgz + # ribbon: + # # type=file|default=: Input file must be /mri/ribbon.mgz + # lh_annotation: + # # type=file|default=: Input file must be /label/lh.aparc.annot + # rh_annotation: + # # type=file|default=: Input file must be /label/rh.aparc.annot + # filled: + # # type=file|default=: Implicit input filled file. Only required with FS v5.3. + # aseg: + # # type=file|default=: Input aseg file + # volmask: + # # type=bool|default=False: Volume mask flag + # ctxseg: + # # type=file|default=: + # label_wm: + # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + # hypo_wm: + # # type=bool|default=False: Label hypointensities as WM + # rip_unknown: + # # type=bool|default=False: Do not label WM based on 'unknown' corical label + # a2009s: + # # type=bool|default=False: Using the a2009s atlas + # copy_inputs: + # # type=bool|default=False: If running as a node, set this to True.This will copy the input files to the node directory. + # subjects_dir: + # # type=directory|default=: subjects directory + # args: + # # type=str|default='': Additional parameters to the command + # environ: # type=dict|default={}: Environment variables imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -174,30 +174,30 @@ tests: - inputs: # dict[str, str] - values to provide to inputs fields in the task initialisation # (if not specified, will try to choose a sensible value) - lh_white: - # type=file|default=: Input file must be /surf/lh.white - rh_white: - # type=file|default=: Input file must be /surf/rh.white - lh_pial: - # type=file|default=: Input file must be /surf/lh.pial - rh_pial: - # type=file|default=: Input file must be /surf/rh.pial - lh_ribbon: - # type=file|default=: Input file must be /mri/lh.ribbon.mgz - rh_ribbon: - # type=file|default=: Input file must be /mri/rh.ribbon.mgz - ribbon: - # type=file|default=: Input file must be /mri/ribbon.mgz - lh_annotation: - # type=file|default=: Input file must be /label/lh.aparc.annot - rh_annotation: - # type=file|default=: Input file must be /label/rh.aparc.annot + # lh_white: + # # type=file|default=: Input file must be /surf/lh.white + # rh_white: + # # type=file|default=: Input file must be /surf/rh.white + # lh_pial: + # # type=file|default=: Input file must be /surf/lh.pial + # rh_pial: + # # type=file|default=: Input file must be /surf/rh.pial + # lh_ribbon: + # # type=file|default=: Input file must be /mri/lh.ribbon.mgz + # rh_ribbon: + # # type=file|default=: Input file must be /mri/rh.ribbon.mgz + # ribbon: + # # type=file|default=: Input file must be /mri/ribbon.mgz + # lh_annotation: + # # type=file|default=: Input file must be /label/lh.aparc.annot + # rh_annotation: + # # type=file|default=: Input file must be /label/rh.aparc.annot out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - label_wm: 'True' - # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - rip_unknown: 'True' + # label_wm: 'True' + # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + # rip_unknown: 'True' # type=bool|default=False: Do not label WM based on 'unknown' corical label imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -221,31 +221,31 @@ doctests: # 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. - lh_white: - # type=file|default=: Input file must be /surf/lh.white - rh_white: - # type=file|default=: Input file must be /surf/rh.white - lh_pial: - # type=file|default=: Input file must be /surf/lh.pial - rh_pial: - # type=file|default=: Input file must be /surf/rh.pial - lh_ribbon: - # type=file|default=: Input file must be /mri/lh.ribbon.mgz - rh_ribbon: - # type=file|default=: Input file must be /mri/rh.ribbon.mgz - ribbon: - # type=file|default=: Input file must be /mri/ribbon.mgz - lh_annotation: - # type=file|default=: Input file must be /label/lh.aparc.annot - rh_annotation: - # type=file|default=: Input file must be /label/rh.aparc.annot + # lh_white: + # # type=file|default=: Input file must be /surf/lh.white + # rh_white: + # # type=file|default=: Input file must be /surf/rh.white + # lh_pial: + # # type=file|default=: Input file must be /surf/lh.pial + # rh_pial: + # # type=file|default=: Input file must be /surf/rh.pial + # lh_ribbon: + # # type=file|default=: Input file must be /mri/lh.ribbon.mgz + # rh_ribbon: + # # type=file|default=: Input file must be /mri/rh.ribbon.mgz + # ribbon: + # # type=file|default=: Input file must be /mri/ribbon.mgz + # lh_annotation: + # # type=file|default=: Input file must be /label/lh.aparc.annot + # rh_annotation: + # # type=file|default=: Input file must be /label/rh.aparc.annot out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - label_wm: 'True' - # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - rip_unknown: 'True' - # type=bool|default=False: Do not label WM based on 'unknown' corical label + # label_wm: 'True' + # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + # rip_unknown: 'True' + # # type=bool|default=False: Do not label WM based on 'unknown' corical label imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item # consisting of 'module', 'name', and optionally 'alias' keys From 68ea728791ada1015f09b32f26497b4f39d43317 Mon Sep 17 00:00:00 2001 From: adsouza Date: Tue, 19 Mar 2024 14:52:49 +1100 Subject: [PATCH 3/9] editing add_x_form_to_header yaml --- nipype-auto-conv/specs/add_x_form_to_header.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nipype-auto-conv/specs/add_x_form_to_header.yaml b/nipype-auto-conv/specs/add_x_form_to_header.yaml index 00945a3d..ecdf7530 100644 --- a/nipype-auto-conv/specs/add_x_form_to_header.yaml +++ b/nipype-auto-conv/specs/add_x_form_to_header.yaml @@ -50,9 +50,10 @@ inputs: # type=file|default=: input volume transform: datascience/text-matrix # type=file|default=: xfm file - out_file: generic/file + out_file: Path # type=file: output volume # type=file|default='output.mgz': output volume + # output_file_template ='output.mgz' metadata: # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1) outputs: @@ -69,11 +70,13 @@ outputs: out_file: generic/file # type=file: output volume # type=file|default='output.mgz': output volume + # output_file_template ='output.mgz' 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 + out_file: 'output.mgz' requirements: # dict[str, list[str]] - input fields that are required to be provided for the output field to be present tests: From 8bafe134a4701cf34f9c7153400b9407c8e908db Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 19 Mar 2024 14:52:49 +1100 Subject: [PATCH 4/9] added fileformats-medimage-freesurfer to nipype-auto-conv requirements --- .github/workflows/ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 887e627a..27e72d89 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -30,7 +30,7 @@ jobs: - name: Install build dependencies run: python -m pip install --upgrade pip - name: Install requirements - run: python -m pip install -r ./nipype-auto-conv/requirements.txt + run: python -m pip install ./related-packages/fileformats -r ./nipype-auto-conv/requirements.txt - name: Run automatic Nipype > Pydra conversion run: ./nipype-auto-conv/generate - uses: actions/upload-artifact@v3 From d962aeb41cbfd64f189a59f188dc77dcc4312d1c Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 19 Mar 2024 14:52:49 +1100 Subject: [PATCH 5/9] touched up test dependencies in fileformats-medimage-freesurfer --- related-packages/fileformats/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/related-packages/fileformats/pyproject.toml b/related-packages/fileformats/pyproject.toml index 9fd2a2fc..ad324c2e 100644 --- a/related-packages/fileformats/pyproject.toml +++ b/related-packages/fileformats/pyproject.toml @@ -51,7 +51,7 @@ test = [ "pytest-env>=0.6.2", "pytest-cov>=2.12.1", "codecov", - "fileformats-medimage-medimage-extras", + "fileformats-medimage-extras", ] [project.urls] From 7683a408d47bd320a58ab45a03236f0e2575f9da Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 19 Mar 2024 14:54:07 +1100 Subject: [PATCH 6/9] updated to latest package generator version --- .gitignore | 2 - docs/index.rst | 2 +- .../specs/add_x_form_to_header.yaml | 17 +- nipype-auto-conv/specs/aparc_2_aseg.yaml | 218 ++++++------- nipype-auto-conv/specs/apas_2_aseg.yaml | 2 +- nipype-auto-conv/specs/apply_mask.yaml | 2 +- .../specs/apply_vol_transform.yaml | 2 +- nipype-auto-conv/specs/bb_register.yaml | 2 +- nipype-auto-conv/specs/binarize.yaml | 2 +- nipype-auto-conv/specs/ca_label.yaml | 2 +- nipype-auto-conv/specs/ca_normalize.yaml | 2 +- nipype-auto-conv/specs/ca_register.yaml | 2 +- .../specs/check_talairach_alignment.yaml | 2 +- nipype-auto-conv/specs/concatenate.yaml | 2 +- nipype-auto-conv/specs/concatenate_lta.yaml | 2 +- nipype-auto-conv/specs/contrast.yaml | 2 +- nipype-auto-conv/specs/curvature.yaml | 2 +- nipype-auto-conv/specs/curvature_stats.yaml | 2 +- nipype-auto-conv/specs/dicom_convert.yaml | 2 +- nipype-auto-conv/specs/edit_w_mwith_aseg.yaml | 2 +- nipype-auto-conv/specs/em_register.yaml | 2 +- nipype-auto-conv/specs/euler_number.yaml | 2 +- .../specs/extract_main_component.yaml | 2 +- nipype-auto-conv/specs/fit_ms_params.yaml | 2 +- nipype-auto-conv/specs/fix_topology.yaml | 2 +- .../specs/fuse_segmentations.yaml | 2 +- nipype-auto-conv/specs/glm_fit.yaml | 2 +- nipype-auto-conv/specs/gtm_seg.yaml | 2 +- nipype-auto-conv/specs/gtmpvc.yaml | 2 +- nipype-auto-conv/specs/image_info.yaml | 74 +++++ .../specs/image_info_callables.py | 1 + nipype-auto-conv/specs/jacobian.yaml | 2 +- nipype-auto-conv/specs/label_2_annot.yaml | 2 +- nipype-auto-conv/specs/label_2_label.yaml | 2 +- nipype-auto-conv/specs/label_2_vol.yaml | 2 +- nipype-auto-conv/specs/logan_ref.yaml | 295 +++++++++++++++++ nipype-auto-conv/specs/logan_ref_callables.py | 1 + nipype-auto-conv/specs/lta_convert.yaml | 138 ++++++++ .../specs/lta_convert_callables.py | 1 + .../specs/make_average_subject.yaml | 2 +- nipype-auto-conv/specs/make_surfaces.yaml | 2 +- .../specs/mni_bias_correction.yaml | 2 +- nipype-auto-conv/specs/mp_rto_mni305.yaml | 2 +- nipype-auto-conv/specs/mr_is_ca_label.yaml | 2 +- nipype-auto-conv/specs/mr_is_calc.yaml | 2 +- nipype-auto-conv/specs/mr_is_combine.yaml | 2 +- nipype-auto-conv/specs/mr_is_convert.yaml | 2 +- nipype-auto-conv/specs/mr_is_expand.yaml | 2 +- nipype-auto-conv/specs/mr_is_inflate.yaml | 2 +- nipype-auto-conv/specs/mri_convert.yaml | 2 +- nipype-auto-conv/specs/mri_coreg.yaml | 2 +- nipype-auto-conv/specs/mri_fill.yaml | 2 +- .../specs/mri_marching_cubes.yaml | 2 +- nipype-auto-conv/specs/mri_pretess.yaml | 2 +- nipype-auto-conv/specs/mri_tessellate.yaml | 2 +- nipype-auto-conv/specs/mris_preproc.yaml | 2 +- .../specs/mris_preproc_recon_all.yaml | 2 +- nipype-auto-conv/specs/mrtm.yaml | 296 +++++++++++++++++ nipype-auto-conv/specs/mrtm2.yaml | 295 +++++++++++++++++ nipype-auto-conv/specs/mrtm2_callables.py | 1 + nipype-auto-conv/specs/mrtm_callables.py | 1 + nipype-auto-conv/specs/ms__lda.yaml | 2 +- nipype-auto-conv/specs/normalize.yaml | 2 +- nipype-auto-conv/specs/one_sample_t_test.yaml | 2 +- nipype-auto-conv/specs/paint.yaml | 2 +- .../specs/parcellation_stats.yaml | 2 +- nipype-auto-conv/specs/parse_dicom_dir.yaml | 2 +- nipype-auto-conv/specs/recon_all.yaml | 128 +++++++- nipype-auto-conv/specs/register.yaml | 2 +- .../specs/register_av_ito_talairach.yaml | 2 +- .../specs/relabel_hypointensities.yaml | 2 +- .../specs/remove_intersection.yaml | 2 +- nipype-auto-conv/specs/remove_neck.yaml | 2 +- nipype-auto-conv/specs/resample.yaml | 2 +- nipype-auto-conv/specs/robust_register.yaml | 2 +- nipype-auto-conv/specs/robust_template.yaml | 8 +- nipype-auto-conv/specs/sample_to_surface.yaml | 2 +- nipype-auto-conv/specs/seg_stats.yaml | 2 +- .../specs/seg_stats_recon_all.yaml | 2 +- nipype-auto-conv/specs/segment_cc.yaml | 2 +- nipype-auto-conv/specs/segment_wm.yaml | 2 +- nipype-auto-conv/specs/smooth.yaml | 2 +- .../specs/smooth_tessellation.yaml | 2 +- nipype-auto-conv/specs/sphere.yaml | 2 +- nipype-auto-conv/specs/spherical_average.yaml | 2 +- .../specs/surface_2_vol_transform.yaml | 2 +- nipype-auto-conv/specs/surface_smooth.yaml | 2 +- nipype-auto-conv/specs/surface_snapshots.yaml | 2 +- nipype-auto-conv/specs/surface_transform.yaml | 2 +- nipype-auto-conv/specs/synthesize_flash.yaml | 2 +- nipype-auto-conv/specs/talairach_avi.yaml | 2 +- nipype-auto-conv/specs/talairach_qc.yaml | 2 +- nipype-auto-conv/specs/tkregister_2.yaml | 2 +- nipype-auto-conv/specs/unpack_sdicom_dir.yaml | 2 +- nipype-auto-conv/specs/volume_mask.yaml | 2 +- .../specs/watershed_skull_strip.yaml | 2 +- related-packages/conftest.py | 37 +++ .../fileformats-extras/README.rst | 6 +- .../extras/medimage_freesurfer/__init__.py | 55 ++-- .../extras/medimage_freesurfer/_version.py | 16 - .../fileformats-extras/pyproject.toml | 4 +- related-packages/fileformats/README.rst | 14 +- .../medimage_freesurfer/__init__.py | 61 ++-- .../medimage_freesurfer/_version.py | 16 - related-packages/fileformats/pyproject.toml | 6 +- workflows/ci-cd.yaml | 305 ++++++++++++++++++ 106 files changed, 1850 insertions(+), 308 deletions(-) create mode 100644 nipype-auto-conv/specs/image_info.yaml create mode 100644 nipype-auto-conv/specs/image_info_callables.py create mode 100644 nipype-auto-conv/specs/logan_ref.yaml create mode 100644 nipype-auto-conv/specs/logan_ref_callables.py create mode 100644 nipype-auto-conv/specs/lta_convert.yaml create mode 100644 nipype-auto-conv/specs/lta_convert_callables.py create mode 100644 nipype-auto-conv/specs/mrtm.yaml create mode 100644 nipype-auto-conv/specs/mrtm2.yaml create mode 100644 nipype-auto-conv/specs/mrtm2_callables.py create mode 100644 nipype-auto-conv/specs/mrtm_callables.py create mode 100644 related-packages/conftest.py delete mode 100644 related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py delete mode 100644 related-packages/fileformats/fileformats/medimage_freesurfer/_version.py create mode 100644 workflows/ci-cd.yaml diff --git a/.gitignore b/.gitignore index 3bd5f8ae..b160ce28 100644 --- a/.gitignore +++ b/.gitignore @@ -139,5 +139,3 @@ dmypy.json /pydra/tasks/freesurfer/auto /pydra/tasks/freesurfer/_version.py -/fileformats/src/fileformats/medimage_freesurfer/_version.py -/fileformats/extras/fileformats/extras/medimage_freesurfer/_version.py diff --git a/docs/index.rst b/docs/index.rst index 2f809eb5..bc1ee5e5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ Welcome to pydra-freesurfer's documentation! -============================================ +========================================= .. toctree:: :maxdepth: 2 diff --git a/nipype-auto-conv/specs/add_x_form_to_header.yaml b/nipype-auto-conv/specs/add_x_form_to_header.yaml index ecdf7530..993a596c 100644 --- a/nipype-auto-conv/specs/add_x_form_to_header.yaml +++ b/nipype-auto-conv/specs/add_x_form_to_header.yaml @@ -34,7 +34,7 @@ # task_name: AddXFormToHeader nipype_name: AddXFormToHeader -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface @@ -50,10 +50,9 @@ inputs: # type=file|default=: input volume transform: datascience/text-matrix # type=file|default=: xfm file - out_file: Path + out_file: generic/file # type=file: output volume # type=file|default='output.mgz': output volume - # output_file_template ='output.mgz' metadata: # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1) outputs: @@ -70,13 +69,11 @@ outputs: out_file: generic/file # type=file: output volume # type=file|default='output.mgz': output volume - # output_file_template ='output.mgz' 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 - out_file: 'output.mgz' requirements: # dict[str, list[str]] - input fields that are required to be provided for the output field to be present tests: @@ -90,11 +87,11 @@ tests: out_file: # type=file: output volume # type=file|default='output.mgz': output volume - copy_name: "False" + copy_name: # type=bool|default=False: do not try to load the xfmfile, just copy name - verbose: "False" + verbose: # type=bool|default=False: be verbose - # subjects_dir: + subjects_dir: # type=directory|default=: subjects directory args: # type=str|default='': Additional parameters to the command @@ -140,7 +137,7 @@ tests: - inputs: # dict[str, str] - values to provide to inputs fields in the task initialisation # (if not specified, will try to choose a sensible value) - copy_name: "False" + copy_name: 'True' # type=bool|default=False: do not try to load the xfmfile, just copy name imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -179,7 +176,7 @@ doctests: # 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. - copy_name: "False" + copy_name: 'True' # type=bool|default=False: do not try to load the xfmfile, just copy name imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item diff --git a/nipype-auto-conv/specs/aparc_2_aseg.yaml b/nipype-auto-conv/specs/aparc_2_aseg.yaml index 2f55692c..d0ddbc5c 100644 --- a/nipype-auto-conv/specs/aparc_2_aseg.yaml +++ b/nipype-auto-conv/specs/aparc_2_aseg.yaml @@ -43,7 +43,7 @@ # task_name: Aparc2Aseg nipype_name: Aparc2Aseg -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface @@ -57,30 +57,30 @@ inputs: # passed to the field in the automatically generated unittests. out_file: medimage/mgh-gz # type=file: Output aseg file - # # type=file|default=: Full path of file to save the output segmentation in - # lh_white: medimage-freesurfer/pial - # # type=file|default=: Input file must be /surf/lh.white - # rh_white: medimage-freesurfer/pial - # # type=file|default=: Input file must be /surf/rh.white - # lh_pial: medimage-freesurfer/pial - # # type=file|default=: Input file must be /surf/lh.pial - # rh_pial: medimage-freesurfer/pial - # # type=file|default=: Input file must be /surf/rh.pial - # lh_ribbon: medimage/mgh-gz - # # type=file|default=: Input file must be /mri/lh.ribbon.mgz - # rh_ribbon: medimage/mgh-gz - # # type=file|default=: Input file must be /mri/rh.ribbon.mgz - # ribbon: medimage/mgh-gz - # # type=file|default=: Input file must be /mri/ribbon.mgz - # lh_annotation: medimage-freesurfer/pial - # # type=file|default=: Input file must be /label/lh.aparc.annot - # rh_annotation: medimage-freesurfer/pial - # # type=file|default=: Input file must be /label/rh.aparc.annot - # filled: generic/file - # # type=file|default=: Implicit input filled file. Only required with FS v5.3. - # aseg: generic/file - # # type=file|default=: Input aseg file - # ctxseg: generic/file + # type=file|default=: Full path of file to save the output segmentation in + lh_white: medimage-freesurfer/pial + # type=file|default=: Input file must be /surf/lh.white + rh_white: medimage-freesurfer/pial + # type=file|default=: Input file must be /surf/rh.white + lh_pial: medimage-freesurfer/pial + # type=file|default=: Input file must be /surf/lh.pial + rh_pial: medimage-freesurfer/pial + # type=file|default=: Input file must be /surf/rh.pial + lh_ribbon: medimage/mgh-gz + # type=file|default=: Input file must be /mri/lh.ribbon.mgz + rh_ribbon: medimage/mgh-gz + # type=file|default=: Input file must be /mri/rh.ribbon.mgz + ribbon: medimage/mgh-gz + # type=file|default=: Input file must be /mri/ribbon.mgz + lh_annotation: medimage-freesurfer/pial + # type=file|default=: Input file must be /label/lh.aparc.annot + rh_annotation: medimage-freesurfer/pial + # type=file|default=: Input file must be /label/rh.aparc.annot + filled: generic/file + # type=file|default=: Implicit input filled file. Only required with FS v5.3. + aseg: generic/file + # type=file|default=: Input aseg file + ctxseg: generic/file # type=file|default=: metadata: # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1) @@ -114,47 +114,47 @@ tests: out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - # lh_white: - # # type=file|default=: Input file must be /surf/lh.white - # rh_white: - # # type=file|default=: Input file must be /surf/rh.white - # lh_pial: - # # type=file|default=: Input file must be /surf/lh.pial - # rh_pial: - # # type=file|default=: Input file must be /surf/rh.pial - # lh_ribbon: - # # type=file|default=: Input file must be /mri/lh.ribbon.mgz - # rh_ribbon: - # # type=file|default=: Input file must be /mri/rh.ribbon.mgz - # ribbon: - # # type=file|default=: Input file must be /mri/ribbon.mgz - # lh_annotation: - # # type=file|default=: Input file must be /label/lh.aparc.annot - # rh_annotation: - # # type=file|default=: Input file must be /label/rh.aparc.annot - # filled: - # # type=file|default=: Implicit input filled file. Only required with FS v5.3. - # aseg: - # # type=file|default=: Input aseg file - # volmask: - # # type=bool|default=False: Volume mask flag - # ctxseg: - # # type=file|default=: - # label_wm: - # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - # hypo_wm: - # # type=bool|default=False: Label hypointensities as WM - # rip_unknown: - # # type=bool|default=False: Do not label WM based on 'unknown' corical label - # a2009s: - # # type=bool|default=False: Using the a2009s atlas - # copy_inputs: - # # type=bool|default=False: If running as a node, set this to True.This will copy the input files to the node directory. - # subjects_dir: - # # type=directory|default=: subjects directory - # args: - # # type=str|default='': Additional parameters to the command - # environ: + lh_white: + # type=file|default=: Input file must be /surf/lh.white + rh_white: + # type=file|default=: Input file must be /surf/rh.white + lh_pial: + # type=file|default=: Input file must be /surf/lh.pial + rh_pial: + # type=file|default=: Input file must be /surf/rh.pial + lh_ribbon: + # type=file|default=: Input file must be /mri/lh.ribbon.mgz + rh_ribbon: + # type=file|default=: Input file must be /mri/rh.ribbon.mgz + ribbon: + # type=file|default=: Input file must be /mri/ribbon.mgz + lh_annotation: + # type=file|default=: Input file must be /label/lh.aparc.annot + rh_annotation: + # type=file|default=: Input file must be /label/rh.aparc.annot + filled: + # type=file|default=: Implicit input filled file. Only required with FS v5.3. + aseg: + # type=file|default=: Input aseg file + volmask: + # type=bool|default=False: Volume mask flag + ctxseg: + # type=file|default=: + label_wm: + # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + hypo_wm: + # type=bool|default=False: Label hypointensities as WM + rip_unknown: + # type=bool|default=False: Do not label WM based on 'unknown' corical label + a2009s: + # type=bool|default=False: Using the a2009s atlas + copy_inputs: + # type=bool|default=False: If running as a node, set this to True.This will copy the input files to the node directory. + subjects_dir: + # type=directory|default=: subjects directory + args: + # type=str|default='': Additional parameters to the command + environ: # type=dict|default={}: Environment variables imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -174,30 +174,30 @@ tests: - inputs: # dict[str, str] - values to provide to inputs fields in the task initialisation # (if not specified, will try to choose a sensible value) - # lh_white: - # # type=file|default=: Input file must be /surf/lh.white - # rh_white: - # # type=file|default=: Input file must be /surf/rh.white - # lh_pial: - # # type=file|default=: Input file must be /surf/lh.pial - # rh_pial: - # # type=file|default=: Input file must be /surf/rh.pial - # lh_ribbon: - # # type=file|default=: Input file must be /mri/lh.ribbon.mgz - # rh_ribbon: - # # type=file|default=: Input file must be /mri/rh.ribbon.mgz - # ribbon: - # # type=file|default=: Input file must be /mri/ribbon.mgz - # lh_annotation: - # # type=file|default=: Input file must be /label/lh.aparc.annot - # rh_annotation: - # # type=file|default=: Input file must be /label/rh.aparc.annot + lh_white: + # type=file|default=: Input file must be /surf/lh.white + rh_white: + # type=file|default=: Input file must be /surf/rh.white + lh_pial: + # type=file|default=: Input file must be /surf/lh.pial + rh_pial: + # type=file|default=: Input file must be /surf/rh.pial + lh_ribbon: + # type=file|default=: Input file must be /mri/lh.ribbon.mgz + rh_ribbon: + # type=file|default=: Input file must be /mri/rh.ribbon.mgz + ribbon: + # type=file|default=: Input file must be /mri/ribbon.mgz + lh_annotation: + # type=file|default=: Input file must be /label/lh.aparc.annot + rh_annotation: + # type=file|default=: Input file must be /label/rh.aparc.annot out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - # label_wm: 'True' - # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - # rip_unknown: 'True' + label_wm: 'True' + # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + rip_unknown: 'True' # type=bool|default=False: Do not label WM based on 'unknown' corical label imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item @@ -221,31 +221,31 @@ doctests: # 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. - # lh_white: - # # type=file|default=: Input file must be /surf/lh.white - # rh_white: - # # type=file|default=: Input file must be /surf/rh.white - # lh_pial: - # # type=file|default=: Input file must be /surf/lh.pial - # rh_pial: - # # type=file|default=: Input file must be /surf/rh.pial - # lh_ribbon: - # # type=file|default=: Input file must be /mri/lh.ribbon.mgz - # rh_ribbon: - # # type=file|default=: Input file must be /mri/rh.ribbon.mgz - # ribbon: - # # type=file|default=: Input file must be /mri/ribbon.mgz - # lh_annotation: - # # type=file|default=: Input file must be /label/lh.aparc.annot - # rh_annotation: - # # type=file|default=: Input file must be /label/rh.aparc.annot + lh_white: + # type=file|default=: Input file must be /surf/lh.white + rh_white: + # type=file|default=: Input file must be /surf/rh.white + lh_pial: + # type=file|default=: Input file must be /surf/lh.pial + rh_pial: + # type=file|default=: Input file must be /surf/rh.pial + lh_ribbon: + # type=file|default=: Input file must be /mri/lh.ribbon.mgz + rh_ribbon: + # type=file|default=: Input file must be /mri/rh.ribbon.mgz + ribbon: + # type=file|default=: Input file must be /mri/ribbon.mgz + lh_annotation: + # type=file|default=: Input file must be /label/lh.aparc.annot + rh_annotation: + # type=file|default=: Input file must be /label/rh.aparc.annot out_file: # type=file: Output aseg file # type=file|default=: Full path of file to save the output segmentation in - # label_wm: 'True' - # # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. - # rip_unknown: 'True' - # # type=bool|default=False: Do not label WM based on 'unknown' corical label + label_wm: 'True' + # type=bool|default=False: For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. + rip_unknown: 'True' + # type=bool|default=False: Do not label WM based on 'unknown' corical label imports: # list[nipype2pydra.task.importstatement] - list import statements required by the test, with each list item # consisting of 'module', 'name', and optionally 'alias' keys diff --git a/nipype-auto-conv/specs/apas_2_aseg.yaml b/nipype-auto-conv/specs/apas_2_aseg.yaml index 2e323ade..805509ae 100644 --- a/nipype-auto-conv/specs/apas_2_aseg.yaml +++ b/nipype-auto-conv/specs/apas_2_aseg.yaml @@ -23,7 +23,7 @@ # task_name: Apas2Aseg nipype_name: Apas2Aseg -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/apply_mask.yaml b/nipype-auto-conv/specs/apply_mask.yaml index 893825c4..0650151b 100644 --- a/nipype-auto-conv/specs/apply_mask.yaml +++ b/nipype-auto-conv/specs/apply_mask.yaml @@ -14,7 +14,7 @@ # task_name: ApplyMask nipype_name: ApplyMask -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/apply_vol_transform.yaml b/nipype-auto-conv/specs/apply_vol_transform.yaml index 6da9b21f..1d7a8d4b 100644 --- a/nipype-auto-conv/specs/apply_vol_transform.yaml +++ b/nipype-auto-conv/specs/apply_vol_transform.yaml @@ -22,7 +22,7 @@ # task_name: ApplyVolTransform nipype_name: ApplyVolTransform -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/bb_register.yaml b/nipype-auto-conv/specs/bb_register.yaml index 5173b17e..d7209410 100644 --- a/nipype-auto-conv/specs/bb_register.yaml +++ b/nipype-auto-conv/specs/bb_register.yaml @@ -22,7 +22,7 @@ # task_name: BBRegister nipype_name: BBRegister -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/binarize.yaml b/nipype-auto-conv/specs/binarize.yaml index 586affee..743985ff 100644 --- a/nipype-auto-conv/specs/binarize.yaml +++ b/nipype-auto-conv/specs/binarize.yaml @@ -16,7 +16,7 @@ # task_name: Binarize nipype_name: Binarize -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/ca_label.yaml b/nipype-auto-conv/specs/ca_label.yaml index dda03480..c847e699 100644 --- a/nipype-auto-conv/specs/ca_label.yaml +++ b/nipype-auto-conv/specs/ca_label.yaml @@ -26,7 +26,7 @@ # task_name: CALabel nipype_name: CALabel -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/ca_normalize.yaml b/nipype-auto-conv/specs/ca_normalize.yaml index f4a70c49..407e54f5 100644 --- a/nipype-auto-conv/specs/ca_normalize.yaml +++ b/nipype-auto-conv/specs/ca_normalize.yaml @@ -26,7 +26,7 @@ # task_name: CANormalize nipype_name: CANormalize -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/ca_register.yaml b/nipype-auto-conv/specs/ca_register.yaml index 4312d34f..a47ebcf1 100644 --- a/nipype-auto-conv/specs/ca_register.yaml +++ b/nipype-auto-conv/specs/ca_register.yaml @@ -24,7 +24,7 @@ # task_name: CARegister nipype_name: CARegister -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/check_talairach_alignment.yaml b/nipype-auto-conv/specs/check_talairach_alignment.yaml index f8837291..5e795dac 100644 --- a/nipype-auto-conv/specs/check_talairach_alignment.yaml +++ b/nipype-auto-conv/specs/check_talairach_alignment.yaml @@ -23,7 +23,7 @@ # task_name: CheckTalairachAlignment nipype_name: CheckTalairachAlignment -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/concatenate.yaml b/nipype-auto-conv/specs/concatenate.yaml index e03a17b7..f2098608 100644 --- a/nipype-auto-conv/specs/concatenate.yaml +++ b/nipype-auto-conv/specs/concatenate.yaml @@ -22,7 +22,7 @@ # task_name: Concatenate nipype_name: Concatenate -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/concatenate_lta.yaml b/nipype-auto-conv/specs/concatenate_lta.yaml index 2a6b2d35..8e2a694c 100644 --- a/nipype-auto-conv/specs/concatenate_lta.yaml +++ b/nipype-auto-conv/specs/concatenate_lta.yaml @@ -35,7 +35,7 @@ # task_name: ConcatenateLTA nipype_name: ConcatenateLTA -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/contrast.yaml b/nipype-auto-conv/specs/contrast.yaml index e9255dbe..7879eff9 100644 --- a/nipype-auto-conv/specs/contrast.yaml +++ b/nipype-auto-conv/specs/contrast.yaml @@ -25,7 +25,7 @@ # task_name: Contrast nipype_name: Contrast -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/curvature.yaml b/nipype-auto-conv/specs/curvature.yaml index e0532e02..32c1fd9f 100644 --- a/nipype-auto-conv/specs/curvature.yaml +++ b/nipype-auto-conv/specs/curvature.yaml @@ -21,7 +21,7 @@ # task_name: Curvature nipype_name: Curvature -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/curvature_stats.yaml b/nipype-auto-conv/specs/curvature_stats.yaml index 16431060..096ad392 100644 --- a/nipype-auto-conv/specs/curvature_stats.yaml +++ b/nipype-auto-conv/specs/curvature_stats.yaml @@ -44,7 +44,7 @@ # task_name: CurvatureStats nipype_name: CurvatureStats -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/dicom_convert.yaml b/nipype-auto-conv/specs/dicom_convert.yaml index b717d989..ce44ce38 100644 --- a/nipype-auto-conv/specs/dicom_convert.yaml +++ b/nipype-auto-conv/specs/dicom_convert.yaml @@ -18,7 +18,7 @@ # task_name: DICOMConvert nipype_name: DICOMConvert -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/edit_w_mwith_aseg.yaml b/nipype-auto-conv/specs/edit_w_mwith_aseg.yaml index 07468514..64e438bc 100644 --- a/nipype-auto-conv/specs/edit_w_mwith_aseg.yaml +++ b/nipype-auto-conv/specs/edit_w_mwith_aseg.yaml @@ -22,7 +22,7 @@ # task_name: EditWMwithAseg nipype_name: EditWMwithAseg -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/em_register.yaml b/nipype-auto-conv/specs/em_register.yaml index dea7adf1..1821bc51 100644 --- a/nipype-auto-conv/specs/em_register.yaml +++ b/nipype-auto-conv/specs/em_register.yaml @@ -21,7 +21,7 @@ # task_name: EMRegister nipype_name: EMRegister -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/euler_number.yaml b/nipype-auto-conv/specs/euler_number.yaml index b5d6c415..dbfc5497 100644 --- a/nipype-auto-conv/specs/euler_number.yaml +++ b/nipype-auto-conv/specs/euler_number.yaml @@ -18,7 +18,7 @@ # task_name: EulerNumber nipype_name: EulerNumber -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/extract_main_component.yaml b/nipype-auto-conv/specs/extract_main_component.yaml index e8880b1d..1b47f6d7 100644 --- a/nipype-auto-conv/specs/extract_main_component.yaml +++ b/nipype-auto-conv/specs/extract_main_component.yaml @@ -18,7 +18,7 @@ # task_name: ExtractMainComponent nipype_name: ExtractMainComponent -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/fit_ms_params.yaml b/nipype-auto-conv/specs/fit_ms_params.yaml index e6a757ba..269de091 100644 --- a/nipype-auto-conv/specs/fit_ms_params.yaml +++ b/nipype-auto-conv/specs/fit_ms_params.yaml @@ -19,7 +19,7 @@ # task_name: FitMSParams nipype_name: FitMSParams -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/fix_topology.yaml b/nipype-auto-conv/specs/fix_topology.yaml index 1338347a..219ba7f7 100644 --- a/nipype-auto-conv/specs/fix_topology.yaml +++ b/nipype-auto-conv/specs/fix_topology.yaml @@ -26,7 +26,7 @@ # task_name: FixTopology nipype_name: FixTopology -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/fuse_segmentations.yaml b/nipype-auto-conv/specs/fuse_segmentations.yaml index e6c7ea0e..f8e5e082 100644 --- a/nipype-auto-conv/specs/fuse_segmentations.yaml +++ b/nipype-auto-conv/specs/fuse_segmentations.yaml @@ -22,7 +22,7 @@ # task_name: FuseSegmentations nipype_name: FuseSegmentations -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.longitudinal inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/glm_fit.yaml b/nipype-auto-conv/specs/glm_fit.yaml index 0061edd9..03c9fd90 100644 --- a/nipype-auto-conv/specs/glm_fit.yaml +++ b/nipype-auto-conv/specs/glm_fit.yaml @@ -18,7 +18,7 @@ # task_name: GLMFit nipype_name: GLMFit -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/gtm_seg.yaml b/nipype-auto-conv/specs/gtm_seg.yaml index 699ae602..028fbb0b 100644 --- a/nipype-auto-conv/specs/gtm_seg.yaml +++ b/nipype-auto-conv/specs/gtm_seg.yaml @@ -16,7 +16,7 @@ # task_name: GTMSeg nipype_name: GTMSeg -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.petsurfer inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/gtmpvc.yaml b/nipype-auto-conv/specs/gtmpvc.yaml index 7d821fd8..18ae73ce 100644 --- a/nipype-auto-conv/specs/gtmpvc.yaml +++ b/nipype-auto-conv/specs/gtmpvc.yaml @@ -35,7 +35,7 @@ # task_name: GTMPVC nipype_name: GTMPVC -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.petsurfer inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/image_info.yaml b/nipype-auto-conv/specs/image_info.yaml new file mode 100644 index 00000000..751df773 --- /dev/null +++ b/nipype-auto-conv/specs/image_info.yaml @@ -0,0 +1,74 @@ +# This file is used to manually specify the semi-automatic conversion of +# 'nipype.interfaces.freesurfer.utils.ImageInfo' from Nipype to Pydra. +# +# Please fill-in/edit the fields below where appropriate +# +# Docs +# ---- +# +task_name: ImageInfo +nipype_name: ImageInfo +nipype_module: nipype.interfaces.freesurfer.utils +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. + in_file: generic/file + # type=file|default=: image to query + 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. + out_file: generic/file + # type=file: text file with image information + 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 +tests: +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + in_file: + # type=file|default=: image to query + subjects_dir: + # type=directory|default=: subjects directory + args: + # type=str|default='': Additional parameters to the command + environ: + # type=dict|default={}: Environment variables + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: [] diff --git a/nipype-auto-conv/specs/image_info_callables.py b/nipype-auto-conv/specs/image_info_callables.py new file mode 100644 index 00000000..d6754e7f --- /dev/null +++ b/nipype-auto-conv/specs/image_info_callables.py @@ -0,0 +1 @@ +"""Module to put any functions that are referred to in ImageInfo.yaml""" diff --git a/nipype-auto-conv/specs/jacobian.yaml b/nipype-auto-conv/specs/jacobian.yaml index d81a552a..caa1441c 100644 --- a/nipype-auto-conv/specs/jacobian.yaml +++ b/nipype-auto-conv/specs/jacobian.yaml @@ -19,7 +19,7 @@ # task_name: Jacobian nipype_name: Jacobian -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/label_2_annot.yaml b/nipype-auto-conv/specs/label_2_annot.yaml index 1833f7f4..542a41e1 100644 --- a/nipype-auto-conv/specs/label_2_annot.yaml +++ b/nipype-auto-conv/specs/label_2_annot.yaml @@ -22,7 +22,7 @@ # task_name: Label2Annot nipype_name: Label2Annot -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/label_2_label.yaml b/nipype-auto-conv/specs/label_2_label.yaml index 5518f3b1..d45a89b3 100644 --- a/nipype-auto-conv/specs/label_2_label.yaml +++ b/nipype-auto-conv/specs/label_2_label.yaml @@ -33,7 +33,7 @@ # task_name: Label2Label nipype_name: Label2Label -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/label_2_vol.yaml b/nipype-auto-conv/specs/label_2_vol.yaml index e762f6a3..9be4ac35 100644 --- a/nipype-auto-conv/specs/label_2_vol.yaml +++ b/nipype-auto-conv/specs/label_2_vol.yaml @@ -16,7 +16,7 @@ # task_name: Label2Vol nipype_name: Label2Vol -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/logan_ref.yaml b/nipype-auto-conv/specs/logan_ref.yaml new file mode 100644 index 00000000..09e3a50d --- /dev/null +++ b/nipype-auto-conv/specs/logan_ref.yaml @@ -0,0 +1,295 @@ +# This file is used to manually specify the semi-automatic conversion of +# 'nipype.interfaces.freesurfer.petsurfer.LoganRef' from Nipype to Pydra. +# +# Please fill-in/edit the fields below where appropriate +# +# Docs +# ---- +# Perform Logan reference kinetic modeling. +# Examples +# -------- +# >>> logan = LoganRef() +# >>> logan.inputs.in_file = 'tac.nii' +# >>> logan.inputs.logan = ('ref_tac.dat', 'timing.dat', 2600) +# >>> logan.inputs.glm_dir = 'logan' +# >>> logan.cmdline +# 'mri_glmfit --glmdir logan --y tac.nii --logan ref_tac.dat timing.dat 2600' +# +task_name: LoganRef +nipype_name: LoganRef +nipype_module: nipype.interfaces.freesurfer.petsurfer +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. + in_file: medimage/nifti1 + # type=file|default=: input 4D file + design: generic/file + # type=file|default=: design matrix file + contrast: generic/file+list-of + # type=inputmultiobject|default=[]: contrast file + per_voxel_reg: generic/file+list-of + # type=inputmultiobject|default=[]: per-voxel regressors + weighted_ls: generic/file + # type=file|default=: weighted least squares + fixed_fx_var: generic/file + # type=file|default=: for fixed effects analysis + fixed_fx_dof_file: generic/file + # type=file|default=: text file with dof for fixed effects analysis + weight_file: generic/file + # type=file|default=: weight for each input at each voxel + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: generic/file + # type=file|default=: use label as mask, surfaces only + sim_done_file: generic/file + # type=file|default=: create file when simulation finished + 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. + beta_file: generic/file + # type=file: map of regression coefficients + error_file: generic/file + # type=file: map of residual error + error_var_file: generic/file + # type=file: map of residual error variance + error_stddev_file: generic/file + # type=file: map of residual error standard deviation + estimate_file: generic/file + # type=file: map of the estimated Y values + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + fwhm_file: generic/file + # type=file: text file with estimated smoothness + dof_file: generic/file + # type=file: text file with effective degrees-of-freedom for the analysis + spatial_eigenvectors: generic/file + # type=file: map of spatial eigenvectors from residual PCA + frame_eigenvectors: generic/file + # type=file: matrix of frame eigenvectors from residual PCA + singular_values: generic/file + # type=file: matrix singular values from residual PCA + svd_stats_file: generic/file + # type=file: text file summarizing the residual PCA + k2p_file: generic/file + # type=file: estimate of k2p parameter + bp_file: generic/file + # type=file: Binding potential estimates + 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 + glm_dir: '"logan"' + # type=directory: output directory + # type=str|default='': save outputs to dir + requirements: + # dict[str, list[str]] - input fields that are required to be provided for the output field to be present +tests: +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + logan: + # type=tuple|default=(, , 0.0): RefTac TimeSec tstar : perform Logan kinetic modeling + glm_dir: + # type=directory: output directory + # type=str|default='': save outputs to dir + in_file: + # type=file|default=: input 4D file + fsgd: + # type=tuple|default=(, 'doss'): freesurfer descriptor file + design: + # type=file|default=: design matrix file + contrast: + # type=inputmultiobject|default=[]: contrast file + one_sample: + # type=bool|default=False: construct X and C as a one-sample group mean + no_contrast_ok: + # type=bool|default=False: do not fail if no contrasts specified + per_voxel_reg: + # type=inputmultiobject|default=[]: per-voxel regressors + self_reg: + # type=tuple|default=(0, 0, 0): self-regressor from index col row slice + weighted_ls: + # type=file|default=: weighted least squares + fixed_fx_var: + # type=file|default=: for fixed effects analysis + fixed_fx_dof: + # type=int|default=0: dof for fixed effects analysis + fixed_fx_dof_file: + # type=file|default=: text file with dof for fixed effects analysis + weight_file: + # type=file|default=: weight for each input at each voxel + weight_inv: + # type=bool|default=False: invert weights + weight_sqrt: + # type=bool|default=False: sqrt of weights + fwhm: + # type=range|default=0.0: smooth input by fwhm + var_fwhm: + # type=range|default=0.0: smooth variance by fwhm + no_mask_smooth: + # type=bool|default=False: do not mask when smoothing + no_est_fwhm: + # type=bool|default=False: turn off FWHM output estimation + mask_file: + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: + # type=file|default=: use label as mask, surfaces only + cortex: + # type=bool|default=False: use subjects ?h.cortex.label as label + invert_mask: + # type=bool|default=False: invert mask + prune: + # type=bool|default=False: remove voxels that do not have a non-zero value at each frame (def) + no_prune: + # type=bool|default=False: do not prune + prune_thresh: + # type=float|default=0.0: prune threshold. Default is FLT_MIN + compute_log_y: + # type=bool|default=False: compute natural log of y prior to analysis + save_estimate: + # type=bool|default=False: save signal estimate (yhat) + save_residual: + # type=bool|default=False: save residual error (eres) + save_res_corr_mtx: + # type=bool|default=False: save residual error spatial correlation matrix (eres.scm). Big! + surf: + # type=bool|default=False: analysis is on a surface mesh + subject_id: + # type=str|default='': subject id for surface geometry + hemi: + # type=enum|default='lh'|allowed['lh','rh']: surface hemisphere + surf_geo: + # type=str|default='white': surface geometry name (e.g. white, pial) + simulation: + # type=tuple|default=('perm', 0, 0.0, ''): nulltype nsim thresh csdbasename + sim_sign: + # type=enum|default='abs'|allowed['abs','neg','pos']: abs, pos, or neg + uniform: + # type=tuple|default=(0.0, 0.0): use uniform distribution instead of gaussian + pca: + # type=bool|default=False: perform pca/svd analysis on residual + calc_AR1: + # type=bool|default=False: compute and save temporal AR1 of residual + save_cond: + # type=bool|default=False: flag to save design matrix condition at each voxel + vox_dump: + # type=tuple|default=(0, 0, 0): dump voxel GLM and exit + seed: + # type=int|default=0: used for synthesizing noise + synth: + # type=bool|default=False: replace input with gaussian + resynth_test: + # type=int|default=0: test GLM by resynthsis + profile: + # type=int|default=0: niters : test speed + mrtm1: + # type=tuple|default=(, ): RefTac TimeSec : perform MRTM1 kinetic modeling + mrtm2: + # type=tuple|default=(, , 0.0): RefTac TimeSec k2prime : perform MRTM2 kinetic modeling + force_perm: + # type=bool|default=False: force perumtation test, even when design matrix is not orthog + diag: + # type=int|default=0: Gdiag_no : set diagnostic level + diag_cluster: + # type=bool|default=False: save sig volume and exit from first sim loop + debug: + # type=bool|default=False: turn on debugging + check_opts: + # type=bool|default=False: don't run anything, just check options and exit + allow_repeated_subjects: + # type=bool|default=False: allow subject names to repeat in the fsgd file (must appear before --fsgd + allow_ill_cond: + # type=bool|default=False: allow ill-conditioned design matrices + sim_done_file: + # type=file|default=: create file when simulation finished + nii: + # type=bool|default=False: save outputs as nii + nii_gz: + # type=bool|default=False: save outputs as nii.gz + subjects_dir: + # type=directory|default=: subjects directory + args: + # type=str|default='': Additional parameters to the command + environ: + # type=dict|default={}: Environment variables + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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 +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + in_file: + # type=file|default=: input 4D file + logan: ("ref_tac.dat", "timing.dat", 2600) + # type=tuple|default=(, , 0.0): RefTac TimeSec tstar : perform Logan kinetic modeling + glm_dir: '"logan"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: mri_glmfit --glmdir logan --y tac.nii --logan ref_tac.dat timing.dat 2600 + # 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: + # type=file|default=: input 4D file + logan: ("ref_tac.dat", "timing.dat", 2600) + # type=tuple|default=(, , 0.0): RefTac TimeSec tstar : perform Logan kinetic modeling + glm_dir: '"logan"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 diff --git a/nipype-auto-conv/specs/logan_ref_callables.py b/nipype-auto-conv/specs/logan_ref_callables.py new file mode 100644 index 00000000..92e5a6b4 --- /dev/null +++ b/nipype-auto-conv/specs/logan_ref_callables.py @@ -0,0 +1 @@ +"""Module to put any functions that are referred to in LoganRef.yaml""" diff --git a/nipype-auto-conv/specs/lta_convert.yaml b/nipype-auto-conv/specs/lta_convert.yaml new file mode 100644 index 00000000..3fde67a0 --- /dev/null +++ b/nipype-auto-conv/specs/lta_convert.yaml @@ -0,0 +1,138 @@ +# This file is used to manually specify the semi-automatic conversion of +# 'nipype.interfaces.freesurfer.utils.LTAConvert' from Nipype to Pydra. +# +# Please fill-in/edit the fields below where appropriate +# +# Docs +# ---- +# Convert different transformation formats. +# Some formats may require you to pass an image if the geometry information +# is missing form the transform file format. +# +# For complete details, see the `lta_convert documentation. +# `_ +# +task_name: LTAConvert +nipype_name: LTAConvert +nipype_module: nipype.interfaces.freesurfer.utils +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. + in_fsl: generic/file + # type=file|default=: input transform of FSL type + in_mni: generic/file + # type=file|default=: input transform of MNI/XFM type + in_reg: generic/file + # type=file|default=: input transform of TK REG type (deprecated format) + in_niftyreg: generic/file + # type=file|default=: input transform of Nifty Reg type (inverse RAS2RAS) + in_itk: generic/file + # type=file|default=: input transform of ITK type + source_file: generic/file + # type=file|default=: + target_file: generic/file + # type=file|default=: + 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. + out_lta: generic/file + # type=file: output linear transform (LTA Freesurfer format) + # type=traitcompound|default=None: output linear transform (LTA Freesurfer format) + out_fsl: generic/file + # type=file: output transform in FSL format + # type=traitcompound|default=None: output transform in FSL format + out_mni: generic/file + # type=file: output transform in MNI/XFM format + # type=traitcompound|default=None: output transform in MNI/XFM format + out_reg: generic/file + # type=file: output transform in reg dat format + # type=traitcompound|default=None: output transform in reg dat format + out_itk: generic/file + # type=file: output transform in ITK format + # type=traitcompound|default=None: output transform in ITK format + 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 +tests: +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + in_lta: + # type=traitcompound|default=None: input transform of LTA type + in_fsl: + # type=file|default=: input transform of FSL type + in_mni: + # type=file|default=: input transform of MNI/XFM type + in_reg: + # type=file|default=: input transform of TK REG type (deprecated format) + in_niftyreg: + # type=file|default=: input transform of Nifty Reg type (inverse RAS2RAS) + in_itk: + # type=file|default=: input transform of ITK type + out_lta: + # type=file: output linear transform (LTA Freesurfer format) + # type=traitcompound|default=None: output linear transform (LTA Freesurfer format) + out_fsl: + # type=file: output transform in FSL format + # type=traitcompound|default=None: output transform in FSL format + out_mni: + # type=file: output transform in MNI/XFM format + # type=traitcompound|default=None: output transform in MNI/XFM format + out_reg: + # type=file: output transform in reg dat format + # type=traitcompound|default=None: output transform in reg dat format + out_itk: + # type=file: output transform in ITK format + # type=traitcompound|default=None: output transform in ITK format + invert: + # type=bool|default=False: + ltavox2vox: + # type=bool|default=False: + source_file: + # type=file|default=: + target_file: + # type=file|default=: + target_conform: + # type=bool|default=False: + args: + # type=str|default='': Additional parameters to the command + environ: + # type=dict|default={}: Environment variables + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: [] diff --git a/nipype-auto-conv/specs/lta_convert_callables.py b/nipype-auto-conv/specs/lta_convert_callables.py new file mode 100644 index 00000000..efc3a184 --- /dev/null +++ b/nipype-auto-conv/specs/lta_convert_callables.py @@ -0,0 +1 @@ +"""Module to put any functions that are referred to in LTAConvert.yaml""" diff --git a/nipype-auto-conv/specs/make_average_subject.yaml b/nipype-auto-conv/specs/make_average_subject.yaml index 94515246..0223a79b 100644 --- a/nipype-auto-conv/specs/make_average_subject.yaml +++ b/nipype-auto-conv/specs/make_average_subject.yaml @@ -18,7 +18,7 @@ # task_name: MakeAverageSubject nipype_name: MakeAverageSubject -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/make_surfaces.yaml b/nipype-auto-conv/specs/make_surfaces.yaml index c7b998c9..2d01eba9 100644 --- a/nipype-auto-conv/specs/make_surfaces.yaml +++ b/nipype-auto-conv/specs/make_surfaces.yaml @@ -29,7 +29,7 @@ # task_name: MakeSurfaces nipype_name: MakeSurfaces -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mni_bias_correction.yaml b/nipype-auto-conv/specs/mni_bias_correction.yaml index 2b4a8416..cffb6bef 100644 --- a/nipype-auto-conv/specs/mni_bias_correction.yaml +++ b/nipype-auto-conv/specs/mni_bias_correction.yaml @@ -34,7 +34,7 @@ # task_name: MNIBiasCorrection nipype_name: MNIBiasCorrection -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mp_rto_mni305.yaml b/nipype-auto-conv/specs/mp_rto_mni305.yaml index 167e59a0..9c9c6a85 100644 --- a/nipype-auto-conv/specs/mp_rto_mni305.yaml +++ b/nipype-auto-conv/specs/mp_rto_mni305.yaml @@ -28,7 +28,7 @@ # task_name: MPRtoMNI305 nipype_name: MPRtoMNI305 -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_ca_label.yaml b/nipype-auto-conv/specs/mr_is_ca_label.yaml index a9c8e069..0af58d98 100644 --- a/nipype-auto-conv/specs/mr_is_ca_label.yaml +++ b/nipype-auto-conv/specs/mr_is_ca_label.yaml @@ -32,7 +32,7 @@ # task_name: MRIsCALabel nipype_name: MRIsCALabel -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_calc.yaml b/nipype-auto-conv/specs/mr_is_calc.yaml index 46e7289b..e59aa193 100644 --- a/nipype-auto-conv/specs/mr_is_calc.yaml +++ b/nipype-auto-conv/specs/mr_is_calc.yaml @@ -30,7 +30,7 @@ # task_name: MRIsCalc nipype_name: MRIsCalc -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_combine.yaml b/nipype-auto-conv/specs/mr_is_combine.yaml index bf091abe..6a1299c7 100644 --- a/nipype-auto-conv/specs/mr_is_combine.yaml +++ b/nipype-auto-conv/specs/mr_is_combine.yaml @@ -31,7 +31,7 @@ # task_name: MRIsCombine nipype_name: MRIsCombine -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_convert.yaml b/nipype-auto-conv/specs/mr_is_convert.yaml index 70184f19..033ffdd2 100644 --- a/nipype-auto-conv/specs/mr_is_convert.yaml +++ b/nipype-auto-conv/specs/mr_is_convert.yaml @@ -19,7 +19,7 @@ # task_name: MRIsConvert nipype_name: MRIsConvert -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_expand.yaml b/nipype-auto-conv/specs/mr_is_expand.yaml index 364b9850..46905e3d 100644 --- a/nipype-auto-conv/specs/mr_is_expand.yaml +++ b/nipype-auto-conv/specs/mr_is_expand.yaml @@ -22,7 +22,7 @@ # task_name: MRIsExpand nipype_name: MRIsExpand -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mr_is_inflate.yaml b/nipype-auto-conv/specs/mr_is_inflate.yaml index 1a8e684b..a8c3f245 100644 --- a/nipype-auto-conv/specs/mr_is_inflate.yaml +++ b/nipype-auto-conv/specs/mr_is_inflate.yaml @@ -19,7 +19,7 @@ # task_name: MRIsInflate nipype_name: MRIsInflate -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_convert.yaml b/nipype-auto-conv/specs/mri_convert.yaml index bb209ea1..d88651bb 100644 --- a/nipype-auto-conv/specs/mri_convert.yaml +++ b/nipype-auto-conv/specs/mri_convert.yaml @@ -23,7 +23,7 @@ # task_name: MRIConvert nipype_name: MRIConvert -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_coreg.yaml b/nipype-auto-conv/specs/mri_coreg.yaml index 20b9d7b9..0ded1e86 100644 --- a/nipype-auto-conv/specs/mri_coreg.yaml +++ b/nipype-auto-conv/specs/mri_coreg.yaml @@ -41,7 +41,7 @@ # task_name: MRICoreg nipype_name: MRICoreg -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_fill.yaml b/nipype-auto-conv/specs/mri_fill.yaml index cbb0b2ba..4832845d 100644 --- a/nipype-auto-conv/specs/mri_fill.yaml +++ b/nipype-auto-conv/specs/mri_fill.yaml @@ -20,7 +20,7 @@ # task_name: MRIFill nipype_name: MRIFill -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_marching_cubes.yaml b/nipype-auto-conv/specs/mri_marching_cubes.yaml index ec33151a..892f5ef8 100644 --- a/nipype-auto-conv/specs/mri_marching_cubes.yaml +++ b/nipype-auto-conv/specs/mri_marching_cubes.yaml @@ -20,7 +20,7 @@ # task_name: MRIMarchingCubes nipype_name: MRIMarchingCubes -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_pretess.yaml b/nipype-auto-conv/specs/mri_pretess.yaml index 452754ca..f1cad21d 100644 --- a/nipype-auto-conv/specs/mri_pretess.yaml +++ b/nipype-auto-conv/specs/mri_pretess.yaml @@ -26,7 +26,7 @@ # task_name: MRIPretess nipype_name: MRIPretess -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mri_tessellate.yaml b/nipype-auto-conv/specs/mri_tessellate.yaml index 9fccf076..89aa0b07 100644 --- a/nipype-auto-conv/specs/mri_tessellate.yaml +++ b/nipype-auto-conv/specs/mri_tessellate.yaml @@ -20,7 +20,7 @@ # task_name: MRITessellate nipype_name: MRITessellate -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mris_preproc.yaml b/nipype-auto-conv/specs/mris_preproc.yaml index 19d18e09..4a3f8743 100644 --- a/nipype-auto-conv/specs/mris_preproc.yaml +++ b/nipype-auto-conv/specs/mris_preproc.yaml @@ -21,7 +21,7 @@ # task_name: MRISPreproc nipype_name: MRISPreproc -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mris_preproc_recon_all.yaml b/nipype-auto-conv/specs/mris_preproc_recon_all.yaml index 94f84934..36370217 100644 --- a/nipype-auto-conv/specs/mris_preproc_recon_all.yaml +++ b/nipype-auto-conv/specs/mris_preproc_recon_all.yaml @@ -20,7 +20,7 @@ # task_name: MRISPreprocReconAll nipype_name: MRISPreprocReconAll -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/mrtm.yaml b/nipype-auto-conv/specs/mrtm.yaml new file mode 100644 index 00000000..49e69bca --- /dev/null +++ b/nipype-auto-conv/specs/mrtm.yaml @@ -0,0 +1,296 @@ +# This file is used to manually specify the semi-automatic conversion of +# 'nipype.interfaces.freesurfer.petsurfer.MRTM' from Nipype to Pydra. +# +# Please fill-in/edit the fields below where appropriate +# +# Docs +# ---- +# Perform MRTM1 kinetic modeling. +# +# Examples +# -------- +# >>> mrtm = MRTM() +# >>> mrtm.inputs.in_file = 'tac.nii' +# >>> mrtm.inputs.mrtm1 = ('ref_tac.dat', 'timing.dat') +# >>> mrtm.inputs.glm_dir = 'mrtm' +# >>> mrtm.cmdline +# 'mri_glmfit --glmdir mrtm --y tac.nii --mrtm1 ref_tac.dat timing.dat' +# +task_name: MRTM +nipype_name: MRTM +nipype_module: nipype.interfaces.freesurfer.petsurfer +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. + in_file: medimage/nifti1 + # type=file|default=: input 4D file + design: generic/file + # type=file|default=: design matrix file + contrast: generic/file+list-of + # type=inputmultiobject|default=[]: contrast file + per_voxel_reg: generic/file+list-of + # type=inputmultiobject|default=[]: per-voxel regressors + weighted_ls: generic/file + # type=file|default=: weighted least squares + fixed_fx_var: generic/file + # type=file|default=: for fixed effects analysis + fixed_fx_dof_file: generic/file + # type=file|default=: text file with dof for fixed effects analysis + weight_file: generic/file + # type=file|default=: weight for each input at each voxel + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: generic/file + # type=file|default=: use label as mask, surfaces only + sim_done_file: generic/file + # type=file|default=: create file when simulation finished + 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. + beta_file: generic/file + # type=file: map of regression coefficients + error_file: generic/file + # type=file: map of residual error + error_var_file: generic/file + # type=file: map of residual error variance + error_stddev_file: generic/file + # type=file: map of residual error standard deviation + estimate_file: generic/file + # type=file: map of the estimated Y values + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + fwhm_file: generic/file + # type=file: text file with estimated smoothness + dof_file: generic/file + # type=file: text file with effective degrees-of-freedom for the analysis + spatial_eigenvectors: generic/file + # type=file: map of spatial eigenvectors from residual PCA + frame_eigenvectors: generic/file + # type=file: matrix of frame eigenvectors from residual PCA + singular_values: generic/file + # type=file: matrix singular values from residual PCA + svd_stats_file: generic/file + # type=file: text file summarizing the residual PCA + k2p_file: generic/file + # type=file: estimate of k2p parameter + bp_file: generic/file + # type=file: Binding potential estimates + 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 + glm_dir: '"mrtm"' + # type=directory: output directory + # type=str|default='': save outputs to dir + requirements: + # dict[str, list[str]] - input fields that are required to be provided for the output field to be present +tests: +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + mrtm1: + # type=tuple|default=(, ): RefTac TimeSec : perform MRTM1 kinetic modeling + glm_dir: + # type=directory: output directory + # type=str|default='': save outputs to dir + in_file: + # type=file|default=: input 4D file + fsgd: + # type=tuple|default=(, 'doss'): freesurfer descriptor file + design: + # type=file|default=: design matrix file + contrast: + # type=inputmultiobject|default=[]: contrast file + one_sample: + # type=bool|default=False: construct X and C as a one-sample group mean + no_contrast_ok: + # type=bool|default=False: do not fail if no contrasts specified + per_voxel_reg: + # type=inputmultiobject|default=[]: per-voxel regressors + self_reg: + # type=tuple|default=(0, 0, 0): self-regressor from index col row slice + weighted_ls: + # type=file|default=: weighted least squares + fixed_fx_var: + # type=file|default=: for fixed effects analysis + fixed_fx_dof: + # type=int|default=0: dof for fixed effects analysis + fixed_fx_dof_file: + # type=file|default=: text file with dof for fixed effects analysis + weight_file: + # type=file|default=: weight for each input at each voxel + weight_inv: + # type=bool|default=False: invert weights + weight_sqrt: + # type=bool|default=False: sqrt of weights + fwhm: + # type=range|default=0.0: smooth input by fwhm + var_fwhm: + # type=range|default=0.0: smooth variance by fwhm + no_mask_smooth: + # type=bool|default=False: do not mask when smoothing + no_est_fwhm: + # type=bool|default=False: turn off FWHM output estimation + mask_file: + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: + # type=file|default=: use label as mask, surfaces only + cortex: + # type=bool|default=False: use subjects ?h.cortex.label as label + invert_mask: + # type=bool|default=False: invert mask + prune: + # type=bool|default=False: remove voxels that do not have a non-zero value at each frame (def) + no_prune: + # type=bool|default=False: do not prune + prune_thresh: + # type=float|default=0.0: prune threshold. Default is FLT_MIN + compute_log_y: + # type=bool|default=False: compute natural log of y prior to analysis + save_estimate: + # type=bool|default=False: save signal estimate (yhat) + save_residual: + # type=bool|default=False: save residual error (eres) + save_res_corr_mtx: + # type=bool|default=False: save residual error spatial correlation matrix (eres.scm). Big! + surf: + # type=bool|default=False: analysis is on a surface mesh + subject_id: + # type=str|default='': subject id for surface geometry + hemi: + # type=enum|default='lh'|allowed['lh','rh']: surface hemisphere + surf_geo: + # type=str|default='white': surface geometry name (e.g. white, pial) + simulation: + # type=tuple|default=('perm', 0, 0.0, ''): nulltype nsim thresh csdbasename + sim_sign: + # type=enum|default='abs'|allowed['abs','neg','pos']: abs, pos, or neg + uniform: + # type=tuple|default=(0.0, 0.0): use uniform distribution instead of gaussian + pca: + # type=bool|default=False: perform pca/svd analysis on residual + calc_AR1: + # type=bool|default=False: compute and save temporal AR1 of residual + save_cond: + # type=bool|default=False: flag to save design matrix condition at each voxel + vox_dump: + # type=tuple|default=(0, 0, 0): dump voxel GLM and exit + seed: + # type=int|default=0: used for synthesizing noise + synth: + # type=bool|default=False: replace input with gaussian + resynth_test: + # type=int|default=0: test GLM by resynthsis + profile: + # type=int|default=0: niters : test speed + mrtm2: + # type=tuple|default=(, , 0.0): RefTac TimeSec k2prime : perform MRTM2 kinetic modeling + logan: + # type=tuple|default=(, , 0.0): RefTac TimeSec tstar : perform Logan kinetic modeling + force_perm: + # type=bool|default=False: force perumtation test, even when design matrix is not orthog + diag: + # type=int|default=0: Gdiag_no : set diagnostic level + diag_cluster: + # type=bool|default=False: save sig volume and exit from first sim loop + debug: + # type=bool|default=False: turn on debugging + check_opts: + # type=bool|default=False: don't run anything, just check options and exit + allow_repeated_subjects: + # type=bool|default=False: allow subject names to repeat in the fsgd file (must appear before --fsgd + allow_ill_cond: + # type=bool|default=False: allow ill-conditioned design matrices + sim_done_file: + # type=file|default=: create file when simulation finished + nii: + # type=bool|default=False: save outputs as nii + nii_gz: + # type=bool|default=False: save outputs as nii.gz + subjects_dir: + # type=directory|default=: subjects directory + args: + # type=str|default='': Additional parameters to the command + environ: + # type=dict|default={}: Environment variables + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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 +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + in_file: + # type=file|default=: input 4D file + mrtm1: ("ref_tac.dat", "timing.dat") + # type=tuple|default=(, ): RefTac TimeSec : perform MRTM1 kinetic modeling + glm_dir: '"mrtm"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: mri_glmfit --glmdir mrtm --y tac.nii --mrtm1 ref_tac.dat timing.dat + # 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: + # type=file|default=: input 4D file + mrtm1: ("ref_tac.dat", "timing.dat") + # type=tuple|default=(, ): RefTac TimeSec : perform MRTM1 kinetic modeling + glm_dir: '"mrtm"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 diff --git a/nipype-auto-conv/specs/mrtm2.yaml b/nipype-auto-conv/specs/mrtm2.yaml new file mode 100644 index 00000000..214801d0 --- /dev/null +++ b/nipype-auto-conv/specs/mrtm2.yaml @@ -0,0 +1,295 @@ +# This file is used to manually specify the semi-automatic conversion of +# 'nipype.interfaces.freesurfer.petsurfer.MRTM2' from Nipype to Pydra. +# +# Please fill-in/edit the fields below where appropriate +# +# Docs +# ---- +# Perform MRTM2 kinetic modeling. +# Examples +# -------- +# >>> mrtm2 = MRTM2() +# >>> mrtm2.inputs.in_file = 'tac.nii' +# >>> mrtm2.inputs.mrtm2 = ('ref_tac.dat', 'timing.dat', 0.07872) +# >>> mrtm2.inputs.glm_dir = 'mrtm2' +# >>> mrtm2.cmdline +# 'mri_glmfit --glmdir mrtm2 --y tac.nii --mrtm2 ref_tac.dat timing.dat 0.078720' +# +task_name: MRTM2 +nipype_name: MRTM2 +nipype_module: nipype.interfaces.freesurfer.petsurfer +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. + in_file: medimage/nifti1 + # type=file|default=: input 4D file + design: generic/file + # type=file|default=: design matrix file + contrast: generic/file+list-of + # type=inputmultiobject|default=[]: contrast file + per_voxel_reg: generic/file+list-of + # type=inputmultiobject|default=[]: per-voxel regressors + weighted_ls: generic/file + # type=file|default=: weighted least squares + fixed_fx_var: generic/file + # type=file|default=: for fixed effects analysis + fixed_fx_dof_file: generic/file + # type=file|default=: text file with dof for fixed effects analysis + weight_file: generic/file + # type=file|default=: weight for each input at each voxel + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: generic/file + # type=file|default=: use label as mask, surfaces only + sim_done_file: generic/file + # type=file|default=: create file when simulation finished + 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. + beta_file: generic/file + # type=file: map of regression coefficients + error_file: generic/file + # type=file: map of residual error + error_var_file: generic/file + # type=file: map of residual error variance + error_stddev_file: generic/file + # type=file: map of residual error standard deviation + estimate_file: generic/file + # type=file: map of the estimated Y values + mask_file: generic/file + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + fwhm_file: generic/file + # type=file: text file with estimated smoothness + dof_file: generic/file + # type=file: text file with effective degrees-of-freedom for the analysis + spatial_eigenvectors: generic/file + # type=file: map of spatial eigenvectors from residual PCA + frame_eigenvectors: generic/file + # type=file: matrix of frame eigenvectors from residual PCA + singular_values: generic/file + # type=file: matrix singular values from residual PCA + svd_stats_file: generic/file + # type=file: text file summarizing the residual PCA + k2p_file: generic/file + # type=file: estimate of k2p parameter + bp_file: generic/file + # type=file: Binding potential estimates + 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 + glm_dir: '"mrtm2"' + # type=directory: output directory + # type=str|default='': save outputs to dir + requirements: + # dict[str, list[str]] - input fields that are required to be provided for the output field to be present +tests: +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + mrtm2: + # type=tuple|default=(, , 0.0): RefTac TimeSec k2prime : perform MRTM2 kinetic modeling + glm_dir: + # type=directory: output directory + # type=str|default='': save outputs to dir + in_file: + # type=file|default=: input 4D file + fsgd: + # type=tuple|default=(, 'doss'): freesurfer descriptor file + design: + # type=file|default=: design matrix file + contrast: + # type=inputmultiobject|default=[]: contrast file + one_sample: + # type=bool|default=False: construct X and C as a one-sample group mean + no_contrast_ok: + # type=bool|default=False: do not fail if no contrasts specified + per_voxel_reg: + # type=inputmultiobject|default=[]: per-voxel regressors + self_reg: + # type=tuple|default=(0, 0, 0): self-regressor from index col row slice + weighted_ls: + # type=file|default=: weighted least squares + fixed_fx_var: + # type=file|default=: for fixed effects analysis + fixed_fx_dof: + # type=int|default=0: dof for fixed effects analysis + fixed_fx_dof_file: + # type=file|default=: text file with dof for fixed effects analysis + weight_file: + # type=file|default=: weight for each input at each voxel + weight_inv: + # type=bool|default=False: invert weights + weight_sqrt: + # type=bool|default=False: sqrt of weights + fwhm: + # type=range|default=0.0: smooth input by fwhm + var_fwhm: + # type=range|default=0.0: smooth variance by fwhm + no_mask_smooth: + # type=bool|default=False: do not mask when smoothing + no_est_fwhm: + # type=bool|default=False: turn off FWHM output estimation + mask_file: + # type=file: map of the mask used in the analysis + # type=file|default=: binary mask + label_file: + # type=file|default=: use label as mask, surfaces only + cortex: + # type=bool|default=False: use subjects ?h.cortex.label as label + invert_mask: + # type=bool|default=False: invert mask + prune: + # type=bool|default=False: remove voxels that do not have a non-zero value at each frame (def) + no_prune: + # type=bool|default=False: do not prune + prune_thresh: + # type=float|default=0.0: prune threshold. Default is FLT_MIN + compute_log_y: + # type=bool|default=False: compute natural log of y prior to analysis + save_estimate: + # type=bool|default=False: save signal estimate (yhat) + save_residual: + # type=bool|default=False: save residual error (eres) + save_res_corr_mtx: + # type=bool|default=False: save residual error spatial correlation matrix (eres.scm). Big! + surf: + # type=bool|default=False: analysis is on a surface mesh + subject_id: + # type=str|default='': subject id for surface geometry + hemi: + # type=enum|default='lh'|allowed['lh','rh']: surface hemisphere + surf_geo: + # type=str|default='white': surface geometry name (e.g. white, pial) + simulation: + # type=tuple|default=('perm', 0, 0.0, ''): nulltype nsim thresh csdbasename + sim_sign: + # type=enum|default='abs'|allowed['abs','neg','pos']: abs, pos, or neg + uniform: + # type=tuple|default=(0.0, 0.0): use uniform distribution instead of gaussian + pca: + # type=bool|default=False: perform pca/svd analysis on residual + calc_AR1: + # type=bool|default=False: compute and save temporal AR1 of residual + save_cond: + # type=bool|default=False: flag to save design matrix condition at each voxel + vox_dump: + # type=tuple|default=(0, 0, 0): dump voxel GLM and exit + seed: + # type=int|default=0: used for synthesizing noise + synth: + # type=bool|default=False: replace input with gaussian + resynth_test: + # type=int|default=0: test GLM by resynthsis + profile: + # type=int|default=0: niters : test speed + mrtm1: + # type=tuple|default=(, ): RefTac TimeSec : perform MRTM1 kinetic modeling + logan: + # type=tuple|default=(, , 0.0): RefTac TimeSec tstar : perform Logan kinetic modeling + force_perm: + # type=bool|default=False: force perumtation test, even when design matrix is not orthog + diag: + # type=int|default=0: Gdiag_no : set diagnostic level + diag_cluster: + # type=bool|default=False: save sig volume and exit from first sim loop + debug: + # type=bool|default=False: turn on debugging + check_opts: + # type=bool|default=False: don't run anything, just check options and exit + allow_repeated_subjects: + # type=bool|default=False: allow subject names to repeat in the fsgd file (must appear before --fsgd + allow_ill_cond: + # type=bool|default=False: allow ill-conditioned design matrices + sim_done_file: + # type=file|default=: create file when simulation finished + nii: + # type=bool|default=False: save outputs as nii + nii_gz: + # type=bool|default=False: save outputs as nii.gz + subjects_dir: + # type=directory|default=: subjects directory + args: + # type=str|default='': Additional parameters to the command + environ: + # type=dict|default={}: Environment variables + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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 +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + in_file: + # type=file|default=: input 4D file + mrtm2: ("ref_tac.dat", "timing.dat", 0.07872) + # type=tuple|default=(, , 0.0): RefTac TimeSec k2prime : perform MRTM2 kinetic modeling + glm_dir: '"mrtm2"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: mri_glmfit --glmdir mrtm2 --y tac.nii --mrtm2 ref_tac.dat timing.dat 0.078720 + # 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: + # type=file|default=: input 4D file + mrtm2: ("ref_tac.dat", "timing.dat", 0.07872) + # type=tuple|default=(, , 0.0): RefTac TimeSec k2prime : perform MRTM2 kinetic modeling + glm_dir: '"mrtm2"' + # type=directory: output directory + # type=str|default='': save outputs to dir + imports: + # list[nipype2pydra.task.importstatement] - 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 diff --git a/nipype-auto-conv/specs/mrtm2_callables.py b/nipype-auto-conv/specs/mrtm2_callables.py new file mode 100644 index 00000000..20fb1266 --- /dev/null +++ b/nipype-auto-conv/specs/mrtm2_callables.py @@ -0,0 +1 @@ +"""Module to put any functions that are referred to in MRTM2.yaml""" diff --git a/nipype-auto-conv/specs/mrtm_callables.py b/nipype-auto-conv/specs/mrtm_callables.py new file mode 100644 index 00000000..13bca71e --- /dev/null +++ b/nipype-auto-conv/specs/mrtm_callables.py @@ -0,0 +1 @@ +"""Module to put any functions that are referred to in MRTM.yaml""" diff --git a/nipype-auto-conv/specs/ms__lda.yaml b/nipype-auto-conv/specs/ms__lda.yaml index 3c8f28b1..62f17e04 100644 --- a/nipype-auto-conv/specs/ms__lda.yaml +++ b/nipype-auto-conv/specs/ms__lda.yaml @@ -19,7 +19,7 @@ # task_name: MS_LDA nipype_name: MS_LDA -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/normalize.yaml b/nipype-auto-conv/specs/normalize.yaml index 686b041c..1b01383f 100644 --- a/nipype-auto-conv/specs/normalize.yaml +++ b/nipype-auto-conv/specs/normalize.yaml @@ -21,7 +21,7 @@ # task_name: Normalize nipype_name: Normalize -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/one_sample_t_test.yaml b/nipype-auto-conv/specs/one_sample_t_test.yaml index 5296c9e4..2abfe3ad 100644 --- a/nipype-auto-conv/specs/one_sample_t_test.yaml +++ b/nipype-auto-conv/specs/one_sample_t_test.yaml @@ -8,7 +8,7 @@ # task_name: OneSampleTTest nipype_name: OneSampleTTest -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/paint.yaml b/nipype-auto-conv/specs/paint.yaml index db62cc08..1e7d4bb9 100644 --- a/nipype-auto-conv/specs/paint.yaml +++ b/nipype-auto-conv/specs/paint.yaml @@ -25,7 +25,7 @@ # task_name: Paint nipype_name: Paint -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/parcellation_stats.yaml b/nipype-auto-conv/specs/parcellation_stats.yaml index 996c5213..f5860d3a 100644 --- a/nipype-auto-conv/specs/parcellation_stats.yaml +++ b/nipype-auto-conv/specs/parcellation_stats.yaml @@ -33,7 +33,7 @@ # task_name: ParcellationStats nipype_name: ParcellationStats -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/parse_dicom_dir.yaml b/nipype-auto-conv/specs/parse_dicom_dir.yaml index 9d6bc9cb..0033e181 100644 --- a/nipype-auto-conv/specs/parse_dicom_dir.yaml +++ b/nipype-auto-conv/specs/parse_dicom_dir.yaml @@ -21,7 +21,7 @@ # task_name: ParseDICOMDir nipype_name: ParseDICOMDir -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/recon_all.yaml b/nipype-auto-conv/specs/recon_all.yaml index 7049ad83..7d0f6aeb 100644 --- a/nipype-auto-conv/specs/recon_all.yaml +++ b/nipype-auto-conv/specs/recon_all.yaml @@ -16,7 +16,7 @@ # >>> reconall.inputs.subject_id = 'foo' # >>> reconall.inputs.directive = 'all' # >>> reconall.inputs.subjects_dir = '.' -# >>> reconall.inputs.T1_files = 'structural.nii' +# >>> reconall.inputs.T1_files = ['structural.nii'] # >>> reconall.cmdline # 'recon-all -all -i structural.nii -subjid foo -sd .' # >>> reconall.inputs.flags = "-qcache" @@ -46,7 +46,7 @@ # >>> reconall_subfields.inputs.subject_id = 'foo' # >>> reconall_subfields.inputs.directive = 'all' # >>> reconall_subfields.inputs.subjects_dir = '.' -# >>> reconall_subfields.inputs.T1_files = 'structural.nii' +# >>> reconall_subfields.inputs.T1_files = ['structural.nii'] # >>> reconall_subfields.inputs.hippocampal_subfields_T1 = True # >>> reconall_subfields.cmdline # 'recon-all -all -i structural.nii -hippocampal-subfields-T1 -subjid foo -sd .' @@ -57,10 +57,28 @@ # >>> reconall_subfields.inputs.hippocampal_subfields_T1 = False # >>> reconall_subfields.cmdline # 'recon-all -all -i structural.nii -hippocampal-subfields-T2 structural.nii test -subjid foo -sd .' +# +# Base template creation for longitudinal pipeline: +# >>> baserecon = ReconAll() +# >>> baserecon.inputs.base_template_id = 'sub-template' +# >>> baserecon.inputs.base_timepoint_ids = ['ses-1','ses-2'] +# >>> baserecon.inputs.directive = 'all' +# >>> baserecon.inputs.subjects_dir = '.' +# >>> baserecon.cmdline +# 'recon-all -all -base sub-template -base-tp ses-1 -base-tp ses-2 -sd .' +# +# Longitudinal timepoint run: +# >>> longrecon = ReconAll() +# >>> longrecon.inputs.longitudinal_timepoint_id = 'ses-1' +# >>> longrecon.inputs.longitudinal_template_id = 'sub-template' +# >>> longrecon.inputs.directive = 'all' +# >>> longrecon.inputs.subjects_dir = '.' +# >>> longrecon.cmdline +# 'recon-all -all -long ses-1 sub-template -sd .' # task_name: ReconAll nipype_name: ReconAll -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface @@ -82,6 +100,8 @@ inputs: # type=file|default=: Set parameters using expert file flags: generic/file+list-of # type=inputmultiobject|default=[]: additional parameters + base_timepoint_ids: generic/file+list-of + # type=inputmultiobject|default=[]: processed timepoint to use in template metadata: # dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1) outputs: @@ -173,6 +193,14 @@ tests: # type=directory|default=: path to subjects directory flags: # type=inputmultiobject|default=[]: additional parameters + base_template_id: + # type=str|default='': base template id + base_timepoint_ids: + # type=inputmultiobject|default=[]: processed timepoint to use in template + longitudinal_timepoint_id: + # type=str|default='': longitudinal session/timepoint id + longitudinal_template_id: + # type=str|default='': longitudinal base template id talairach: # type=str|default='': Flags to pass to talairach commands mri_normalize: @@ -348,6 +376,60 @@ tests: xfail: true # 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 +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + base_template_id: '"sub-template"' + # type=str|default='': base template id + base_timepoint_ids: + # type=inputmultiobject|default=[]: processed timepoint to use in template + directive: '"all"' + # type=enum|default='all'|allowed['all','autorecon-hemi','autorecon-pial','autorecon1','autorecon2','autorecon2-cp','autorecon2-inflate1','autorecon2-perhemi','autorecon2-volonly','autorecon2-wm','autorecon3','autorecon3-T2pial','localGI','qcache']: process directive + subjects_dir: '"."' + # type=directory: Freesurfer subjects directory. + # type=directory|default=: path to subjects directory + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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 +- inputs: + # dict[str, str] - values to provide to inputs fields in the task initialisation + # (if not specified, will try to choose a sensible value) + longitudinal_timepoint_id: '"ses-1"' + # type=str|default='': longitudinal session/timepoint id + longitudinal_template_id: '"sub-template"' + # type=str|default='': longitudinal base template id + directive: '"all"' + # type=enum|default='all'|allowed['all','autorecon-hemi','autorecon-pial','autorecon1','autorecon2','autorecon2-cp','autorecon2-inflate1','autorecon2-perhemi','autorecon2-volonly','autorecon2-wm','autorecon3','autorecon3-T2pial','localGI','qcache']: process directive + subjects_dir: '"."' + # type=directory: Freesurfer subjects directory. + # type=directory|default=: path to subjects directory + imports: + # list[nipype2pydra.task.importstatement] - 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 + # be terminated before they complete for time-saving reasons, and therefore + # these values will be ignored, when running in CI + timeout: 10 + # int - the value to set for the timeout in the generated test, + # after which the test will be considered to have been initialised + # successfully. Set to 0 to disable the timeout (warning, this could + # lead to the unittests taking a very long time to complete) + xfail: true + # 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: recon-all -all -i structural.nii -cw256 -qcache -subjid foo -sd . # str - the expected cmdline output @@ -425,3 +507,43 @@ doctests: # consisting of 'module', 'name', and optionally 'alias' keys directive: # str - any doctest directive to place on the cmdline call, e.g. # doctest: +ELLIPSIS +- cmdline: recon-all -all -base sub-template -base-tp ses-1 -base-tp ses-2 -sd . + # 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. + base_template_id: '"sub-template"' + # type=str|default='': base template id + base_timepoint_ids: + # type=inputmultiobject|default=[]: processed timepoint to use in template + directive: '"all"' + # type=enum|default='all'|allowed['all','autorecon-hemi','autorecon-pial','autorecon1','autorecon2','autorecon2-cp','autorecon2-inflate1','autorecon2-perhemi','autorecon2-volonly','autorecon2-wm','autorecon3','autorecon3-T2pial','localGI','qcache']: process directive + subjects_dir: '"."' + # type=directory: Freesurfer subjects directory. + # type=directory|default=: path to subjects directory + imports: + # list[nipype2pydra.task.importstatement] - 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 +- cmdline: recon-all -all -long ses-1 sub-template -sd . + # 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. + longitudinal_timepoint_id: '"ses-1"' + # type=str|default='': longitudinal session/timepoint id + longitudinal_template_id: '"sub-template"' + # type=str|default='': longitudinal base template id + directive: '"all"' + # type=enum|default='all'|allowed['all','autorecon-hemi','autorecon-pial','autorecon1','autorecon2','autorecon2-cp','autorecon2-inflate1','autorecon2-perhemi','autorecon2-volonly','autorecon2-wm','autorecon3','autorecon3-T2pial','localGI','qcache']: process directive + subjects_dir: '"."' + # type=directory: Freesurfer subjects directory. + # type=directory|default=: path to subjects directory + imports: + # list[nipype2pydra.task.importstatement] - 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 diff --git a/nipype-auto-conv/specs/register.yaml b/nipype-auto-conv/specs/register.yaml index 08cc680e..6e6350e9 100644 --- a/nipype-auto-conv/specs/register.yaml +++ b/nipype-auto-conv/specs/register.yaml @@ -22,7 +22,7 @@ # task_name: Register nipype_name: Register -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/register_av_ito_talairach.yaml b/nipype-auto-conv/specs/register_av_ito_talairach.yaml index 30d3e817..9c873951 100644 --- a/nipype-auto-conv/specs/register_av_ito_talairach.yaml +++ b/nipype-auto-conv/specs/register_av_ito_talairach.yaml @@ -32,7 +32,7 @@ # task_name: RegisterAVItoTalairach nipype_name: RegisterAVItoTalairach -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.registration inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/relabel_hypointensities.yaml b/nipype-auto-conv/specs/relabel_hypointensities.yaml index a026b9ce..e32fc5b0 100644 --- a/nipype-auto-conv/specs/relabel_hypointensities.yaml +++ b/nipype-auto-conv/specs/relabel_hypointensities.yaml @@ -21,7 +21,7 @@ # task_name: RelabelHypointensities nipype_name: RelabelHypointensities -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/remove_intersection.yaml b/nipype-auto-conv/specs/remove_intersection.yaml index 3d825be8..42c1ce3a 100644 --- a/nipype-auto-conv/specs/remove_intersection.yaml +++ b/nipype-auto-conv/specs/remove_intersection.yaml @@ -18,7 +18,7 @@ # task_name: RemoveIntersection nipype_name: RemoveIntersection -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/remove_neck.yaml b/nipype-auto-conv/specs/remove_neck.yaml index c3e89bb2..e4992be9 100644 --- a/nipype-auto-conv/specs/remove_neck.yaml +++ b/nipype-auto-conv/specs/remove_neck.yaml @@ -21,7 +21,7 @@ # task_name: RemoveNeck nipype_name: RemoveNeck -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/resample.yaml b/nipype-auto-conv/specs/resample.yaml index 083d8f5f..7eeca2ee 100644 --- a/nipype-auto-conv/specs/resample.yaml +++ b/nipype-auto-conv/specs/resample.yaml @@ -21,7 +21,7 @@ # task_name: Resample nipype_name: Resample -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/robust_register.yaml b/nipype-auto-conv/specs/robust_register.yaml index cea912df..b9ea91f4 100644 --- a/nipype-auto-conv/specs/robust_register.yaml +++ b/nipype-auto-conv/specs/robust_register.yaml @@ -27,7 +27,7 @@ # task_name: RobustRegister nipype_name: RobustRegister -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/robust_template.yaml b/nipype-auto-conv/specs/robust_template.yaml index 9ebe5dcd..866056b1 100644 --- a/nipype-auto-conv/specs/robust_template.yaml +++ b/nipype-auto-conv/specs/robust_template.yaml @@ -45,7 +45,7 @@ # task_name: RobustTemplate nipype_name: RobustTemplate -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.longitudinal inputs: omit: # list[str] - fields to omit from the Pydra interface @@ -115,7 +115,7 @@ tests: average_metric: # type=enum|default='median'|allowed['mean','median']: construct template from: 0 Mean, 1 Median (default) initial_timepoint: - # type=int|default=0: use TP# for spacial init (default random), 0: no init + # type=int|default=0: use TP# for special init (default random), 0: no init fixed_timepoint: # type=bool|default=False: map everything to init TP# (init TP is not resampled) no_iteration: @@ -157,7 +157,7 @@ tests: average_metric: '"mean"' # type=enum|default='median'|allowed['mean','median']: construct template from: 0 Mean, 1 Median (default) initial_timepoint: '1' - # type=int|default=0: use TP# for spacial init (default random), 0: no init + # type=int|default=0: use TP# for special init (default random), 0: no init fixed_timepoint: 'True' # type=bool|default=False: map everything to init TP# (init TP is not resampled) no_iteration: 'True' @@ -244,7 +244,7 @@ doctests: average_metric: '"mean"' # type=enum|default='median'|allowed['mean','median']: construct template from: 0 Mean, 1 Median (default) initial_timepoint: '1' - # type=int|default=0: use TP# for spacial init (default random), 0: no init + # type=int|default=0: use TP# for special init (default random), 0: no init fixed_timepoint: 'True' # type=bool|default=False: map everything to init TP# (init TP is not resampled) no_iteration: 'True' diff --git a/nipype-auto-conv/specs/sample_to_surface.yaml b/nipype-auto-conv/specs/sample_to_surface.yaml index 352ff07e..374a08e4 100644 --- a/nipype-auto-conv/specs/sample_to_surface.yaml +++ b/nipype-auto-conv/specs/sample_to_surface.yaml @@ -36,7 +36,7 @@ # task_name: SampleToSurface nipype_name: SampleToSurface -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/seg_stats.yaml b/nipype-auto-conv/specs/seg_stats.yaml index 352f8cd0..ee2b310e 100644 --- a/nipype-auto-conv/specs/seg_stats.yaml +++ b/nipype-auto-conv/specs/seg_stats.yaml @@ -22,7 +22,7 @@ # task_name: SegStats nipype_name: SegStats -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/seg_stats_recon_all.yaml b/nipype-auto-conv/specs/seg_stats_recon_all.yaml index 9c7725bf..2f021047 100644 --- a/nipype-auto-conv/specs/seg_stats_recon_all.yaml +++ b/nipype-auto-conv/specs/seg_stats_recon_all.yaml @@ -44,7 +44,7 @@ # task_name: SegStatsReconAll nipype_name: SegStatsReconAll -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/segment_cc.yaml b/nipype-auto-conv/specs/segment_cc.yaml index 57ea75e6..1a9229bb 100644 --- a/nipype-auto-conv/specs/segment_cc.yaml +++ b/nipype-auto-conv/specs/segment_cc.yaml @@ -28,7 +28,7 @@ # task_name: SegmentCC nipype_name: SegmentCC -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/segment_wm.yaml b/nipype-auto-conv/specs/segment_wm.yaml index ed11dc60..4de86110 100644 --- a/nipype-auto-conv/specs/segment_wm.yaml +++ b/nipype-auto-conv/specs/segment_wm.yaml @@ -22,7 +22,7 @@ # task_name: SegmentWM nipype_name: SegmentWM -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/smooth.yaml b/nipype-auto-conv/specs/smooth.yaml index b4944db2..22be02f6 100644 --- a/nipype-auto-conv/specs/smooth.yaml +++ b/nipype-auto-conv/specs/smooth.yaml @@ -27,7 +27,7 @@ # task_name: Smooth nipype_name: Smooth -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/smooth_tessellation.yaml b/nipype-auto-conv/specs/smooth_tessellation.yaml index 84f1514c..aa5c9d84 100644 --- a/nipype-auto-conv/specs/smooth_tessellation.yaml +++ b/nipype-auto-conv/specs/smooth_tessellation.yaml @@ -23,7 +23,7 @@ # task_name: SmoothTessellation nipype_name: SmoothTessellation -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/sphere.yaml b/nipype-auto-conv/specs/sphere.yaml index 57b0491b..2fc647a5 100644 --- a/nipype-auto-conv/specs/sphere.yaml +++ b/nipype-auto-conv/specs/sphere.yaml @@ -18,7 +18,7 @@ # task_name: Sphere nipype_name: Sphere -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/spherical_average.yaml b/nipype-auto-conv/specs/spherical_average.yaml index 22285a30..a65f965c 100644 --- a/nipype-auto-conv/specs/spherical_average.yaml +++ b/nipype-auto-conv/specs/spherical_average.yaml @@ -27,7 +27,7 @@ # task_name: SphericalAverage nipype_name: SphericalAverage -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.model inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/surface_2_vol_transform.yaml b/nipype-auto-conv/specs/surface_2_vol_transform.yaml index 3d9d5b6c..944c3a90 100644 --- a/nipype-auto-conv/specs/surface_2_vol_transform.yaml +++ b/nipype-auto-conv/specs/surface_2_vol_transform.yaml @@ -24,7 +24,7 @@ # task_name: Surface2VolTransform nipype_name: Surface2VolTransform -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/surface_smooth.yaml b/nipype-auto-conv/specs/surface_smooth.yaml index e4c976c5..14be9eb8 100644 --- a/nipype-auto-conv/specs/surface_smooth.yaml +++ b/nipype-auto-conv/specs/surface_smooth.yaml @@ -33,7 +33,7 @@ # task_name: SurfaceSmooth nipype_name: SurfaceSmooth -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/surface_snapshots.yaml b/nipype-auto-conv/specs/surface_snapshots.yaml index 9173d082..e384aaef 100644 --- a/nipype-auto-conv/specs/surface_snapshots.yaml +++ b/nipype-auto-conv/specs/surface_snapshots.yaml @@ -32,7 +32,7 @@ # task_name: SurfaceSnapshots nipype_name: SurfaceSnapshots -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/surface_transform.yaml b/nipype-auto-conv/specs/surface_transform.yaml index c22e0bea..0f41aa43 100644 --- a/nipype-auto-conv/specs/surface_transform.yaml +++ b/nipype-auto-conv/specs/surface_transform.yaml @@ -25,7 +25,7 @@ # task_name: SurfaceTransform nipype_name: SurfaceTransform -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/synthesize_flash.yaml b/nipype-auto-conv/specs/synthesize_flash.yaml index 17ebc711..7eb02b0b 100644 --- a/nipype-auto-conv/specs/synthesize_flash.yaml +++ b/nipype-auto-conv/specs/synthesize_flash.yaml @@ -20,7 +20,7 @@ # task_name: SynthesizeFLASH nipype_name: SynthesizeFLASH -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/talairach_avi.yaml b/nipype-auto-conv/specs/talairach_avi.yaml index 0be75e5a..c1366efb 100644 --- a/nipype-auto-conv/specs/talairach_avi.yaml +++ b/nipype-auto-conv/specs/talairach_avi.yaml @@ -26,7 +26,7 @@ # task_name: TalairachAVI nipype_name: TalairachAVI -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/talairach_qc.yaml b/nipype-auto-conv/specs/talairach_qc.yaml index 718ff8b8..5f58d10f 100644 --- a/nipype-auto-conv/specs/talairach_qc.yaml +++ b/nipype-auto-conv/specs/talairach_qc.yaml @@ -17,7 +17,7 @@ # task_name: TalairachQC nipype_name: TalairachQC -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/tkregister_2.yaml b/nipype-auto-conv/specs/tkregister_2.yaml index 7c6c5a3c..86095ab1 100644 --- a/nipype-auto-conv/specs/tkregister_2.yaml +++ b/nipype-auto-conv/specs/tkregister_2.yaml @@ -37,7 +37,7 @@ # task_name: Tkregister2 nipype_name: Tkregister2 -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/unpack_sdicom_dir.yaml b/nipype-auto-conv/specs/unpack_sdicom_dir.yaml index bd5a0cc4..e7deb9e6 100644 --- a/nipype-auto-conv/specs/unpack_sdicom_dir.yaml +++ b/nipype-auto-conv/specs/unpack_sdicom_dir.yaml @@ -24,7 +24,7 @@ # task_name: UnpackSDICOMDir nipype_name: UnpackSDICOMDir -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/volume_mask.yaml b/nipype-auto-conv/specs/volume_mask.yaml index 6a09ac2f..952c952b 100644 --- a/nipype-auto-conv/specs/volume_mask.yaml +++ b/nipype-auto-conv/specs/volume_mask.yaml @@ -33,7 +33,7 @@ # task_name: VolumeMask nipype_name: VolumeMask -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.utils inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/nipype-auto-conv/specs/watershed_skull_strip.yaml b/nipype-auto-conv/specs/watershed_skull_strip.yaml index ea5e5e13..b46d2fc2 100644 --- a/nipype-auto-conv/specs/watershed_skull_strip.yaml +++ b/nipype-auto-conv/specs/watershed_skull_strip.yaml @@ -31,7 +31,7 @@ # task_name: WatershedSkullStrip nipype_name: WatershedSkullStrip -nipype_module: nipype.interfaces.freesurfer +nipype_module: nipype.interfaces.freesurfer.preprocess inputs: omit: # list[str] - fields to omit from the Pydra interface diff --git a/related-packages/conftest.py b/related-packages/conftest.py new file mode 100644 index 00000000..2a703c05 --- /dev/null +++ b/related-packages/conftest.py @@ -0,0 +1,37 @@ +import os +import logging +from pathlib import Path +import tempfile +import pytest + +# Set DEBUG logging for unittests + +log_level = logging.WARNING + +logger = logging.getLogger("fileformats") +logger.setLevel(log_level) + +sch = logging.StreamHandler() +sch.setLevel(log_level) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +sch.setFormatter(formatter) +logger.addHandler(sch) + + +# For debugging in IDE's don't catch raised exceptions and let the IDE +# break at it +if os.getenv("_PYTEST_RAISE", "0") != "0": + + @pytest.hookimpl(tryfirst=True) + def pytest_exception_interact(call): + raise call.excinfo.value + + @pytest.hookimpl(tryfirst=True) + def pytest_internalerror(excinfo): + raise excinfo.value + + +@pytest.fixture +def work_dir(): + work_dir = tempfile.mkdtemp() + return Path(work_dir) diff --git a/related-packages/fileformats-extras/README.rst b/related-packages/fileformats-extras/README.rst index b7d4fe24..4dcc5fda 100644 --- a/related-packages/fileformats-extras/README.rst +++ b/related-packages/fileformats-extras/README.rst @@ -1,10 +1,10 @@ -FileFormats-medimage-freesurfer Extras +FileFormats-freesurfer Extras ====================================== .. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg :target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml -This is a extras module for the `fileformats-medimage-freesurfer `__ +This is a extras module for the `fileformats-freesurfer `__ fileformats extension package, which provides additional functionality to format classes (i.e. aside from basic identification and validation), such as conversion tools, metadata parsers, test data generators, etc... @@ -14,7 +14,7 @@ Quick Installation This extension can be installed for Python 3 using *pip*:: - $ pip3 install fileformats-medimage-freesurfer-extras + $ pip3 install fileformats-freesurfer-extras This will install the core package and any other dependencies diff --git a/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/__init__.py b/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/__init__.py index f864d309..e19c798d 100644 --- a/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/__init__.py +++ b/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/__init__.py @@ -3,88 +3,89 @@ from random import Random from fileformats.core import FileSet from fileformats.medimage_freesurfer import ( - Orig, - Xfm, - Lta, - Stats, - Avg_curv, Inflated, Nofix, + White, + Lta, Pial, - M3z, + Label, + Reg, Thickness, + Area, + Xfm, + M3z, Annot, - Label, - Ctab, + Stats, Out, - Area, - White, - Reg, + Avg_curv, + Orig, + Ctab, ) + @FileSet.generate_sample_data.register -def gen_sample_orig_data(orig: Orig, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_inflated_data(inflated: Inflated, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_xfm_data(xfm: Xfm, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_nofix_data(nofix: Nofix, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_lta_data(lta: Lta, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_white_data(white: White, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_stats_data(stats: Stats, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_lta_data(lta: Lta, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_avg_curv_data(avg_curv: Avg_curv, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_pial_data(pial: Pial, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_inflated_data(inflated: Inflated, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_label_data(label: Label, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_nofix_data(nofix: Nofix, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_reg_data(reg: Reg, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_pial_data(pial: Pial, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_thickness_data(thickness: Thickness, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_m3z_data(m3z: M3z, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_area_data(area: Area, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_thickness_data(thickness: Thickness, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_xfm_data(xfm: Xfm, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_annot_data(annot: Annot, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_m3z_data(m3z: M3z, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_label_data(label: Label, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_annot_data(annot: Annot, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_ctab_data(ctab: Ctab, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_stats_data(stats: Stats, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @@ -94,15 +95,15 @@ def gen_sample_out_data(out: Out, dest_dir: Path, seed: ty.Union[int, Random] = @FileSet.generate_sample_data.register -def gen_sample_area_data(area: Area, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_avg_curv_data(avg_curv: Avg_curv, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_white_data(white: White, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_orig_data(orig: Orig, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError @FileSet.generate_sample_data.register -def gen_sample_reg_data(reg: Reg, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: +def gen_sample_ctab_data(ctab: Ctab, dest_dir: Path, seed: ty.Union[int, Random] = 0, stem: ty.Optional[str] = None) -> ty.Iterable[Path]: raise NotImplementedError diff --git a/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py b/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py deleted file mode 100644 index 7b855d18..00000000 --- a/related-packages/fileformats-extras/fileformats/extras/medimage_freesurfer/_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple, Union - VERSION_TUPLE = Tuple[Union[int, str], ...] -else: - VERSION_TUPLE = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE - -__version__ = version = '0.1.1.dev35+g4a0195b' -__version_tuple__ = version_tuple = (0, 1, 1, 'dev35', 'g4a0195b') diff --git a/related-packages/fileformats-extras/pyproject.toml b/related-packages/fileformats-extras/pyproject.toml index 52c870d5..f97b25a3 100644 --- a/related-packages/fileformats-extras/pyproject.toml +++ b/related-packages/fileformats-extras/pyproject.toml @@ -8,9 +8,9 @@ description = "Extensions to add functionality to tool-specific *fileformats* cl readme = "README.rst" requires-python = ">=3.8" dependencies = [ - "fileformats >= 0.7", + "fileformats", "fileformats-medimage-freesurfer", - "pydra >= 0.22.0" + "pydra >= 0.23.0a" ] license = {file = "LICENSE"} authors = [ diff --git a/related-packages/fileformats/README.rst b/related-packages/fileformats/README.rst index acdb1586..357c8b1e 100644 --- a/related-packages/fileformats/README.rst +++ b/related-packages/fileformats/README.rst @@ -1,4 +1,16 @@ -FileFormats Extension - medimage-freesurfer +How to customise this template +============================== + +#. Rename the `related-packages/fileformats/freesurfer` directory to the name of the fileformats subpackage (e.g. `medimage_fsl`) +#. Search and replace "freesurfer" with the name of the fileformats subpackage the extras are to be added +#. Replace name + email placeholders in `pyproject.toml` for developers and maintainers +#. Add the extension file-format classes +#. Ensure that all the extension file-format classes are imported into the extras package root, i.e. `fileformats/freesurfer` +#. Delete these instructions + +... + +FileFormats Extension - freesurfer ==================================== .. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yml/badge.svg :target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yml diff --git a/related-packages/fileformats/fileformats/medimage_freesurfer/__init__.py b/related-packages/fileformats/fileformats/medimage_freesurfer/__init__.py index 30c5832b..2ca1f5ed 100644 --- a/related-packages/fileformats/fileformats/medimage_freesurfer/__init__.py +++ b/related-packages/fileformats/fileformats/medimage_freesurfer/__init__.py @@ -1,13 +1,17 @@ from fileformats.generic import File +class Inflated(File): + ext = ".inflated" + binary = True -class Orig(File): - ext = ".orig" + +class Nofix(File): + ext = ".nofix" binary = True -class Xfm(File): - ext = ".xfm" +class White(File): + ext = ".white" binary = True @@ -16,38 +20,38 @@ class Lta(File): binary = True -class Stats(File): - ext = ".stats" +class Pial(File): + ext = ".pial" binary = True -class Avg_curv(File): - ext = ".avg_curv" +class Label(File): + ext = ".label" binary = True -class Inflated(File): - ext = ".inflated" +class Reg(File): + ext = ".reg" binary = True -class Nofix(File): - ext = ".nofix" +class Thickness(File): + ext = ".thickness" binary = True -class Pial(File): - ext = ".pial" +class Area(File): + ext = ".area" binary = True -class M3z(File): - ext = ".m3z" +class Xfm(File): + ext = ".xfm" binary = True -class Thickness(File): - ext = ".thickness" +class M3z(File): + ext = ".m3z" binary = True @@ -56,13 +60,8 @@ class Annot(File): binary = True -class Label(File): - ext = ".label" - binary = True - - -class Ctab(File): - ext = ".ctab" +class Stats(File): + ext = ".stats" binary = True @@ -71,16 +70,16 @@ class Out(File): binary = True -class Area(File): - ext = ".area" +class Avg_curv(File): + ext = ".avg_curv" binary = True -class White(File): - ext = ".white" +class Orig(File): + ext = ".orig" binary = True -class Reg(File): - ext = ".reg" +class Ctab(File): + ext = ".ctab" binary = True diff --git a/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py b/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py deleted file mode 100644 index 7b855d18..00000000 --- a/related-packages/fileformats/fileformats/medimage_freesurfer/_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple, Union - VERSION_TUPLE = Tuple[Union[int, str], ...] -else: - VERSION_TUPLE = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE - -__version__ = version = '0.1.1.dev35+g4a0195b' -__version_tuple__ = version_tuple = (0, 1, 1, 'dev35', 'g4a0195b') diff --git a/related-packages/fileformats/pyproject.toml b/related-packages/fileformats/pyproject.toml index ad324c2e..6e30941e 100644 --- a/related-packages/fileformats/pyproject.toml +++ b/related-packages/fileformats/pyproject.toml @@ -8,8 +8,8 @@ description = "Classes for representing different file formats in Python classes readme = "README.rst" requires-python = ">=3.8" dependencies = [ - "fileformats >= 0.4", - "fileformats-medimage >= 0.2" + "fileformats", + "fileformats-medimage" ] license = {file = "LICENSE"} authors = [ @@ -51,7 +51,7 @@ test = [ "pytest-env>=0.6.2", "pytest-cov>=2.12.1", "codecov", - "fileformats-medimage-extras", + "fileformats-medimage-CHANGME-extras", ] [project.urls] diff --git a/workflows/ci-cd.yaml b/workflows/ci-cd.yaml new file mode 100644 index 00000000..0b336f87 --- /dev/null +++ b/workflows/ci-cd.yaml @@ -0,0 +1,305 @@ +#This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +# For deployment, it will be necessary to create a PyPI API token and store it as a secret +# https://docs.github.com/en/actions/reference/encrypted-secrets + +name: CI/CD + +on: + push: + branches: [ main, develop ] + tags: [ '*' ] + pull_request: + branches: [ main, develop ] + repository_dispatch: + types: [create-release] + +jobs: + + nipype-conv: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Revert version to most recent tag on upstream update + if: github.event_name == 'repository_dispatch' + run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + - name: Install build dependencies + run: python -m pip install --upgrade pip + - name: Install requirements + run: python -m pip install ./related-packages/fileformats -r ./nipype-auto-conv/requirements.txt + - name: Run automatic Nipype > Pydra conversion + run: ./nipype-auto-conv/generate + - uses: actions/upload-artifact@v3 + with: + name: converted-nipype + path: pydra/tasks/freesurfer/auto + + devcheck: + needs: [nipype-conv] + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.11'] # Check oldest and newest versions + pip-flags: ['', '--editable'] + pydra: + - 'pydra' + - '--editable git+https://github.com/nipype/pydra.git#egg=pydra' + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Revert version to most recent tag on upstream update + if: github.event_name == 'repository_dispatch' + run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') + - name: Download tasks converted from Nipype + uses: actions/download-artifact@v3 + with: + name: converted-nipype + path: pydra/tasks/freesurfer/auto + - name: Strip auto package from gitignore so it is included in package + run: | + sed -i '/\/pydra\/tasks\/freesurfer\/auto/d' .gitignore + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + - name: Install Pydra + run: | + pushd $HOME + pip install ${{ matrix.pydra }} + popd + python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + - name: Install task package + run: | + pip install "./related-packages/fileformats[dev]" "related-packages/fileformats-extras[dev]" + pip install ${{ matrix.pip-flags }} ".[dev]" + python -c "import pydra.tasks.freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + python -c "import fileformats.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + python -c "import fileformats.extras.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + + fileformats-test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.11'] + steps: + - uses: actions/checkout@v3 + - name: Revert version to most recent tag on upstream update + if: github.event_name == 'repository_dispatch' + run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + - name: Install task package + run: | + pip install "./related-packages/fileformats[test]" "./related-packages/fileformats-extras[test]" + python -c "import fileformats.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + - name: Test fileformats with pytest + run: | + cd ./fileformats + pytest -sv --cov fileformats.medimage_freesurfer --cov fileformats.extras.medimage_freesurfer --cov-report xml . + + test: + needs: [nipype-conv, fileformats-test] + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ['3.8'] # '3.11' + steps: + - name: Removed unnecessary tools to free space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Get Download cache Key + id: cache-key + run: echo "::set-output name=key::freesurfer-linux-ubuntu22_amd64-7.4.1" + - name: Cache FreeSurfer + uses: actions/cache@v2 + with: + path: $HOME/downloads/freesurfer + key: ${{ steps.cache-key.outputs.key }} + restore-keys: | + freesurfer-linux-ubuntu22_amd64-7.4.1 + - name: Download FreeSurfer + if: steps.cache-key.outputs.key != steps.cache-hit.outputs.key + run: | + mkdir -p $HOME/downloads/freesurfer + curl -s -o $HOME/downloads/freesurfer/freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz + shell: bash + - name: Install Freesurfer + env: + FREESURFER_LICENCE: ${{ secrets.FREESURFER_LICENCE }} + run: | + pushd $HOME/downloads/freesurfer + tar -zxpf freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz + mv freesurfer $HOME/ + popd + export FREESURFER_HOME=$HOME/freesurfer + source $FREESURFER_HOME/SetUpFreeSurfer.sh + echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt + export PATH=$FREESURFER_HOME/bin:$PATH + - uses: actions/checkout@v3 + - name: Revert version to most recent tag on upstream update + if: github.event_name == 'repository_dispatch' + run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') + - name: Download tasks converted from Nipype + uses: actions/download-artifact@v3 + with: + name: converted-nipype + path: pydra/tasks/freesurfer/auto + - name: Strip auto package from gitignore so it is included in package + run: | + sed -i '/\/src\/pydra\/tasks\/freesurfer\/auto/d' .gitignore + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + - name: Install task package + run: | + pip install "./related-packages/fileformats" "./related-packages/fileformats-extras" ".[test]" + python -c "import pydra.tasks.freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" + - name: Test with pytest + run: | + pytest -sv --doctest-modules ./pydra/tasks/freesurfer \ + --cov pydra.tasks.freesurfer --cov-report xml + - uses: codecov/codecov-action@v3 + if: ${{ always() }} + with: + files: coverage.xml,./fileformats/coverage.xml + name: pydra-freesurfer + + deploy-fileformats: + needs: [devcheck, test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: python -m pip install build twine + - name: Build source and wheel distributions + run: python -m build ./related-packages/fileformats + - name: Check distributions + run: twine check ./related-packages/fileformats/dist/* + - name: Check for PyPI token on tag + id: deployable + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_FILEFORMATS_API_TOKEN }} + packages-dir: ./related-packages/fileformats/dist + + deploy-fileformats-extras: + needs: [deploy-fileformats] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: python -m pip install build twine + - name: Build source and wheel distributions + run: python -m build ./related-packages/fileformats-extras + - name: Check distributions + run: twine check ./related-packages/fileformats-extras/dist/* + - name: Check for PyPI token on tag + id: deployable + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }} + packages-dir: ./related-packages/fileformats-extras/dist + + deploy: + needs: [deploy-fileformats-extras] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Download tasks converted from Nipype + uses: actions/download-artifact@v3 + with: + name: converted-nipype + path: pydra/tasks/freesurfer/auto + - name: Tag release with a post-release based on Nipype and Nipype2Pydra versions + if: github.event_name == 'repository_dispatch' + run: | + TAG=$(git tag -l | tail -n 1 | awk -F post '{print $1}') + POST=$(python -c "from pydra.tasks.freesurfer.auto._version import *; print(post_release)") + git checkout $TAG + git add -f pydra/tasks/freesurfer/auto/_version.py + git commit -am"added auto-generated version to make new tag for package version" + git tag ${TAG}post${POST} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: python -m pip install build twine + - name: Strip auto package from gitignore so it is included in package + run: | + sed -i '/\/pydra\/tasks\/freesurfer\/auto/d' .gitignore + - name: Build source and wheel distributions + run: python -m build . + - name: Check distributions + run: twine check dist/* + - uses: actions/upload-artifact@v3 + with: + name: distributions + path: dist/ + - name: Check for PyPI token on tag + id: deployable + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + +# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets. +# Secrets are not accessible in the if: condition [0], so set an output variable [1] +# [0] https://github.community/t/16928 +# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter \ No newline at end of file From 870c1a22563e7a887a72112607c193f57aa6a027 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 19 Mar 2024 14:54:10 +1100 Subject: [PATCH 7/9] updated converter syntax --- nipype-auto-conv/generate | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype-auto-conv/generate b/nipype-auto-conv/generate index dca1fb98..5ebde76d 100755 --- a/nipype-auto-conv/generate +++ b/nipype-auto-conv/generate @@ -8,7 +8,7 @@ from importlib import import_module import yaml import nipype import nipype2pydra.utils -from nipype2pydra.task import TaskConverter +from nipype2pydra.task import get_converter SPECS_DIR = Path(__file__).parent / "specs" @@ -49,7 +49,7 @@ for fspath in sorted(SPECS_DIR.glob("**/*.yaml")): module_name = nipype2pydra.utils.to_snake_case(spec["task_name"]) - converter = TaskConverter( + converter = get_converter( output_module=f"pydra.tasks.{PKG_NAME}.auto.{module_name}", callables_module=callables, # type: ignore **spec, From 10acbbce52122a65259a024a04af27f94baa9b78 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 19 Mar 2024 14:54:10 +1100 Subject: [PATCH 8/9] added __all__ attribute to init --- nipype-auto-conv/generate | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nipype-auto-conv/generate b/nipype-auto-conv/generate index 5ebde76d..d17f2fd3 100755 --- a/nipype-auto-conv/generate +++ b/nipype-auto-conv/generate @@ -35,6 +35,7 @@ auto_dir = PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" if auto_dir.exists(): shutil.rmtree(auto_dir) +all_interfaces = [] for fspath in sorted(SPECS_DIR.glob("**/*.yaml")): with open(fspath) as f: spec = yaml.load(f, Loader=yaml.SafeLoader) @@ -56,6 +57,7 @@ for fspath in sorted(SPECS_DIR.glob("**/*.yaml")): ) converter.generate(PKG_ROOT) auto_init += f"from .{module_name} import {converter.task_name}\n" + all_interfaces.append(converter.task_name) with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "_version.py", "w") as f: From ccf10e1ccb33c392d98fa669a8ba33c2f6892e08 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Wed, 20 Mar 2024 08:45:53 +1100 Subject: [PATCH 9/9] updated actions versions --- .github/workflows/ci-cd.yaml | 28 ++-- workflows/ci-cd.yaml | 305 ----------------------------------- 2 files changed, 14 insertions(+), 319 deletions(-) delete mode 100644 workflows/ci-cd.yaml diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 27e72d89..fd924ccf 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -21,12 +21,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Revert version to most recent tag on upstream update if: github.event_name == 'repository_dispatch' run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 - name: Install build dependencies run: python -m pip install --upgrade pip - name: Install requirements @@ -50,7 +50,7 @@ jobs: - '--editable git+https://github.com/nipype/pydra.git#egg=pydra' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Revert version to most recent tag on upstream update if: github.event_name == 'repository_dispatch' run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') @@ -63,7 +63,7 @@ jobs: run: | sed -i '/\/pydra\/tasks\/freesurfer\/auto/d' .gitignore - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install build dependencies @@ -90,12 +90,12 @@ jobs: matrix: python-version: ['3.8', '3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Revert version to most recent tag on upstream update if: github.event_name == 'repository_dispatch' run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install build dependencies @@ -149,7 +149,7 @@ jobs: source $FREESURFER_HOME/SetUpFreeSurfer.sh echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt export PATH=$FREESURFER_HOME/bin:$PATH - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Revert version to most recent tag on upstream update if: github.event_name == 'repository_dispatch' run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') @@ -162,7 +162,7 @@ jobs: run: | sed -i '/\/src\/pydra\/tasks\/freesurfer\/auto/d' .gitignore - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install build dependencies @@ -187,12 +187,12 @@ jobs: needs: [devcheck, test] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install build tools @@ -219,12 +219,12 @@ jobs: needs: [deploy-fileformats] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install build tools @@ -251,7 +251,7 @@ jobs: needs: [deploy-fileformats-extras] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 @@ -270,7 +270,7 @@ jobs: git commit -am"added auto-generated version to make new tag for package version" git tag ${TAG}post${POST} - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install build tools diff --git a/workflows/ci-cd.yaml b/workflows/ci-cd.yaml deleted file mode 100644 index 0b336f87..00000000 --- a/workflows/ci-cd.yaml +++ /dev/null @@ -1,305 +0,0 @@ -#This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -# For deployment, it will be necessary to create a PyPI API token and store it as a secret -# https://docs.github.com/en/actions/reference/encrypted-secrets - -name: CI/CD - -on: - push: - branches: [ main, develop ] - tags: [ '*' ] - pull_request: - branches: [ main, develop ] - repository_dispatch: - types: [create-release] - -jobs: - - nipype-conv: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Revert version to most recent tag on upstream update - if: github.event_name == 'repository_dispatch' - run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - - name: Install build dependencies - run: python -m pip install --upgrade pip - - name: Install requirements - run: python -m pip install ./related-packages/fileformats -r ./nipype-auto-conv/requirements.txt - - name: Run automatic Nipype > Pydra conversion - run: ./nipype-auto-conv/generate - - uses: actions/upload-artifact@v3 - with: - name: converted-nipype - path: pydra/tasks/freesurfer/auto - - devcheck: - needs: [nipype-conv] - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.8', '3.11'] # Check oldest and newest versions - pip-flags: ['', '--editable'] - pydra: - - 'pydra' - - '--editable git+https://github.com/nipype/pydra.git#egg=pydra' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Revert version to most recent tag on upstream update - if: github.event_name == 'repository_dispatch' - run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - - name: Download tasks converted from Nipype - uses: actions/download-artifact@v3 - with: - name: converted-nipype - path: pydra/tasks/freesurfer/auto - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/pydra\/tasks\/freesurfer\/auto/d' .gitignore - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - - name: Install Pydra - run: | - pushd $HOME - pip install ${{ matrix.pydra }} - popd - python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - name: Install task package - run: | - pip install "./related-packages/fileformats[dev]" "related-packages/fileformats-extras[dev]" - pip install ${{ matrix.pip-flags }} ".[dev]" - python -c "import pydra.tasks.freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - python -c "import fileformats.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - python -c "import fileformats.extras.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - fileformats-test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.8', '3.11'] - steps: - - uses: actions/checkout@v3 - - name: Revert version to most recent tag on upstream update - if: github.event_name == 'repository_dispatch' - run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - - name: Install task package - run: | - pip install "./related-packages/fileformats[test]" "./related-packages/fileformats-extras[test]" - python -c "import fileformats.medimage_freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - name: Test fileformats with pytest - run: | - cd ./fileformats - pytest -sv --cov fileformats.medimage_freesurfer --cov fileformats.extras.medimage_freesurfer --cov-report xml . - - test: - needs: [nipype-conv, fileformats-test] - runs-on: ubuntu-22.04 - strategy: - matrix: - python-version: ['3.8'] # '3.11' - steps: - - name: Removed unnecessary tools to free space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Get Download cache Key - id: cache-key - run: echo "::set-output name=key::freesurfer-linux-ubuntu22_amd64-7.4.1" - - name: Cache FreeSurfer - uses: actions/cache@v2 - with: - path: $HOME/downloads/freesurfer - key: ${{ steps.cache-key.outputs.key }} - restore-keys: | - freesurfer-linux-ubuntu22_amd64-7.4.1 - - name: Download FreeSurfer - if: steps.cache-key.outputs.key != steps.cache-hit.outputs.key - run: | - mkdir -p $HOME/downloads/freesurfer - curl -s -o $HOME/downloads/freesurfer/freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz - shell: bash - - name: Install Freesurfer - env: - FREESURFER_LICENCE: ${{ secrets.FREESURFER_LICENCE }} - run: | - pushd $HOME/downloads/freesurfer - tar -zxpf freesurfer-linux-ubuntu22_amd64-7.4.1.tar.gz - mv freesurfer $HOME/ - popd - export FREESURFER_HOME=$HOME/freesurfer - source $FREESURFER_HOME/SetUpFreeSurfer.sh - echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt - export PATH=$FREESURFER_HOME/bin:$PATH - - uses: actions/checkout@v3 - - name: Revert version to most recent tag on upstream update - if: github.event_name == 'repository_dispatch' - run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}') - - name: Download tasks converted from Nipype - uses: actions/download-artifact@v3 - with: - name: converted-nipype - path: pydra/tasks/freesurfer/auto - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/src\/pydra\/tasks\/freesurfer\/auto/d' .gitignore - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - - name: Install task package - run: | - pip install "./related-packages/fileformats" "./related-packages/fileformats-extras" ".[test]" - python -c "import pydra.tasks.freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - name: Test with pytest - run: | - pytest -sv --doctest-modules ./pydra/tasks/freesurfer \ - --cov pydra.tasks.freesurfer --cov-report xml - - uses: codecov/codecov-action@v3 - if: ${{ always() }} - with: - files: coverage.xml,./fileformats/coverage.xml - name: pydra-freesurfer - - deploy-fileformats: - needs: [devcheck, test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install build tools - run: python -m pip install build twine - - name: Build source and wheel distributions - run: python -m build ./related-packages/fileformats - - name: Check distributions - run: twine check ./related-packages/fileformats/dist/* - - name: Check for PyPI token on tag - id: deployable - if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_FILEFORMATS_API_TOKEN }} - packages-dir: ./related-packages/fileformats/dist - - deploy-fileformats-extras: - needs: [deploy-fileformats] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install build tools - run: python -m pip install build twine - - name: Build source and wheel distributions - run: python -m build ./related-packages/fileformats-extras - - name: Check distributions - run: twine check ./related-packages/fileformats-extras/dist/* - - name: Check for PyPI token on tag - id: deployable - if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }} - packages-dir: ./related-packages/fileformats-extras/dist - - deploy: - needs: [deploy-fileformats-extras] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: Download tasks converted from Nipype - uses: actions/download-artifact@v3 - with: - name: converted-nipype - path: pydra/tasks/freesurfer/auto - - name: Tag release with a post-release based on Nipype and Nipype2Pydra versions - if: github.event_name == 'repository_dispatch' - run: | - TAG=$(git tag -l | tail -n 1 | awk -F post '{print $1}') - POST=$(python -c "from pydra.tasks.freesurfer.auto._version import *; print(post_release)") - git checkout $TAG - git add -f pydra/tasks/freesurfer/auto/_version.py - git commit -am"added auto-generated version to make new tag for package version" - git tag ${TAG}post${POST} - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install build tools - run: python -m pip install build twine - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/pydra\/tasks\/freesurfer\/auto/d' .gitignore - - name: Build source and wheel distributions - run: python -m build . - - name: Check distributions - run: twine check dist/* - - uses: actions/upload-artifact@v3 - with: - name: distributions - path: dist/ - - name: Check for PyPI token on tag - id: deployable - if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - -# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets. -# Secrets are not accessible in the if: condition [0], so set an output variable [1] -# [0] https://github.community/t/16928 -# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter \ No newline at end of file