From bb9f5b470defe5a029f40bb47239cde918aea8fd Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 22 Nov 2017 09:55:13 -0500 Subject: [PATCH 01/10] Extended MRtrix3 interface --- .zenodo.json | 4 + doc/users/config_file.rst | 8 +- doc/users/plugins.rst | 4 +- nipype/algorithms/tests/test_auto_CompCor.py | 53 +++++ nipype/algorithms/tests/test_auto_ErrorMap.py | 35 ++++ nipype/algorithms/tests/test_auto_Overlap.py | 47 +++++ nipype/algorithms/tests/test_auto_TSNR.py | 43 ++++ nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/afni/preprocess.py | 2 +- .../afni/tests/test_auto_TCatSubBrick.py | 48 +++++ nipype/interfaces/afni/utils.py | 2 +- nipype/interfaces/ants/resampling.py | 2 +- .../interfaces/ants/tests/test_resampling.py | 4 +- nipype/interfaces/cmtk/tests/test_nbs.py | 4 +- nipype/interfaces/mrtrix3/__init__.py | 8 +- nipype/interfaces/mrtrix3/preprocess.py | 58 +++++- nipype/interfaces/mrtrix3/reconst.py | 58 +++++- .../mrtrix3/tests/test_auto_DWI2FOD.py | 81 +++++++ .../mrtrix3/tests/test_auto_DWI2Response.py | 75 +++++++ .../mrtrix3/tests/test_auto_DWIExtract.py | 62 ++++++ .../mrtrix3/tests/test_auto_Generate5tt.py | 24 ++- .../mrtrix3/tests/test_auto_Generate5ttFSL.py | 45 ++++ .../mrtrix3/tests/test_auto_MRConvert.py | 66 ++++++ .../mrtrix3/tests/test_auto_MRMath.py | 59 ++++++ nipype/interfaces/mrtrix3/utils.py | 197 +++++++++++++++++- nipype/interfaces/niftyfit/asl.py | 2 +- .../niftyseg/tests/test_auto_PatchMatch.py | 60 ++++++ .../tests/test_auto_SimpleInterface.py | 16 ++ nipype/pipeline/engine/tests/test_utils.py | 2 +- 29 files changed, 1035 insertions(+), 36 deletions(-) create mode 100755 nipype/algorithms/tests/test_auto_CompCor.py create mode 100755 nipype/algorithms/tests/test_auto_ErrorMap.py create mode 100755 nipype/algorithms/tests/test_auto_Overlap.py create mode 100755 nipype/algorithms/tests/test_auto_TSNR.py create mode 100755 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py create mode 100755 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py create mode 100755 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/.zenodo.json b/.zenodo.json index 41497da6d8..852ff8f91f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -538,6 +538,10 @@ "affiliation": "MIT", "name": "Kaczmarzyk, Jakub", "orcid": "0000-0002-5544-7577" + }, + { + "affiliation": "University College London" + "name": "Mancini, Matteo" } ], "keywords": [ diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index b196047e97..7c10a381c8 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_auto_CompCor.py b/nipype/algorithms/tests/test_auto_CompCor.py new file mode 100755 index 0000000000..34dacaf4d3 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_CompCor.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..confounds import CompCor + + +def test_CompCor_inputs(): + input_map = dict(components_file=dict(usedefault=True, + ), + header_prefix=dict(), + high_pass_cutoff=dict(usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + ignore_initial_volumes=dict(usedefault=True, + ), + mask_files=dict(), + mask_index=dict(requires=['mask_files'], + xor=['merge_method'], + ), + merge_method=dict(requires=['mask_files'], + xor=['mask_index'], + ), + num_components=dict(usedefault=True, + ), + pre_filter=dict(usedefault=True, + ), + realigned_file=dict(mandatory=True, + ), + regress_poly_degree=dict(usedefault=True, + ), + repetition_time=dict(), + save_pre_filter=dict(), + use_regress_poly=dict(deprecated='0.15.0', + new_name='pre_filter', + ), + ) + inputs = CompCor.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_CompCor_outputs(): + output_map = dict(components_file=dict(), + pre_filter_file=dict(), + ) + outputs = CompCor.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py new file mode 100755 index 0000000000..f3d19c5690 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_ErrorMap.py @@ -0,0 +1,35 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..metrics import ErrorMap + + +def test_ErrorMap_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_ref=dict(mandatory=True, + ), + in_tst=dict(mandatory=True, + ), + mask=dict(), + metric=dict(mandatory=True, + usedefault=True, + ), + out_map=dict(), + ) + inputs = ErrorMap.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_ErrorMap_outputs(): + output_map = dict(distance=dict(), + out_map=dict(), + ) + outputs = ErrorMap.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py new file mode 100755 index 0000000000..dcabbec296 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_Overlap.py @@ -0,0 +1,47 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..misc import Overlap + + +def test_Overlap_inputs(): + input_map = dict(bg_overlap=dict(mandatory=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + mask_volume=dict(), + out_file=dict(usedefault=True, + ), + vol_units=dict(mandatory=True, + usedefault=True, + ), + volume1=dict(mandatory=True, + ), + volume2=dict(mandatory=True, + ), + weighting=dict(usedefault=True, + ), + ) + inputs = Overlap.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Overlap_outputs(): + output_map = dict(dice=dict(), + diff_file=dict(), + jaccard=dict(), + labels=dict(), + roi_di=dict(), + roi_ji=dict(), + roi_voldiff=dict(), + volume_difference=dict(), + ) + outputs = Overlap.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_TSNR.py b/nipype/algorithms/tests/test_auto_TSNR.py new file mode 100755 index 0000000000..d906d39e3f --- /dev/null +++ b/nipype/algorithms/tests/test_auto_TSNR.py @@ -0,0 +1,43 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..misc import TSNR + + +def test_TSNR_inputs(): + input_map = dict(detrended_file=dict(hash_files=False, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(mandatory=True, + ), + mean_file=dict(hash_files=False, + usedefault=True, + ), + regress_poly=dict(), + stddev_file=dict(hash_files=False, + usedefault=True, + ), + tsnr_file=dict(hash_files=False, + usedefault=True, + ), + ) + inputs = TSNR.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TSNR_outputs(): + output_map = dict(detrended_file=dict(), + mean_file=dict(), + stddev_file=dict(), + tsnr_file=dict(), + ) + outputs = TSNR.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index 9d510dee2b..d5fbc56825 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c96616273d..3d7d47c673 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -3490,7 +3490,7 @@ class Qwarp(AFNICommand): >>> qwarp3.inputs.base_file = 'mni.nii' >>> qwarp3.inputs.allineate = True >>> qwarp3.inputs.allineate_opts = '-cose lpa -verb' - >>> qwarp3.cmdline + >>> qwarp3.cmdline # doctest: +ALLOW_UNICODE "3dQwarp -allineate -allineate_opts '-cose lpa -verb' -base mni.nii -source structural.nii -prefix structural_QW" >>> res3 = qwarp3.run() # doctest: +SKIP """ _cmd = '3dQwarp' diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py new file mode 100755 index 0000000000..da3b0fb383 --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -0,0 +1,48 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TCatSubBrick + + +def test_TCatSubBrick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_files=dict(argstr='%s%s ...', + copyfile=False, + mandatory=True, + position=-1, + ), + num_threads=dict(nohash=True, + usedefault=True, + ), + out_file=dict(argstr='-prefix %s', + genfile=True, + ), + outputtype=dict(), + rlt=dict(argstr='-rlt%s', + position=1, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = TCatSubBrick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TCatSubBrick_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TCatSubBrick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 242b5077ee..e492b39d47 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1674,7 +1674,7 @@ class NwarpCat(AFNICommand): >>> nwarpcat = afni.NwarpCat() >>> nwarpcat.inputs.in_files = ['Q25_warp+tlrc.HEAD', ('IDENT', 'structural.nii')] >>> nwarpcat.inputs.out_file = 'Fred_total_WARP' - >>> nwarpcat.cmdline + >>> nwarpcat.cmdline # doctest: +ALLOW_UNICODE "3dNwarpCat -prefix Fred_total_WARP Q25_warp+tlrc.HEAD 'IDENT(structural.nii)'" >>> res = nwarpcat.run() # doctest: +SKIP diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index 3ed60a51b1..e268cb43e2 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -75,7 +75,7 @@ class WarpTimeSeriesImageMultiTransform(ANTSCommand): >>> wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' >>> wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] >>> wtsimt.inputs.invert_affine = [1] # # this will invert the 1st Affine file: ants_Affine.txt - >>> wtsimt.cmdline + >>> wtsimt.cmdline # doctest: +ALLOW_UNICODE 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii -R ants_deformed.nii.gz ants_Warp.nii.gz \ -i ants_Affine.txt' """ diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 22dc4446e9..509ebfe844 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 0516390b02..03a7aa8619 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/mrtrix3/__init__.py b/nipype/interfaces/mrtrix3/__init__.py index 3ff5c8e2e7..81749386f5 100644 --- a/nipype/interfaces/mrtrix3/__init__.py +++ b/nipype/interfaces/mrtrix3/__init__.py @@ -3,9 +3,9 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -from .utils import (Mesh2PVE, Generate5tt, BrainMask, TensorMetrics, - ComputeTDI, TCK2VTK) -from .preprocess import ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST +from .utils import (Mesh2PVE, Generate5tt, Generate5ttFSL, BrainMask, TensorMetrics, + ComputeTDI, TCK2VTK, MRMath, MRConvert, DWIExtract) +from .preprocess import DWI2Response, ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST from .tracking import Tractography -from .reconst import FitTensor, EstimateFOD +from .reconst import DWI2FOD, FitTensor, EstimateFOD from .connectivity import LabelConfig, BuildConnectome diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 141325e25b..1159e89e7a 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -17,10 +17,64 @@ from ..traits_extension import isdefined from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, - File) + File, Undefined) from .base import MRTrix3BaseInputSpec, MRTrix3Base +class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, + mandatory=True, desc='response estimation algorithm (multi-tissue)') + dwi_file = File(exists=True, argstr='%s', position=-5, + mandatory=True, desc='input DWI image') + mtt_file = File(argstr='%s', position=-4, desc='input 5tt image') + wm_file = File('wm.txt', argstr='%s', position=-3, usedefault=True, + desc='output WM response text file') + gm_file = File(argstr='%s', position=-2, desc='output GM response text file') + csf_file = File(argstr='%s', position=-1, desc='output CSF response text file') + in_mask = File(exists=True, argstr='-mask %s', + desc='provide initial mask image') + max_sh = traits.Int(8, argstr='-lmax %d', + desc='maximum harmonic degree of response function') + + +class DWI2ResponseOutputSpec(TraitedSpec): + wm_file = File(argstr='%s', desc='output WM response text file') + gm_file = File(argstr='%s', desc='output GM response text file') + csf_file = File(argstr='%s', desc='output CSF response text file') + + +class DWI2Response(MRTrix3Base): + + """ + Estimate response function(s) for spherical deconvolution using the specified algorithm. + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> resp = mrt.DWI2Response() + >>> resp.inputs.dwi_file = 'dwi.mif' + >>> resp.inputs.algorithm = 'tournier' + >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') + >>> resp.cmdline # doctest: +ELLIPSIS + 'dwi2response -fslgrad bvecs bvals tournier dwi.mif wm.txt' + >>> resp.run() # doctest: +SKIP + """ + + _cmd = 'dwi2response' + input_spec = DWI2ResponseInputSpec + output_spec = DWI2ResponseOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['wm_file'] = op.abspath(self.inputs.wm_file) + if self.inputs.gm_file!=Undefined: + outputs['gm_file'] = op.abspath(self.inputs.gm_file) + if self.inputs.csf_file!=Undefined: + outputs['csf_file'] = op.abspath(self.inputs.csf_file) + return outputs + + class ResponseSDInputSpec(MRTrix3BaseInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='input diffusion weighted images') @@ -80,7 +134,7 @@ class ResponseSD(MRTrix3Base): """ Generate an appropriate response function from the image data for - spherical deconvolution. + spherical deconvolution. (previous MRTrix releases) .. [1] Tax, C. M.; Jeurissen, B.; Vos, S. B.; Viergever, M. A. and Leemans, A., Recursive calibration of the fiber response function diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index b608c5514c..b8f2ffef63 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -15,7 +15,7 @@ import os.path as op -from ..base import traits, TraitedSpec, File +from ..base import traits, TraitedSpec, File, Undefined from .base import MRTrix3BaseInputSpec, MRTrix3Base @@ -73,6 +73,61 @@ def _list_outputs(self): return outputs +class DWI2FODInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, + mandatory=True, desc='FOD algorithm') + dwi_file = File(exists=True, argstr='%s', position=-7, + mandatory=True, desc='input DWI image') + wm_txt = File(argstr='%s', position=-6, + mandatory=True, desc='WM response text file') + wm_odf = File('wm.mif', argstr='%s', position=-5, usedefault=True, + mandatory=True, desc='output WM ODF') + gm_txt = File(argstr='%s', position=-4, desc='GM response text file') + gm_odf = File('gm.mif', argstr='%s', position=-3, desc='output GM ODF') + csf_txt = File(argstr='%s', position=-2, desc='CSF response text file') + csf_odf = File('csf.mif', argstr='%s', position=-1, desc='output CSF ODF') + mask_file = File(exists=True, argstr='-mask %s', desc='mask image') + + +class DWI2FODOutputSpec(TraitedSpec): + wm_odf = File(argstr='%s', desc='output WM ODF') + gm_odf = File(argstr='%s', desc='output GM ODF') + csf_odf = File(argstr='%s', desc='output CSF ODF') + + +class DWI2FOD(MRTrix3Base): + + """ + Estimate fibre orientation distributions from diffusion data using spherical deconvolution + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> fod = mrt.DWI2FOD() + >>> fod.inputs.algorithm = 'csd' + >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.wm_txt = 'wm.txt' + >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') + >>> fod.cmdline # doctest: +ELLIPSIS + 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' + >>> fod.run() # doctest: +SKIP + """ + + _cmd = 'dwi2fod' + input_spec = DWI2FODInputSpec + output_spec = DWI2FODOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) + if self.inputs.gm_odf!=Undefined: + outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) + if self.inputs.csf_odf!=Undefined: + outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) + return outputs + + class EstimateFODInputSpec(MRTrix3BaseInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, desc='input diffusion weighted images') @@ -129,6 +184,7 @@ class EstimateFOD(MRTrix3Base): """ Convert diffusion-weighted images to tensor images + (previous MRTrix releases) Note that this program makes use of implied symmetries in the diffusion profile. First, the fact the signal attenuation profile is real implies diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py new file mode 100755 index 0000000000..9501fd656b --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py @@ -0,0 +1,81 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..reconst import DWI2FOD + + +def test_DWI2FOD_inputs(): + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-8, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + csf_odf=dict(argstr='%s', + position=-1, + ), + csf_txt=dict(argstr='%s', + position=-2, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), + environ=dict(nohash=True, + usedefault=True, + ), + gm_odf=dict(argstr='%s', + position=-3, + ), + gm_txt=dict(argstr='%s', + position=-4, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + mask_file=dict(argstr='-mask %s', + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + wm_odf=dict(argstr='%s', + mandatory=True, + position=-5, + usedefault=True, + ), + wm_txt=dict(argstr='%s', + mandatory=True, + position=-6, + ), + ) + inputs = DWI2FOD.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWI2FOD_outputs(): + output_map = dict(csf_odf=dict(argstr='%s', + ), + gm_odf=dict(argstr='%s', + ), + wm_odf=dict(argstr='%s', + ), + ) + outputs = DWI2FOD.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py new file mode 100755 index 0000000000..5b0836f79b --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py @@ -0,0 +1,75 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..preprocess import DWI2Response + + +def test_DWI2Response_inputs(): + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-6, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + csf_file=dict(argstr='%s', + position=-1, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-5, + ), + environ=dict(nohash=True, + usedefault=True, + ), + gm_file=dict(argstr='%s', + position=-2, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_mask=dict(argstr='-mask %s', + ), + max_sh=dict(argstr='-lmax %d', + ), + mtt_file=dict(argstr='%s', + position=-4, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + wm_file=dict(argstr='%s', + position=-3, + usedefault=True, + ), + ) + inputs = DWI2Response.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWI2Response_outputs(): + output_map = dict(csf_file=dict(argstr='%s', + ), + gm_file=dict(argstr='%s', + ), + wm_file=dict(argstr='%s', + ), + ) + outputs = DWI2Response.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py new file mode 100755 index 0000000000..22e0890d2f --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py @@ -0,0 +1,62 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import DWIExtract + + +def test_DWIExtract_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + bzero=dict(argstr='-bzero', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-2, + ), + nobzero=dict(argstr='-nobzero', + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + ), + shell=dict(argstr='-shell %s', + sep=',', + ), + singleshell=dict(argstr='-singleshell', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = DWIExtract.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWIExtract_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = DWIExtract.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py index 2afa4e46da..df1aadbe63 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py @@ -4,25 +4,37 @@ def test_Generate5tt_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-3, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', ), environ=dict(nohash=True, usedefault=True, ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), ignore_exception=dict(nohash=True, usedefault=True, ), - in_fast=dict(argstr='%s', - mandatory=True, - position=-3, + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', ), - in_first=dict(argstr='%s', + in_file=dict(argstr='%s', + mandatory=True, position=-2, ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), out_file=dict(argstr='%s', mandatory=True, position=-1, - usedefault=True, ), terminal_output=dict(deprecated='1.0.0', nohash=True, diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py new file mode 100755 index 0000000000..97617fa2cc --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py @@ -0,0 +1,45 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import Generate5ttFSL + + +def test_Generate5ttFSL_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fast=dict(argstr='%s', + mandatory=True, + position=-3, + ), + in_first=dict(argstr='%s', + position=-2, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + usedefault=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = Generate5ttFSL.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Generate5ttFSL_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = Generate5ttFSL.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py new file mode 100755 index 0000000000..5dec38ed52 --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py @@ -0,0 +1,66 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import MRConvert + + +def test_MRConvert_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + axes=dict(argstr='-axes %s', + sep=',', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + coord=dict(argstr='-coord %s', + sep=' ', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-2, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + usedefault=True, + ), + scaling=dict(argstr='-scaling %s', + sep=',', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + vox=dict(argstr='-vox %s', + sep=',', + ), + ) + inputs = MRConvert.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_MRConvert_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = MRConvert.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py new file mode 100755 index 0000000000..963ad07722 --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py @@ -0,0 +1,59 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import MRMath + + +def test_MRMath_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + axis=dict(argstr='-axis %d', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-3, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + operation=dict(argstr='%s', + mandatory=True, + position=-2, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = MRMath.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_MRMath_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = MRMath.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 42f3d0c6fd..18397823a7 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -108,7 +108,49 @@ def _list_outputs(self): return outputs -class Generate5ttInputSpec(CommandLineInputSpec): +class Generate5ttInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('fsl','gif','freesurfer', argstr='%s', position=-3, + mandatory=True, desc='tissue segmentation algorithm') + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + + +class Generate5ttOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class Generate5tt(MRTrix3Base): + + """ + Generate a 5TT image suitable for ACT using the selected algorithm + uhm + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> gen5tt = mrt.Generate5tt() + >>> gen5tt.inputs.in_file = 'T1.nii.gz' + >>> gen5tt.inputs.algorithm = 'fsl' + >>> gen5tt.inputs.out_file = '5tt.mif' + >>> gen5tt.cmdline # doctest: +ELLIPSIS + '5ttgen fsl T1.nii.gz 5tt.mif' + >>> gen5tt.run() # doctest: +SKIP + """ + + _cmd = '5ttgen' + input_spec = Generate5ttInputSpec + output_spec = Generate5ttOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class Generate5ttFSLInputSpec(CommandLineInputSpec): in_fast = InputMultiPath( File(exists=True), argstr='%s', mandatory=True, position=-3, desc='list of PVE images from FAST') @@ -120,22 +162,22 @@ class Generate5ttInputSpec(CommandLineInputSpec): usedefault=True, desc='name of output file') -class Generate5ttOutputSpec(TraitedSpec): +class Generate5ttFSLOutputSpec(TraitedSpec): out_file = File(exists=True, desc='segmentation for ACT in 5tt format') -class Generate5tt(CommandLine): +class Generate5ttFSL(CommandLine): """ Concatenate segmentation results from FSL FAST and FIRST into the 5TT - format required for ACT + format required for ACT (previous MRTrix releases) Example ------- >>> import nipype.interfaces.mrtrix3 as mrt - >>> seg = mrt.Generate5tt() + >>> seg = mrt.Generate5ttFSL() >>> seg.inputs.in_fast = ['tpm_00.nii.gz', ... 'tpm_01.nii.gz', 'tpm_02.nii.gz'] >>> seg.inputs.in_first = 'first_merged.nii.gz' @@ -146,8 +188,8 @@ class Generate5tt(CommandLine): """ _cmd = '5ttgen' - input_spec = Generate5ttInputSpec - output_spec = Generate5ttOutputSpec + input_spec = Generate5ttFSLInputSpec + output_spec = Generate5ttFSLOutputSpec def _list_outputs(self): outputs = self.output_spec().get() @@ -401,3 +443,144 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = op.abspath(self.inputs.out_file) return outputs + + +class DWIExtractInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + bzero = traits.Bool(argstr='-bzero', desc='extract b=0 volumes') + nobzero = traits.Bool(argstr='-nobzero', desc='extract non b=0 volumes') + singleshell = traits.Bool(argstr='-singleshell', desc='extract volumes with a specific shell') + shell = traits.List(traits.Float, sep=',', argstr='-shell %s', + desc='specify one or more gradient shells') + + +class DWIExtractOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class DWIExtract(MRTrix3Base): + + """ + Extract diffusion-weighted volumes, b=0 volumes, or certain shells from a + DWI dataset + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> dwiextract = mrt.DWIExtract() + >>> dwiextract.inputs.in_file = 'dwi.mif' + >>> dwiextract.inputs.bzero = True + >>> dwiextract.inputs.out_file = 'b0vols.mif' + >>> dwiextract.inputs.grad_fsl = ('bvecs', 'bvals') + >>> dwiextract.cmdline # doctest: +ELLIPSIS + 'dwiextract -bzero -fslgrad bvecs bvals dwi.mif b0vols.mif' + >>> dwiextract.run() # doctest: +SKIP + """ + + _cmd = 'dwiextract' + input_spec = DWIExtractInputSpec + output_spec = DWIExtractOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class MRConvertInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File('dwi.mif', argstr='%s', mandatory=True, position=-1, + usedefault=True, desc='output image') + coord = traits.List(traits.Float, sep=' ', argstr='-coord %s', + desc='extract data at the specified coordinates') + vox = traits.List(traits.Float, sep=',', argstr='-vox %s', + desc='change the voxel dimensions') + axes = traits.List(traits.Int, sep=',', argstr='-axes %s', + desc='specify the axes that will be used') + scaling = traits.List(traits.Float, sep=',', argstr='-scaling %s', + desc='specify the data scaling parameter') + + +class MRConvertOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class MRConvert(MRTrix3Base): + + """ + Perform conversion between different file types and optionally extract a + subset of the input image + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> mrconvert = mrt.MRConvert() + >>> mrconvert.inputs.in_file = 'dwi.nii.gz' + >>> mrconvert.inputs.grad_fsl = ('bvecs', 'bvals') + >>> mrconvert.cmdline # doctest: +ELLIPSIS + 'mrconvert -fslgrad bvecs bvals dwi.nii.gz dwi.mif' + >>> mrconvert.run() # doctest: +SKIP + """ + + _cmd = 'mrconvert' + input_spec = MRConvertInputSpec + output_spec = MRConvertOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class MRMathInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + operation = traits.Enum('mean','median','sum','product','rms','norm', + 'var','std','min','max','absmax','magmax', argstr='%s', position=-2, + mandatory=True, desc='operation to computer along a specified axis') + axis = traits.Int(0, argstr='-axis %d', + desc='specfied axis to perform the operation along') + + +class MRMathOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class MRMath(MRTrix3Base): + + """ + Compute summary statistic on image intensities + along a specified axis of a single image + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> mrmath = mrt.MRMath() + >>> mrmath.inputs.in_file = 'dwi.mif' + >>> mrmath.inputs.operation = 'mean' + >>> mrmath.inputs.axis = 3 + >>> mrmath.inputs.out_file = 'dwi_mean.mif' + >>> mrmath.inputs.grad_fsl = ('bvecs', 'bvals') + >>> mrmath.cmdline # doctest: +ELLIPSIS + 'mrmath -axis 3 -fslgrad bvecs bvals dwi.mif mean dwi_mean.mif' + >>> mrmath.run() # doctest: +SKIP + """ + + _cmd = 'mrmath' + input_spec = MRMathInputSpec + output_spec = MRMathOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 366f9a6eca..8f95a48192 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py new file mode 100755 index 0000000000..635eff1c9b --- /dev/null +++ b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py @@ -0,0 +1,60 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..patchmatch import PatchMatch + + +def test_PatchMatch_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + cs_size=dict(argstr='-cs %i', + ), + database_file=dict(argstr='-db %s', + mandatory=True, + position=3, + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-i %s', + mandatory=True, + position=1, + ), + it_num=dict(argstr='-it %i', + ), + mask_file=dict(argstr='-m %s', + mandatory=True, + position=2, + ), + match_num=dict(argstr='-match %i', + ), + out_file=dict(argstr='-o %s', + name_source=['in_file'], + name_template='%s_pm.nii.gz', + position=4, + ), + patch_size=dict(argstr='-size %i', + ), + pm_num=dict(argstr='-pm %i', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = PatchMatch.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_PatchMatch_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = PatchMatch.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py new file mode 100755 index 0000000000..b00d1f9a3c --- /dev/null +++ b/nipype/interfaces/tests/test_auto_SimpleInterface.py @@ -0,0 +1,16 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import SimpleInterface + + +def test_SimpleInterface_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + ) + inputs = SimpleInterface.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 34ec45cfa8..23c7a16fc6 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From c15ba6b4cda4b1cc45a56a8dfb80d17545c1a1ed Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 29 Nov 2017 05:11:32 -0500 Subject: [PATCH 02/10] Revert "Extended MRtrix3 interface" This reverts commit bb9f5b470defe5a029f40bb47239cde918aea8fd. --- doc/users/config_file.rst | 8 +-- doc/users/plugins.rst | 4 +- nipype/algorithms/tests/test_auto_CompCor.py | 53 ---------------- nipype/algorithms/tests/test_auto_ErrorMap.py | 35 ----------- nipype/algorithms/tests/test_auto_Overlap.py | 47 --------------- nipype/algorithms/tests/test_auto_TSNR.py | 43 ------------- nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/afni/preprocess.py | 2 +- .../afni/tests/test_auto_TCatSubBrick.py | 48 --------------- nipype/interfaces/afni/utils.py | 2 +- nipype/interfaces/ants/resampling.py | 2 +- .../interfaces/ants/tests/test_resampling.py | 4 +- nipype/interfaces/cmtk/tests/test_nbs.py | 4 +- nipype/interfaces/niftyfit/asl.py | 2 +- .../niftyseg/tests/test_auto_PatchMatch.py | 60 ------------------- .../tests/test_auto_SimpleInterface.py | 16 ----- nipype/pipeline/engine/tests/test_utils.py | 2 +- 17 files changed, 16 insertions(+), 318 deletions(-) delete mode 100755 nipype/algorithms/tests/test_auto_CompCor.py delete mode 100755 nipype/algorithms/tests/test_auto_ErrorMap.py delete mode 100755 nipype/algorithms/tests/test_auto_Overlap.py delete mode 100755 nipype/algorithms/tests/test_auto_TSNR.py delete mode 100755 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py delete mode 100755 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py delete mode 100755 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 7c10a381c8..b196047e97 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index e655e5f6db..501e7aa1d6 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_auto_CompCor.py b/nipype/algorithms/tests/test_auto_CompCor.py deleted file mode 100755 index 34dacaf4d3..0000000000 --- a/nipype/algorithms/tests/test_auto_CompCor.py +++ /dev/null @@ -1,53 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..confounds import CompCor - - -def test_CompCor_inputs(): - input_map = dict(components_file=dict(usedefault=True, - ), - header_prefix=dict(), - high_pass_cutoff=dict(usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - ignore_initial_volumes=dict(usedefault=True, - ), - mask_files=dict(), - mask_index=dict(requires=['mask_files'], - xor=['merge_method'], - ), - merge_method=dict(requires=['mask_files'], - xor=['mask_index'], - ), - num_components=dict(usedefault=True, - ), - pre_filter=dict(usedefault=True, - ), - realigned_file=dict(mandatory=True, - ), - regress_poly_degree=dict(usedefault=True, - ), - repetition_time=dict(), - save_pre_filter=dict(), - use_regress_poly=dict(deprecated='0.15.0', - new_name='pre_filter', - ), - ) - inputs = CompCor.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_CompCor_outputs(): - output_map = dict(components_file=dict(), - pre_filter_file=dict(), - ) - outputs = CompCor.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py deleted file mode 100755 index f3d19c5690..0000000000 --- a/nipype/algorithms/tests/test_auto_ErrorMap.py +++ /dev/null @@ -1,35 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..metrics import ErrorMap - - -def test_ErrorMap_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_ref=dict(mandatory=True, - ), - in_tst=dict(mandatory=True, - ), - mask=dict(), - metric=dict(mandatory=True, - usedefault=True, - ), - out_map=dict(), - ) - inputs = ErrorMap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_ErrorMap_outputs(): - output_map = dict(distance=dict(), - out_map=dict(), - ) - outputs = ErrorMap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py deleted file mode 100755 index dcabbec296..0000000000 --- a/nipype/algorithms/tests/test_auto_Overlap.py +++ /dev/null @@ -1,47 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import Overlap - - -def test_Overlap_inputs(): - input_map = dict(bg_overlap=dict(mandatory=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - mask_volume=dict(), - out_file=dict(usedefault=True, - ), - vol_units=dict(mandatory=True, - usedefault=True, - ), - volume1=dict(mandatory=True, - ), - volume2=dict(mandatory=True, - ), - weighting=dict(usedefault=True, - ), - ) - inputs = Overlap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Overlap_outputs(): - output_map = dict(dice=dict(), - diff_file=dict(), - jaccard=dict(), - labels=dict(), - roi_di=dict(), - roi_ji=dict(), - roi_voldiff=dict(), - volume_difference=dict(), - ) - outputs = Overlap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_TSNR.py b/nipype/algorithms/tests/test_auto_TSNR.py deleted file mode 100755 index d906d39e3f..0000000000 --- a/nipype/algorithms/tests/test_auto_TSNR.py +++ /dev/null @@ -1,43 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import TSNR - - -def test_TSNR_inputs(): - input_map = dict(detrended_file=dict(hash_files=False, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(mandatory=True, - ), - mean_file=dict(hash_files=False, - usedefault=True, - ), - regress_poly=dict(), - stddev_file=dict(hash_files=False, - usedefault=True, - ), - tsnr_file=dict(hash_files=False, - usedefault=True, - ), - ) - inputs = TSNR.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_TSNR_outputs(): - output_map = dict(detrended_file=dict(), - mean_file=dict(), - stddev_file=dict(), - tsnr_file=dict(), - ) - outputs = TSNR.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index d5fbc56825..9d510dee2b 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 3d7d47c673..c96616273d 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -3490,7 +3490,7 @@ class Qwarp(AFNICommand): >>> qwarp3.inputs.base_file = 'mni.nii' >>> qwarp3.inputs.allineate = True >>> qwarp3.inputs.allineate_opts = '-cose lpa -verb' - >>> qwarp3.cmdline # doctest: +ALLOW_UNICODE + >>> qwarp3.cmdline "3dQwarp -allineate -allineate_opts '-cose lpa -verb' -base mni.nii -source structural.nii -prefix structural_QW" >>> res3 = qwarp3.run() # doctest: +SKIP """ _cmd = '3dQwarp' diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py deleted file mode 100755 index da3b0fb383..0000000000 --- a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py +++ /dev/null @@ -1,48 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..utils import TCatSubBrick - - -def test_TCatSubBrick_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_files=dict(argstr='%s%s ...', - copyfile=False, - mandatory=True, - position=-1, - ), - num_threads=dict(nohash=True, - usedefault=True, - ), - out_file=dict(argstr='-prefix %s', - genfile=True, - ), - outputtype=dict(), - rlt=dict(argstr='-rlt%s', - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = TCatSubBrick.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_TCatSubBrick_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = TCatSubBrick.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index e492b39d47..242b5077ee 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1674,7 +1674,7 @@ class NwarpCat(AFNICommand): >>> nwarpcat = afni.NwarpCat() >>> nwarpcat.inputs.in_files = ['Q25_warp+tlrc.HEAD', ('IDENT', 'structural.nii')] >>> nwarpcat.inputs.out_file = 'Fred_total_WARP' - >>> nwarpcat.cmdline # doctest: +ALLOW_UNICODE + >>> nwarpcat.cmdline "3dNwarpCat -prefix Fred_total_WARP Q25_warp+tlrc.HEAD 'IDENT(structural.nii)'" >>> res = nwarpcat.run() # doctest: +SKIP diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index e268cb43e2..3ed60a51b1 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -75,7 +75,7 @@ class WarpTimeSeriesImageMultiTransform(ANTSCommand): >>> wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' >>> wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] >>> wtsimt.inputs.invert_affine = [1] # # this will invert the 1st Affine file: ants_Affine.txt - >>> wtsimt.cmdline # doctest: +ALLOW_UNICODE + >>> wtsimt.cmdline 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii -R ants_deformed.nii.gz ants_Warp.nii.gz \ -i ants_Affine.txt' """ diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 509ebfe844..22dc4446e9 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 03a7aa8619..0516390b02 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 8f95a48192..366f9a6eca 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py deleted file mode 100755 index 635eff1c9b..0000000000 --- a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py +++ /dev/null @@ -1,60 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..patchmatch import PatchMatch - - -def test_PatchMatch_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - cs_size=dict(argstr='-cs %i', - ), - database_file=dict(argstr='-db %s', - mandatory=True, - position=3, - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-i %s', - mandatory=True, - position=1, - ), - it_num=dict(argstr='-it %i', - ), - mask_file=dict(argstr='-m %s', - mandatory=True, - position=2, - ), - match_num=dict(argstr='-match %i', - ), - out_file=dict(argstr='-o %s', - name_source=['in_file'], - name_template='%s_pm.nii.gz', - position=4, - ), - patch_size=dict(argstr='-size %i', - ), - pm_num=dict(argstr='-pm %i', - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = PatchMatch.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_PatchMatch_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = PatchMatch.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py deleted file mode 100755 index b00d1f9a3c..0000000000 --- a/nipype/interfaces/tests/test_auto_SimpleInterface.py +++ /dev/null @@ -1,16 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..base import SimpleInterface - - -def test_SimpleInterface_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - ) - inputs = SimpleInterface.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 23c7a16fc6..34ec45cfa8 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From 248e589ec04f476c8e5c1fbc1878f828aa011601 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 29 Nov 2017 08:12:59 -0500 Subject: [PATCH 03/10] Updated MRtrix3 interfaces --- nipype/interfaces/mrtrix3/__init__.py | 6 +- nipype/interfaces/mrtrix3/preprocess.py | 105 +------------- nipype/interfaces/mrtrix3/reconst.py | 136 +++--------------- .../mrtrix3/tests/test_auto_DWI2FOD.py | 81 ----------- .../mrtrix3/tests/test_auto_DWI2Response.py | 75 ---------- .../mrtrix3/tests/test_auto_EstimateFOD.py | 59 +++++--- .../mrtrix3/tests/test_auto_Generate5ttFSL.py | 45 ------ .../mrtrix3/tests/test_auto_ResponseSD.py | 53 ++++--- nipype/interfaces/mrtrix3/utils.py | 49 +------ 9 files changed, 89 insertions(+), 520 deletions(-) delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py diff --git a/nipype/interfaces/mrtrix3/__init__.py b/nipype/interfaces/mrtrix3/__init__.py index 81749386f5..53bc8f5f53 100644 --- a/nipype/interfaces/mrtrix3/__init__.py +++ b/nipype/interfaces/mrtrix3/__init__.py @@ -3,9 +3,9 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -from .utils import (Mesh2PVE, Generate5tt, Generate5ttFSL, BrainMask, TensorMetrics, +from .utils import (Mesh2PVE, Generate5tt, BrainMask, TensorMetrics, ComputeTDI, TCK2VTK, MRMath, MRConvert, DWIExtract) -from .preprocess import DWI2Response, ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST +from .preprocess import ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST from .tracking import Tractography -from .reconst import DWI2FOD, FitTensor, EstimateFOD +from .reconst import FitTensor, EstimateFOD from .connectivity import LabelConfig, BuildConnectome diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 1159e89e7a..68be18a42c 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -21,7 +21,7 @@ from .base import MRTrix3BaseInputSpec, MRTrix3Base -class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): +class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, mandatory=True, desc='response estimation algorithm (multi-tissue)') dwi_file = File(exists=True, argstr='%s', position=-5, @@ -37,13 +37,13 @@ class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): desc='maximum harmonic degree of response function') -class DWI2ResponseOutputSpec(TraitedSpec): +class ResponseSDOutputSpec(TraitedSpec): wm_file = File(argstr='%s', desc='output WM response text file') gm_file = File(argstr='%s', desc='output GM response text file') csf_file = File(argstr='%s', desc='output CSF response text file') -class DWI2Response(MRTrix3Base): +class ResponseSD(MRTrix3Base): """ Estimate response function(s) for spherical deconvolution using the specified algorithm. @@ -52,7 +52,7 @@ class DWI2Response(MRTrix3Base): ------- >>> import nipype.interfaces.mrtrix3 as mrt - >>> resp = mrt.DWI2Response() + >>> resp = mrt.ResponseSD() >>> resp.inputs.dwi_file = 'dwi.mif' >>> resp.inputs.algorithm = 'tournier' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') @@ -62,8 +62,8 @@ class DWI2Response(MRTrix3Base): """ _cmd = 'dwi2response' - input_spec = DWI2ResponseInputSpec - output_spec = DWI2ResponseOutputSpec + input_spec = ResponseSDInputSpec + output_spec = ResponseSDOutputSpec def _list_outputs(self): outputs = self.output_spec().get() @@ -75,99 +75,6 @@ def _list_outputs(self): return outputs -class ResponseSDInputSpec(MRTrix3BaseInputSpec): - in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, - desc='input diffusion weighted images') - - out_file = File( - 'response.txt', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc='output file containing SH coefficients') - - # DW Shell selection options - shell = traits.List(traits.Float, sep=',', argstr='-shell %s', - desc='specify one or more dw gradient shells') - in_mask = File(exists=True, argstr='-mask %s', - desc='provide initial mask image') - max_sh = traits.Int(8, argstr='-lmax %d', - desc='maximum harmonic degree of response function') - out_sf = File('sf_mask.nii.gz', argstr='-sf %s', - desc='write a mask containing single-fibre voxels') - test_all = traits.Bool(False, argstr='-test_all', - desc='re-test all voxels at every iteration') - - # Optimization - iterations = traits.Int(0, argstr='-max_iters %d', - desc='maximum number of iterations per pass') - max_change = traits.Float( - argstr='-max_change %f', - desc=('maximum percentile change in any response function coefficient;' - ' if no individual coefficient changes by more than this ' - 'fraction, the algorithm is terminated.')) - - # Thresholds - vol_ratio = traits.Float( - .15, argstr='-volume_ratio %f', - desc=('maximal volume ratio between the sum of all other positive' - ' lobes in the voxel and the largest FOD lobe')) - disp_mult = traits.Float( - 1., argstr='-dispersion_multiplier %f', - desc=('dispersion of FOD lobe must not exceed some threshold as ' - 'determined by this multiplier and the FOD dispersion in other ' - 'single-fibre voxels. The threshold is: (mean + (multiplier * ' - '(mean - min))); default = 1.0. Criterion is only applied in ' - 'second pass of RF estimation.')) - int_mult = traits.Float( - 2., argstr='-integral_multiplier %f', - desc=('integral of FOD lobe must not be outside some range as ' - 'determined by this multiplier and FOD lobe integral in other' - ' single-fibre voxels. The range is: (mean +- (multiplier * ' - 'stdev)); default = 2.0. Criterion is only applied in second ' - 'pass of RF estimation.')) - - -class ResponseSDOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='the output response file') - out_sf = File(desc=('mask containing single-fibre voxels')) - - -class ResponseSD(MRTrix3Base): - - """ - Generate an appropriate response function from the image data for - spherical deconvolution. (previous MRTrix releases) - - .. [1] Tax, C. M.; Jeurissen, B.; Vos, S. B.; Viergever, M. A. and - Leemans, A., Recursive calibration of the fiber response function - for spherical deconvolution of diffusion MRI data. NeuroImage, - 2014, 86, 67-80 - - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> resp = mrt.ResponseSD() - >>> resp.inputs.in_file = 'dwi.mif' - >>> resp.inputs.in_mask = 'mask.nii.gz' - >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') - >>> resp.cmdline # doctest: +ELLIPSIS - 'dwi2response -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt' - >>> resp.run() # doctest: +SKIP - """ - - _cmd = 'dwi2response' - input_spec = ResponseSDInputSpec - output_spec = ResponseSDOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) - - if isdefined(self.inputs.out_sf): - outputs['out_sf'] = op.abspath(self.inputs.out_sf) - return outputs - - class ACTPrepareFSLInputSpec(CommandLineInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='input anatomical image') diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index b8f2ffef63..a5ce55b506 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -73,7 +73,7 @@ def _list_outputs(self): return outputs -class DWI2FODInputSpec(MRTrix3BaseInputSpec): +class EstimateFODInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, mandatory=True, desc='FOD algorithm') dwi_file = File(exists=True, argstr='%s', position=-7, @@ -88,150 +88,41 @@ class DWI2FODInputSpec(MRTrix3BaseInputSpec): csf_odf = File('csf.mif', argstr='%s', position=-1, desc='output CSF ODF') mask_file = File(exists=True, argstr='-mask %s', desc='mask image') - -class DWI2FODOutputSpec(TraitedSpec): - wm_odf = File(argstr='%s', desc='output WM ODF') - gm_odf = File(argstr='%s', desc='output GM ODF') - csf_odf = File(argstr='%s', desc='output CSF ODF') - - -class DWI2FOD(MRTrix3Base): - - """ - Estimate fibre orientation distributions from diffusion data using spherical deconvolution - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> fod = mrt.DWI2FOD() - >>> fod.inputs.algorithm = 'csd' - >>> fod.inputs.dwi_file = 'dwi.mif' - >>> fod.inputs.wm_txt = 'wm.txt' - >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') - >>> fod.cmdline # doctest: +ELLIPSIS - 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' - >>> fod.run() # doctest: +SKIP - """ - - _cmd = 'dwi2fod' - input_spec = DWI2FODInputSpec - output_spec = DWI2FODOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) - if self.inputs.gm_odf!=Undefined: - outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) - if self.inputs.csf_odf!=Undefined: - outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) - return outputs - - -class EstimateFODInputSpec(MRTrix3BaseInputSpec): - in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, - desc='input diffusion weighted images') - response = File( - exists=True, argstr='%s', mandatory=True, position=-2, - desc=('a text file containing the diffusion-weighted signal response ' - 'function coefficients for a single fibre population')) - out_file = File( - 'fods.mif', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc=('the output spherical harmonics coefficients' - ' image')) - # DW Shell selection options shell = traits.List(traits.Float, sep=',', argstr='-shell %s', desc='specify one or more dw gradient shells') - - # Spherical deconvolution options max_sh = traits.Int(8, argstr='-lmax %d', desc='maximum harmonic degree of response function') - in_mask = File(exists=True, argstr='-mask %s', - desc='provide initial mask image') in_dirs = File( exists=True, argstr='-directions %s', desc=('specify the directions over which to apply the non-negativity ' 'constraint (by default, the built-in 300 direction set is ' 'used). These should be supplied as a text file containing the ' '[ az el ] pairs for the directions.')) - sh_filter = File( - exists=True, argstr='-filter %s', - desc=('the linear frequency filtering parameters used for the initial ' - 'linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). ' - 'These should be supplied as a text file containing the ' - 'filtering coefficients for each even harmonic order.')) - - neg_lambda = traits.Float( - 1.0, argstr='-neg_lambda %f', - desc=('the regularisation parameter lambda that controls the strength' - ' of the non-negativity constraint')) - thres = traits.Float( - 0.0, argstr='-threshold %f', - desc=('the threshold below which the amplitude of the FOD is assumed ' - 'to be zero, expressed as an absolute amplitude')) - - n_iter = traits.Int( - 50, argstr='-niter %d', desc=('the maximum number of iterations ' - 'to perform for each voxel')) class EstimateFODOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='the output response file') + wm_odf = File(argstr='%s', desc='output WM ODF') + gm_odf = File(argstr='%s', desc='output GM ODF') + csf_odf = File(argstr='%s', desc='output CSF ODF') class EstimateFOD(MRTrix3Base): """ - Convert diffusion-weighted images to tensor images - (previous MRTrix releases) - - Note that this program makes use of implied symmetries in the diffusion - profile. First, the fact the signal attenuation profile is real implies - that it has conjugate symmetry, i.e. Y(l,-m) = Y(l,m)* (where * denotes - the complex conjugate). Second, the diffusion profile should be - antipodally symmetric (i.e. S(x) = S(-x)), implying that all odd l - components should be zero. Therefore, this program only computes the even - elements. - - Note that the spherical harmonics equations used here differ slightly from - those conventionally used, in that the (-1)^m factor has been omitted. - This should be taken into account in all subsequent calculations. - The spherical harmonic coefficients are stored as follows. First, since - the signal attenuation profile is real, it has conjugate symmetry, i.e. - Y(l,-m) = Y(l,m)* (where * denotes the complex conjugate). Second, the - diffusion profile should be antipodally symmetric (i.e. S(x) = S(-x)), - implying that all odd l components should be zero. Therefore, only the - even elements are computed. - - Note that the spherical harmonics equations used here differ slightly from - those conventionally used, in that the (-1)^m factor has been omitted. - This should be taken into account in all subsequent calculations. - Each volume in the output image corresponds to a different spherical - harmonic component. Each volume will correspond to the following: - - volume 0: l = 0, m = 0 - volume 1: l = 2, m = -2 (imaginary part of m=2 SH) - volume 2: l = 2, m = -1 (imaginary part of m=1 SH) - volume 3: l = 2, m = 0 - volume 4: l = 2, m = 1 (real part of m=1 SH) - volume 5: l = 2, m = 2 (real part of m=2 SH) - etc... - - + Estimate fibre orientation distributions from diffusion data using spherical deconvolution Example ------- >>> import nipype.interfaces.mrtrix3 as mrt >>> fod = mrt.EstimateFOD() - >>> fod.inputs.in_file = 'dwi.mif' - >>> fod.inputs.response = 'response.txt' - >>> fod.inputs.in_mask = 'mask.nii.gz' + >>> fod.inputs.algorithm = 'csd' + >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.wm_txt = 'wm.txt' >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') >>> fod.cmdline # doctest: +ELLIPSIS - 'dwi2fod -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt\ - fods.mif' + 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' >>> fod.run() # doctest: +SKIP """ @@ -241,5 +132,12 @@ class EstimateFOD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) + outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) + if self.inputs.gm_odf!=Undefined: + outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) + if self.inputs.csf_odf!=Undefined: + outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) return outputs + + + diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py deleted file mode 100755 index 9501fd656b..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py +++ /dev/null @@ -1,81 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..reconst import DWI2FOD - - -def test_DWI2FOD_inputs(): - input_map = dict(algorithm=dict(argstr='%s', - mandatory=True, - position=-8, - ), - args=dict(argstr='%s', - ), - bval_scale=dict(argstr='-bvalue_scaling %s', - ), - csf_odf=dict(argstr='%s', - position=-1, - ), - csf_txt=dict(argstr='%s', - position=-2, - ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-7, - ), - environ=dict(nohash=True, - usedefault=True, - ), - gm_odf=dict(argstr='%s', - position=-3, - ), - gm_txt=dict(argstr='%s', - position=-4, - ), - grad_file=dict(argstr='-grad %s', - ), - grad_fsl=dict(argstr='-fslgrad %s %s', - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_bval=dict(), - in_bvec=dict(argstr='-fslgrad %s %s', - ), - mask_file=dict(argstr='-mask %s', - ), - nthreads=dict(argstr='-nthreads %d', - nohash=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - wm_odf=dict(argstr='%s', - mandatory=True, - position=-5, - usedefault=True, - ), - wm_txt=dict(argstr='%s', - mandatory=True, - position=-6, - ), - ) - inputs = DWI2FOD.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_DWI2FOD_outputs(): - output_map = dict(csf_odf=dict(argstr='%s', - ), - gm_odf=dict(argstr='%s', - ), - wm_odf=dict(argstr='%s', - ), - ) - outputs = DWI2FOD.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py deleted file mode 100755 index 5b0836f79b..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py +++ /dev/null @@ -1,75 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..preprocess import DWI2Response - - -def test_DWI2Response_inputs(): - input_map = dict(algorithm=dict(argstr='%s', - mandatory=True, - position=-6, - ), - args=dict(argstr='%s', - ), - bval_scale=dict(argstr='-bvalue_scaling %s', - ), - csf_file=dict(argstr='%s', - position=-1, - ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-5, - ), - environ=dict(nohash=True, - usedefault=True, - ), - gm_file=dict(argstr='%s', - position=-2, - ), - grad_file=dict(argstr='-grad %s', - ), - grad_fsl=dict(argstr='-fslgrad %s %s', - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_bval=dict(), - in_bvec=dict(argstr='-fslgrad %s %s', - ), - in_mask=dict(argstr='-mask %s', - ), - max_sh=dict(argstr='-lmax %d', - ), - mtt_file=dict(argstr='%s', - position=-4, - ), - nthreads=dict(argstr='-nthreads %d', - nohash=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - wm_file=dict(argstr='%s', - position=-3, - usedefault=True, - ), - ) - inputs = DWI2Response.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_DWI2Response_outputs(): - output_map = dict(csf_file=dict(argstr='%s', - ), - gm_file=dict(argstr='%s', - ), - wm_file=dict(argstr='%s', - ), - ) - outputs = DWI2Response.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py index f645703bba..98f59fbc7a 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py @@ -4,13 +4,33 @@ def test_EstimateFOD_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-8, + ), + args=dict(argstr='%s', ), bval_scale=dict(argstr='-bvalue_scaling %s', ), + csf_odf=dict(argstr='%s', + position=-1, + ), + csf_txt=dict(argstr='%s', + position=-2, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), environ=dict(nohash=True, usedefault=True, ), + gm_odf=dict(argstr='%s', + position=-3, + ), + gm_txt=dict(argstr='%s', + position=-4, + ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', @@ -23,39 +43,27 @@ def test_EstimateFOD_inputs(): ), in_dirs=dict(argstr='-directions %s', ), - in_file=dict(argstr='%s', - mandatory=True, - position=-3, - ), - in_mask=dict(argstr='-mask %s', + mask_file=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', ), - n_iter=dict(argstr='-niter %d', - ), - neg_lambda=dict(argstr='-neg_lambda %f', - ), nthreads=dict(argstr='-nthreads %d', nohash=True, ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - response=dict(argstr='%s', - mandatory=True, - position=-2, - ), - sh_filter=dict(argstr='-filter %s', - ), shell=dict(argstr='-shell %s', sep=',', ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), - thres=dict(argstr='-threshold %f', + wm_odf=dict(argstr='%s', + mandatory=True, + position=-5, + usedefault=True, + ), + wm_txt=dict(argstr='%s', + mandatory=True, + position=-6, ), ) inputs = EstimateFOD.input_spec() @@ -66,7 +74,12 @@ def test_EstimateFOD_inputs(): def test_EstimateFOD_outputs(): - output_map = dict(out_file=dict(), + output_map = dict(csf_odf=dict(argstr='%s', + ), + gm_odf=dict(argstr='%s', + ), + wm_odf=dict(argstr='%s', + ), ) outputs = EstimateFOD.output_spec() diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py deleted file mode 100755 index 97617fa2cc..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py +++ /dev/null @@ -1,45 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..utils import Generate5ttFSL - - -def test_Generate5ttFSL_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_fast=dict(argstr='%s', - mandatory=True, - position=-3, - ), - in_first=dict(argstr='%s', - position=-2, - ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = Generate5ttFSL.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Generate5ttFSL_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = Generate5ttFSL.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py index 4a4aeb153e..7bd633fe29 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py @@ -4,15 +4,27 @@ def test_ResponseSD_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-6, + ), + args=dict(argstr='%s', ), bval_scale=dict(argstr='-bvalue_scaling %s', ), - disp_mult=dict(argstr='-dispersion_multiplier %f', + csf_file=dict(argstr='%s', + position=-1, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-5, ), environ=dict(nohash=True, usedefault=True, ), + gm_file=dict(argstr='%s', + position=-2, + ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', @@ -23,39 +35,22 @@ def test_ResponseSD_inputs(): in_bval=dict(), in_bvec=dict(argstr='-fslgrad %s %s', ), - in_file=dict(argstr='%s', - mandatory=True, - position=-2, - ), in_mask=dict(argstr='-mask %s', ), - int_mult=dict(argstr='-integral_multiplier %f', - ), - iterations=dict(argstr='-max_iters %d', - ), - max_change=dict(argstr='-max_change %f', - ), max_sh=dict(argstr='-lmax %d', ), + mtt_file=dict(argstr='%s', + position=-4, + ), nthreads=dict(argstr='-nthreads %d', nohash=True, ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - out_sf=dict(argstr='-sf %s', - ), - shell=dict(argstr='-shell %s', - sep=',', - ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), - test_all=dict(argstr='-test_all', - ), - vol_ratio=dict(argstr='-volume_ratio %f', + wm_file=dict(argstr='%s', + position=-3, + usedefault=True, ), ) inputs = ResponseSD.input_spec() @@ -66,8 +61,12 @@ def test_ResponseSD_inputs(): def test_ResponseSD_outputs(): - output_map = dict(out_file=dict(), - out_sf=dict(), + output_map = dict(csf_file=dict(argstr='%s', + ), + gm_file=dict(argstr='%s', + ), + wm_file=dict(argstr='%s', + ), ) outputs = ResponseSD.output_spec() diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 18397823a7..b8bac5dadb 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -125,7 +125,7 @@ class Generate5tt(MRTrix3Base): """ Generate a 5TT image suitable for ACT using the selected algorithm - uhm + Example ------- @@ -150,53 +150,6 @@ def _list_outputs(self): return outputs -class Generate5ttFSLInputSpec(CommandLineInputSpec): - in_fast = InputMultiPath( - File(exists=True), argstr='%s', mandatory=True, position=-3, - desc='list of PVE images from FAST') - in_first = File( - exists=True, argstr='%s', position=-2, - desc='combined segmentation file from FIRST') - out_file = File( - 'act-5tt.mif', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc='name of output file') - - -class Generate5ttFSLOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='segmentation for ACT in 5tt format') - - -class Generate5ttFSL(CommandLine): - - """ - Concatenate segmentation results from FSL FAST and FIRST into the 5TT - format required for ACT (previous MRTrix releases) - - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> seg = mrt.Generate5ttFSL() - >>> seg.inputs.in_fast = ['tpm_00.nii.gz', - ... 'tpm_01.nii.gz', 'tpm_02.nii.gz'] - >>> seg.inputs.in_first = 'first_merged.nii.gz' - >>> seg.cmdline # doctest: +ELLIPSIS - '5ttgen tpm_00.nii.gz tpm_01.nii.gz tpm_02.nii.gz first_merged.nii.gz\ - act-5tt.mif' - >>> seg.run() # doctest: +SKIP - """ - - _cmd = '5ttgen' - input_spec = Generate5ttFSLInputSpec - output_spec = Generate5ttFSLOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) - return outputs - - class TensorMetricsInputSpec(CommandLineInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-1, desc='input DTI image') From b1355065be96bec2882e2972f5151be5eba50c92 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 12 Dec 2017 11:00:32 -0500 Subject: [PATCH 04/10] Fixed tests --- nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py | 3 ++- nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py | 7 ++----- nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py | 3 ++- nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py | 7 ++----- 4 files changed, 8 insertions(+), 12 deletions(-) mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py old mode 100755 new mode 100644 index 22e0890d2f..805b5b86b0 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py @@ -17,7 +17,8 @@ def test_DWIExtract_inputs(): ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py index 3cb2568bf2..cc98ff316e 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py @@ -15,15 +15,12 @@ def test_Generate5tt_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py old mode 100755 new mode 100644 index 5dec38ed52..c1778a9ef6 --- a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py @@ -21,7 +21,8 @@ def test_MRConvert_inputs(): ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py old mode 100755 new mode 100644 index ca871ce690..6b13903f0f --- a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py @@ -13,15 +13,12 @@ def test_MRMath_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), From bdb340d78aba55393c44200e0f1cb32299860d14 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 03:52:43 -0500 Subject: [PATCH 05/10] Removed trailing spaces --- doc/users/config_file.rst | 10 +++++----- doc/users/plugins.rst | 4 ++-- nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/ants/tests/test_resampling.py | 4 ++-- nipype/interfaces/cmtk/tests/test_nbs.py | 4 ++-- nipype/interfaces/niftyfit/asl.py | 2 +- nipype/pipeline/engine/tests/test_utils.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 060549b01e..279dc1aadd 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index 9d510dee2b..d5fbc56825 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 22dc4446e9..509ebfe844 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 0516390b02..03a7aa8619 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 366f9a6eca..8f95a48192 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 34ec45cfa8..23c7a16fc6 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From 1e1dcc0c10b58e14f9a9c4d8e8f66546ddae8c6b Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 04:01:49 -0500 Subject: [PATCH 06/10] Removed last trailing spaces --- doc/users/config_file.rst | 10 +++++----- doc/users/plugins.rst | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 279dc1aadd..060549b01e 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index e655e5f6db..501e7aa1d6 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: From e92e11296ccd4e1894ef835d431977bc67834955 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 04:04:58 -0500 Subject: [PATCH 07/10] Removed last trailing spaces --- doc/users/config_file.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 060549b01e..f53a2900db 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. From c3ccafe47abad8cf8974e11b387f448e507752c8 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 19 Dec 2017 11:54:26 -0500 Subject: [PATCH 08/10] Minor fixes (style) --- nipype/interfaces/mrtrix3/preprocess.py | 8 ++++---- nipype/interfaces/mrtrix3/reconst.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 0ef19d763b..0eedc3f449 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -23,7 +23,7 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, mandatory=True, desc='response estimation algorithm (multi-tissue)') - dwi_file = File(exists=True, argstr='%s', position=-5, + in_file = File(exists=True, argstr='%s', position=-5, mandatory=True, desc='input DWI image') mtt_file = File(argstr='%s', position=-4, desc='input 5tt image') wm_file = File('wm.txt', argstr='%s', position=-3, usedefault=True, @@ -52,7 +52,7 @@ class ResponseSD(MRTrix3Base): >>> import nipype.interfaces.mrtrix3 as mrt >>> resp = mrt.ResponseSD() - >>> resp.inputs.dwi_file = 'dwi.mif' + >>> resp.inputs.in_file = 'dwi.mif' >>> resp.inputs.algorithm = 'tournier' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') >>> resp.cmdline # doctest: +ELLIPSIS @@ -67,9 +67,9 @@ class ResponseSD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs['wm_file'] = op.abspath(self.inputs.wm_file) - if self.inputs.gm_file!=Undefined: + if self.inputs.gm_file != Undefined: outputs['gm_file'] = op.abspath(self.inputs.gm_file) - if self.inputs.csf_file!=Undefined: + if self.inputs.csf_file != Undefined: outputs['csf_file'] = op.abspath(self.inputs.csf_file) return outputs diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index a5ce55b506..f7ea4f01e4 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -76,7 +76,7 @@ def _list_outputs(self): class EstimateFODInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, mandatory=True, desc='FOD algorithm') - dwi_file = File(exists=True, argstr='%s', position=-7, + in_file = File(exists=True, argstr='%s', position=-7, mandatory=True, desc='input DWI image') wm_txt = File(argstr='%s', position=-6, mandatory=True, desc='WM response text file') @@ -118,7 +118,7 @@ class EstimateFOD(MRTrix3Base): >>> import nipype.interfaces.mrtrix3 as mrt >>> fod = mrt.EstimateFOD() >>> fod.inputs.algorithm = 'csd' - >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.in_file = 'dwi.mif' >>> fod.inputs.wm_txt = 'wm.txt' >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') >>> fod.cmdline # doctest: +ELLIPSIS @@ -133,9 +133,9 @@ class EstimateFOD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) - if self.inputs.gm_odf!=Undefined: + if self.inputs.gm_odf != Undefined: outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) - if self.inputs.csf_odf!=Undefined: + if self.inputs.csf_odf != Undefined: outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) return outputs From 119730769173e4a97aa13cfddfea2daad3b06017 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 19 Dec 2017 12:01:44 -0500 Subject: [PATCH 09/10] Minor fixes (tests) --- nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py | 8 ++++---- nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py index b1836bd6d9..a62c21d989 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py @@ -18,10 +18,6 @@ def test_EstimateFOD_inputs(): csf_txt=dict(argstr='%s', position=-2, ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-7, - ), environ=dict(nohash=True, usedefault=True, ), @@ -44,6 +40,10 @@ def test_EstimateFOD_inputs(): ), in_dirs=dict(argstr='-directions %s', ), + in_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), mask_file=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py index 0917f5d6a3..ff93d1a8a9 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py @@ -15,10 +15,6 @@ def test_ResponseSD_inputs(): csf_file=dict(argstr='%s', position=-1, ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-5, - ), environ=dict(nohash=True, usedefault=True, ), @@ -36,6 +32,10 @@ def test_ResponseSD_inputs(): in_bval=dict(), in_bvec=dict(argstr='-fslgrad %s %s', ), + in_file=dict(argstr='%s', + mandatory=True, + position=-5, + ), in_mask=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', From c31d7cd09d176224e9b5407a93bb1a73eab85190 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Mon, 8 Jan 2018 11:48:08 -0500 Subject: [PATCH 10/10] Minor fix (test) --- .../afni/tests/test_auto_TCatSubBrick.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py new file mode 100644 index 0000000000..58fc2108e3 --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -0,0 +1,49 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TCatSubBrick + + +def test_TCatSubBrick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_files=dict(argstr='%s%s ...', + copyfile=False, + mandatory=True, + position=-1, + ), + num_threads=dict(nohash=True, + usedefault=True, + ), + out_file=dict(argstr='-prefix %s', + genfile=True, + ), + outputtype=dict(), + rlt=dict(argstr='-rlt%s', + position=1, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = TCatSubBrick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TCatSubBrick_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TCatSubBrick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value