diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_TckSift2.py b/nipype/interfaces/mrtrix3/tests/test_auto_TckSift2.py new file mode 100644 index 0000000000..7ee92fa257 --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_TckSift2.py @@ -0,0 +1,50 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from ..utils import TckSift2 + + +def test_TckSift2_inputs(): + input_map = dict( + args=dict( + argstr="%s", + ), + environ=dict( + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=-3, + ), + in_fod=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=-2, + ), + out_weights=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=-1, + ), + ) + inputs = TckSift2.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_TckSift2_outputs(): + output_map = dict( + out_weights=dict( + extensions=None, + ), + ) + outputs = TckSift2.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 8a69232ecd..0a71e9c8f9 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -1,7 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- - import os.path as op from ...utils.filemanip import split_filename @@ -19,6 +18,43 @@ from .base import MRTrix3BaseInputSpec, MRTrix3Base +class TckSift2InputSpec(CommandLineInputSpec): + in_file = File(exists=True, argstr="%s", mandatory=True, position=-3, desc="input streamlines file") + in_fod = File(exists=True, argstr="%s", mandatory=True, position=-2, desc="input FOD file") + out_weights = File(argstr="%s", mandatory=True, position=-1, desc="output weights file") + + +class TckSift2OutputSpec(TraitedSpec): + out_weights = File(exists=True, desc="output weights file") + + +class TckSift2(CommandLine): + """ + Interface for MRTrix's tcksift2 command + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> tcksift2 = mrt.TckSift2() + >>> tcksift2.inputs.in_file = 'streamlines.tck' + >>> tcksift2.inputs.in_fod = 'fod.mif' + >>> tcksift2.inputs.out_weights = 'streamlines_weights.txt' + >>> tcksift2.cmdline + 'tcksift2 streamlines.tck fod.mif streamlines_weights.txt' + >>> tcksift2.run() # doctest: +SKIP + """ + + _cmd = 'tcksift2' + input_spec = TckSift2InputSpec + output_spec = TckSift2OutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs["out_weights"] = op.abspath(self.inputs.out_weights) + return outputs + + class BrainMaskInputSpec(MRTrix3BaseInputSpec): in_file = File( exists=True,