diff --git a/CHANGES b/CHANGES index 15ef8b250c..8cb0ca28b3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Next release ============ +* ENH: Updated Camino tracking interfaces, which can now use FSL bedpostx output. + New options also include choice of tracker, interpolator, stepsize and + curveinterval for angle threshold (https://github.com/nipy/nipype/pull/1029) * FIX: Interfaces redirecting X crashed if $DISPLAY not defined (https://github.com/nipy/nipype/pull/1027) * FIX: Bug crashed 'make api' (https://github.com/nipy/nipype/pull/1026) * ENH: Updated antsIntroduction to handle RA and RI registrations (https://github.com/nipy/nipype/pull/1009) diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py new file mode 100644 index 0000000000..507b826812 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_Overlap.py @@ -0,0 +1,46 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from nipype.testing import assert_equal +from nipype.algorithms.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 input_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, 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 output_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(outputs.traits()[key], metakey), value + diff --git a/nipype/interfaces/camino/__init__.py b/nipype/interfaces/camino/__init__.py index ff213e777f..ec8a9f4c8e 100644 --- a/nipype/interfaces/camino/__init__.py +++ b/nipype/interfaces/camino/__init__.py @@ -9,6 +9,7 @@ Shredder) from .dti import (DTIFit, ModelFit, DTLUTGen, PicoPDFs, Track, TrackPICo, TrackBayesDirac, TrackDT, TrackBallStick, TrackBootstrap, + TrackBedpostxDeter, TrackBedpostxProba, ComputeFractionalAnisotropy, ComputeMeanDiffusivity, ComputeTensorTrace, ComputeEigensystem, DTMetric) from .calib import (SFPICOCalibData, SFLUTGen) diff --git a/nipype/interfaces/camino/dti.py b/nipype/interfaces/camino/dti.py index 9f134d9f01..1e6d42a288 100644 --- a/nipype/interfaces/camino/dti.py +++ b/nipype/interfaces/camino/dti.py @@ -7,7 +7,7 @@ """ from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, - TraitedSpec, File, StdOutCommandLine, + TraitedSpec, File, Directory, StdOutCommandLine, StdOutCommandLineInputSpec, isdefined, InputMultiPath) from nipype.utils.filemanip import split_filename @@ -393,47 +393,135 @@ def _gen_outfilename(self): return name + '_pdfs.Bdouble' class TrackInputSpec(CommandLineInputSpec): - in_file = File(exists=True, argstr='-inputfile %s', mandatory=True, position=1, desc='input data file') - - seed_file = File(exists=True, argstr='-seedfile %s', position=2, desc='seed file') - - inputmodel = traits.Enum('dt', 'multitensor', 'sfpeak', 'pico', 'repbs_dt', 'repbs_multitensor', 'ballstick', 'wildbs_dt', 'bayesdirac', 'bayesdirac_dt', - argstr='-inputmodel %s', desc='input model type', usedefault=True) - - inputdatatype = traits.Enum('float', 'double', argstr='-inputdatatype %s', desc='input file type') + in_file = File(exists=True, argstr='-inputfile %s', position=1, + desc='input data file') + + seed_file = File(exists=True, argstr='-seedfile %s', position=2, + desc='seed file') + + inputmodel = traits.Enum('dt', 'multitensor', 'sfpeak', 'pico', 'repbs_dt', + 'repbs_multitensor', 'ballstick', 'wildbs_dt', + 'bayesdirac', 'bayesdirac_dt','bedpostx_dyad', + 'bedpostx', argstr='-inputmodel %s', + desc='input model type', usedefault=True) + + tracker = traits.Enum('fact', 'euler', 'rk4', argstr='-tracker %s', + desc=("The tracking algorithm controls streamlines are " + "generated from the data. The choices are: " + "- FACT, which follows the local fibre orientation " + "in each voxel. No interpolation is used." + "- EULER, which uses a fixed step size along the " + "local fibre orientation. With nearest-neighbour " + "interpolation, this method may be very similar to " + "FACT, except that the step size is fixed, whereas " + "FACT steps extend to the boundary of the next voxel " + "(distance variable depending on the entry and exit " + "points to the voxel)." + "- RK4: Fourth-order Runge-Kutta method. The step " + "size is fixed, however the eventual direction of " + "the step is determined by taking and averaging a " + "series of partial steps."), usedefault=True) + + interpolator = traits.Enum('nn', 'prob_nn', 'linear', argstr='-interpolator %s', + desc=("The interpolation algorithm determines how " + "the fiber orientation(s) are defined at a given " + "continuous point within the input image. " + "Interpolators are only used when the tracking " + "algorithm is not FACT. The choices are: " + "- NN: Nearest-neighbour interpolation, just " + "uses the local voxel data directly." + "- PROB_NN: Probabilistic nearest-neighbor " + "interpolation, similar to the method pro- " + "posed by Behrens et al [Magnetic Resonance " + "in Medicine, 50:1077-1088, 2003]. The data " + "is not interpolated, but at each point we " + "randomly choose one of the 8 voxels sur- " + "rounding a point. The probability of choosing " + "a particular voxel is based on how close the " + "point is to the centre of that voxel." + "- LINEAR: Linear interpolation of the vector " + "field containing the principal directions at " + "each point.")) + + stepsize = traits.Float(argstr='-stepsize %f', requires=['tracker'], + desc=('Step size for EULER and RK4 tracking. ' + 'The default is 1mm.')) + + inputdatatype = traits.Enum('float', 'double', argstr='-inputdatatype %s', + desc='input file type') gzip = traits.Bool(argstr='-gzip', desc="save the output image in gzip format") maxcomponents = traits.Int(argstr='-maxcomponents %d', units='NA', - desc="The maximum number of tensor components in a voxel. This determines the size of the input file and does not say anything about the voxel classification. The default is 2 if the input model is multitensor and 1 if the input model is dt.") + desc=("The maximum number of tensor components in a " + "voxel. This determines the size of the input " + "file and does not say anything about the " + "voxel classification. The default is 2 if " + "the input model is multitensor and 1 if the " + "input model is dt.")) - numpds = traits.Int(argstr='-numpds %d', units='NA', desc="The maximum number of PDs in a voxel for input models sfpeak and pico. The default is 3 for input model sfpeak and 1 for input model pico. This option determines the size of the voxels in the input file and does not affect tracking. For tensor data, use the -maxcomponents option.") + numpds = traits.Int(argstr='-numpds %d', units='NA', + desc=("The maximum number of PDs in a voxel for input " + "models sfpeak and pico. The default is 3 for input " + "model sfpeak and 1 for input model pico. This option " + "determines the size of the voxels in the input file " + "and does not affect tracking. For tensor data, use " + "the -maxcomponents option.")) data_dims = traits.List(traits.Int, desc='data dimensions in voxels', - argstr='-datadims %s', minlen=3, maxlen=3, - units='voxels') + argstr='-datadims %s', minlen=3, maxlen=3, + units='voxels') voxel_dims = traits.List(traits.Float, desc='voxel dimensions in mm', - argstr='-voxeldims %s', minlen=3, maxlen=3, - units='mm') - - ipthresh = traits.Float(argstr='-ipthresh %f', desc='Curvature threshold for tracking, expressed as the minimum dot product between two streamline orientations calculated over the length of a voxel. If the dot product between the previous and current directions is less than this threshold, then the streamline terminates. The default setting will terminate fibres that curve by more than 80 degrees. Set this to -1.0 to disable curvature checking completely.') - - curvethresh = traits.Float(argstr='-curvethresh %f', desc='Curvature threshold for tracking, expressed as the maximum angle (in degrees) between between two streamline orientations calculated over the length of a voxel. If the angle is greater than this, then the streamline terminates.') - - anisthresh = traits.Float(argstr='-anisthresh %f', desc='Terminate fibres that enter a voxel with lower anisotropy than the threshold.') - - anisfile = File(argstr='-anisfile %s', exists=True, desc='File containing the anisotropy map. This is required to apply an anisotropy threshold with non tensor data. If the map issupplied it is always used, even in tensor data.') - - outputtracts = traits.Enum('float', 'double', 'oogl', argstr='-outputtracts %s', desc='output tract file type') - - out_file = File(argstr='-outputfile %s', - position= -1, genfile=True, - desc='output data file') - - output_root = File(exists=False, argstr='-outputroot %s', - position= -1, - desc='root directory for output') + argstr='-voxeldims %s', minlen=3, maxlen=3, + units='mm') + + ipthresh = traits.Float(argstr='-ipthresh %f', + desc=('Curvature threshold for tracking, expressed as ' + 'the minimum dot product between two streamline ' + 'orientations calculated over the length of a ' + 'voxel. If the dot product between the previous ' + 'and current directions is less than this ' + 'threshold, then the streamline terminates. The ' + 'default setting will terminate fibres that curve ' + 'by more than 80 degrees. Set this to -1.0 to ' + 'disable curvature checking completely.')) + + curvethresh = traits.Float(argstr='-curvethresh %f', + desc=('Curvature threshold for tracking, expressed ' + 'as the maximum angle (in degrees) between ' + 'between two streamline orientations ' + 'calculated over the length of a voxel. If ' + 'the angle is greater than this, then the ' + 'streamline terminates.')) + + curveinterval = traits.Float(argstr='-curveinterval %f', requires=['curvethresh'], + desc=('Interval over which the curvature threshold ' + 'should be evaluated, in mm. The default is ' + '5mm. When using the default curvature ' + 'threshold of 90 degrees, this means that ' + 'streamlines will terminate if they curve by ' + 'more than 90 degrees over a path length ' + 'of 5mm.')) + + anisthresh = traits.Float(argstr='-anisthresh %f', + desc=('Terminate fibres that enter a voxel with lower ' + 'anisotropy than the threshold.')) + + anisfile = File(argstr='-anisfile %s', exists=True, + desc=('File containing the anisotropy map. This is required to ' + 'apply an anisotropy threshold with non tensor data. If ' + 'the map issupplied it is always used, even in tensor ' + 'data.')) + + outputtracts = traits.Enum('float', 'double', 'oogl', argstr='-outputtracts %s', + desc='output tract file type') + + out_file = File(argstr='-outputfile %s', position= -1, genfile=True, + desc='output data file') + + output_root = File(exists=False, argstr='-outputroot %s', position= -1, + desc='root directory for output') class TrackOutputSpec(TraitedSpec): tracked = File(exists=True, desc='output file containing reconstructed tracts') @@ -471,7 +559,11 @@ def _gen_filename(self, name): return None def _gen_outfilename(self): - _, name , _ = split_filename(self.inputs.in_file) + # Currently in_file is only undefined for bedpostx input + if not isdefined(self.inputs.in_file): + name = 'bedpostx' + else: + _, name , _ = split_filename(self.inputs.in_file) return name + '_tracked' class TrackDT(Track): @@ -517,6 +609,93 @@ def __init__(self, command=None, **inputs): inputs["inputmodel"] = "pico" return super(TrackPICo, self).__init__(command, **inputs) +class TrackBedpostxDeterInputSpec(TrackInputSpec): + bedpostxdir = Directory(argstr='-bedpostxdir %s', mandatory=True, exists=True, + desc=('Directory containing bedpostx output')) + + min_vol_frac = traits.Float(argstr='-bedpostxminf %d', units='NA', + desc=("Zeros out compartments in bedpostx data " + "with a mean volume fraction f of less than " + "min_vol_frac. The default is 0.01.")) + +class TrackBedpostxDeter(Track): + """ + Data from FSL's bedpostx can be imported into Camino for deterministic tracking. + (Use TrackBedpostxProba for bedpostx probabilistic tractography.) + + The tracking is based on the vector images dyads1.nii.gz, ... , dyadsN.nii.gz, + where there are a maximum of N compartments (corresponding to each fiber + population) in each voxel. + + It also uses the N images mean_f1samples.nii.gz, ..., mean_fNsamples.nii.gz, + normalized such that the sum of all compartments is 1. Compartments where the + mean_f is less than a threshold are discarded and not used for tracking. + The default value is 0.01. This can be changed with the min_vol_frac option. + + Example + ------- + + >>> import nipype.interfaces.camino as cam + >>> track = cam.TrackBedpostxDeter() + >>> track.inputs.bedpostxdir = 'bedpostxout' + >>> track.inputs.seed_file = 'seed_mask.nii' + >>> track.run() # doctest: +SKIP + """ + + input_spec = TrackBedpostxDeterInputSpec + + def __init__(self, command=None, **inputs): + inputs["inputmodel"] = "bedpostx_dyad" + return super(TrackBedpostxDeter, self).__init__(command, **inputs) + +class TrackBedpostxProbaInputSpec(TrackInputSpec): + bedpostxdir = Directory(argstr='-bedpostxdir %s', mandatory=True, exists=True, + desc=('Directory containing bedpostx output')) + + min_vol_frac = traits.Float(argstr='-bedpostxminf %d', units='NA', + desc=("Zeros out compartments in bedpostx data " + "with a mean volume fraction f of less than " + "min_vol_frac. The default is 0.01.")) + + iterations = traits.Int(argstr='-iterations %d', units='NA', + desc=("Number of streamlines to generate at each " + "seed point. The default is 1.")) + +class TrackBedpostxProba(Track): + """ + Data from FSL's bedpostx can be imported into Camino for probabilistic tracking. + (Use TrackBedpostxDeter for bedpostx deterministic tractography.) + + The tracking uses the files merged_th1samples.nii.gz, merged_ph1samples.nii.gz, + ... , merged_thNsamples.nii.gz, merged_phNsamples.nii.gz where there are a + maximum of N compartments (corresponding to each fiber population) in each + voxel. These images contain M samples of theta and phi, the polar coordinates + describing the "stick" for each compartment. At each iteration, a random number + X between 1 and M is drawn and the Xth samples of theta and phi become the + principal directions in the voxel. + + It also uses the N images mean_f1samples.nii.gz, ..., mean_fNsamples.nii.gz, + normalized such that the sum of all compartments is 1. Compartments where the + mean_f is less than a threshold are discarded and not used for tracking. + The default value is 0.01. This can be changed with the min_vol_frac option. + + Example + ------- + + >>> import nipype.interfaces.camino as cam + >>> track = cam.TrackBedpostxProba() + >>> track.inputs.bedpostxdir = 'bedpostxout' + >>> track.inputs.seed_file = 'seed_mask.nii' + >>> track.inputs.iterations = 100 + >>> track.run() # doctest: +SKIP + """ + + input_spec = TrackBedpostxProbaInputSpec + + def __init__(self, command=None, **inputs): + inputs["inputmodel"] = "bedpostx_dyad" + return super(TrackBedpostxProba, self).__init__(command, **inputs) + class TrackBayesDiracInputSpec(TrackInputSpec): scheme_file = File(argstr='-schemefile %s', mandatory=True, exists=True, desc=('The scheme file corresponding to the data being ' diff --git a/nipype/interfaces/camino/tests/test_auto_Track.py b/nipype/interfaces/camino/tests/test_auto_Track.py index 4109e5caf2..f299212b46 100644 --- a/nipype/interfaces/camino/tests/test_auto_Track.py +++ b/nipype/interfaces/camino/tests/test_auto_Track.py @@ -9,6 +9,9 @@ def test_Track_inputs(): ), args=dict(argstr='%s', ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvethresh=dict(argstr='-curvethresh %f', ), data_dims=dict(argstr='-datadims %s', @@ -23,7 +26,6 @@ def test_Track_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -31,6 +33,8 @@ def test_Track_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), ipthresh=dict(argstr='-ipthresh %f', ), maxcomponents=dict(argstr='-maxcomponents %d', @@ -51,9 +55,15 @@ def test_Track_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ), diff --git a/nipype/interfaces/camino/tests/test_auto_TrackBallStick.py b/nipype/interfaces/camino/tests/test_auto_TrackBallStick.py index 55a14ba560..0f6cab47c6 100644 --- a/nipype/interfaces/camino/tests/test_auto_TrackBallStick.py +++ b/nipype/interfaces/camino/tests/test_auto_TrackBallStick.py @@ -9,6 +9,9 @@ def test_TrackBallStick_inputs(): ), args=dict(argstr='%s', ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvethresh=dict(argstr='-curvethresh %f', ), data_dims=dict(argstr='-datadims %s', @@ -23,7 +26,6 @@ def test_TrackBallStick_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -31,6 +33,8 @@ def test_TrackBallStick_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), ipthresh=dict(argstr='-ipthresh %f', ), maxcomponents=dict(argstr='-maxcomponents %d', @@ -51,9 +55,15 @@ def test_TrackBallStick_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ), diff --git a/nipype/interfaces/camino/tests/test_auto_TrackBayesDirac.py b/nipype/interfaces/camino/tests/test_auto_TrackBayesDirac.py index bd9eaa67b0..e1bebace58 100644 --- a/nipype/interfaces/camino/tests/test_auto_TrackBayesDirac.py +++ b/nipype/interfaces/camino/tests/test_auto_TrackBayesDirac.py @@ -9,6 +9,9 @@ def test_TrackBayesDirac_inputs(): ), args=dict(argstr='%s', ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvepriorg=dict(argstr='-curvepriorg %G', ), curvepriork=dict(argstr='-curvepriork %G', @@ -33,7 +36,6 @@ def test_TrackBayesDirac_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -41,6 +43,8 @@ def test_TrackBayesDirac_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), ipthresh=dict(argstr='-ipthresh %f', ), iterations=dict(argstr='-iterations %d', @@ -71,9 +75,15 @@ def test_TrackBayesDirac_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ), diff --git a/nipype/interfaces/camino/tests/test_auto_TrackBedpostxDeter.py b/nipype/interfaces/camino/tests/test_auto_TrackBedpostxDeter.py new file mode 100644 index 0000000000..4ed0112dcf --- /dev/null +++ b/nipype/interfaces/camino/tests/test_auto_TrackBedpostxDeter.py @@ -0,0 +1,91 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from nipype.testing import assert_equal +from nipype.interfaces.camino.dti import TrackBedpostxDeter + +def test_TrackBedpostxDeter_inputs(): + input_map = dict(anisfile=dict(argstr='-anisfile %s', + ), + anisthresh=dict(argstr='-anisthresh %f', + ), + args=dict(argstr='%s', + ), + bedpostxdir=dict(argstr='-bedpostxdir %s', + mandatory=True, + ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), + curvethresh=dict(argstr='-curvethresh %f', + ), + data_dims=dict(argstr='-datadims %s', + units='voxels', + ), + environ=dict(nohash=True, + usedefault=True, + ), + gzip=dict(argstr='-gzip', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-inputfile %s', + position=1, + ), + inputdatatype=dict(argstr='-inputdatatype %s', + ), + inputmodel=dict(argstr='-inputmodel %s', + usedefault=True, + ), + interpolator=dict(argstr='-interpolator %s', + ), + ipthresh=dict(argstr='-ipthresh %f', + ), + maxcomponents=dict(argstr='-maxcomponents %d', + units='NA', + ), + min_vol_frac=dict(argstr='-bedpostxminf %d', + units='NA', + ), + numpds=dict(argstr='-numpds %d', + units='NA', + ), + out_file=dict(argstr='-outputfile %s', + genfile=True, + position=-1, + ), + output_root=dict(argstr='-outputroot %s', + position=-1, + ), + outputtracts=dict(argstr='-outputtracts %s', + ), + seed_file=dict(argstr='-seedfile %s', + position=2, + ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), + terminal_output=dict(mandatory=True, + nohash=True, + ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), + voxel_dims=dict(argstr='-voxeldims %s', + units='mm', + ), + ) + inputs = TrackBedpostxDeter.input_spec() + + for key, metadata in input_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(inputs.traits()[key], metakey), value + +def test_TrackBedpostxDeter_outputs(): + output_map = dict(tracked=dict(), + ) + outputs = TrackBedpostxDeter.output_spec() + + for key, metadata in output_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(outputs.traits()[key], metakey), value + diff --git a/nipype/interfaces/camino/tests/test_auto_TrackBedpostxProba.py b/nipype/interfaces/camino/tests/test_auto_TrackBedpostxProba.py new file mode 100644 index 0000000000..f58253338d --- /dev/null +++ b/nipype/interfaces/camino/tests/test_auto_TrackBedpostxProba.py @@ -0,0 +1,94 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from nipype.testing import assert_equal +from nipype.interfaces.camino.dti import TrackBedpostxProba + +def test_TrackBedpostxProba_inputs(): + input_map = dict(anisfile=dict(argstr='-anisfile %s', + ), + anisthresh=dict(argstr='-anisthresh %f', + ), + args=dict(argstr='%s', + ), + bedpostxdir=dict(argstr='-bedpostxdir %s', + mandatory=True, + ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), + curvethresh=dict(argstr='-curvethresh %f', + ), + data_dims=dict(argstr='-datadims %s', + units='voxels', + ), + environ=dict(nohash=True, + usedefault=True, + ), + gzip=dict(argstr='-gzip', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-inputfile %s', + position=1, + ), + inputdatatype=dict(argstr='-inputdatatype %s', + ), + inputmodel=dict(argstr='-inputmodel %s', + usedefault=True, + ), + interpolator=dict(argstr='-interpolator %s', + ), + ipthresh=dict(argstr='-ipthresh %f', + ), + iterations=dict(argstr='-iterations %d', + units='NA', + ), + maxcomponents=dict(argstr='-maxcomponents %d', + units='NA', + ), + min_vol_frac=dict(argstr='-bedpostxminf %d', + units='NA', + ), + numpds=dict(argstr='-numpds %d', + units='NA', + ), + out_file=dict(argstr='-outputfile %s', + genfile=True, + position=-1, + ), + output_root=dict(argstr='-outputroot %s', + position=-1, + ), + outputtracts=dict(argstr='-outputtracts %s', + ), + seed_file=dict(argstr='-seedfile %s', + position=2, + ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), + terminal_output=dict(mandatory=True, + nohash=True, + ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), + voxel_dims=dict(argstr='-voxeldims %s', + units='mm', + ), + ) + inputs = TrackBedpostxProba.input_spec() + + for key, metadata in input_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(inputs.traits()[key], metakey), value + +def test_TrackBedpostxProba_outputs(): + output_map = dict(tracked=dict(), + ) + outputs = TrackBedpostxProba.output_spec() + + for key, metadata in output_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(outputs.traits()[key], metakey), value + diff --git a/nipype/interfaces/camino/tests/test_auto_TrackBootstrap.py b/nipype/interfaces/camino/tests/test_auto_TrackBootstrap.py index ce8d945667..9b5b0ae617 100644 --- a/nipype/interfaces/camino/tests/test_auto_TrackBootstrap.py +++ b/nipype/interfaces/camino/tests/test_auto_TrackBootstrap.py @@ -14,6 +14,9 @@ def test_TrackBootstrap_inputs(): bsdatafiles=dict(argstr='-bsdatafile %s', mandatory=True, ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvethresh=dict(argstr='-curvethresh %f', ), data_dims=dict(argstr='-datadims %s', @@ -28,7 +31,6 @@ def test_TrackBootstrap_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -36,6 +38,8 @@ def test_TrackBootstrap_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), inversion=dict(argstr='-inversion %s', ), ipthresh=dict(argstr='-ipthresh %f', @@ -64,9 +68,15 @@ def test_TrackBootstrap_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ), diff --git a/nipype/interfaces/camino/tests/test_auto_TrackDT.py b/nipype/interfaces/camino/tests/test_auto_TrackDT.py index ffb33f3e2c..7bad2d6d45 100644 --- a/nipype/interfaces/camino/tests/test_auto_TrackDT.py +++ b/nipype/interfaces/camino/tests/test_auto_TrackDT.py @@ -9,6 +9,9 @@ def test_TrackDT_inputs(): ), args=dict(argstr='%s', ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvethresh=dict(argstr='-curvethresh %f', ), data_dims=dict(argstr='-datadims %s', @@ -23,7 +26,6 @@ def test_TrackDT_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -31,6 +33,8 @@ def test_TrackDT_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), ipthresh=dict(argstr='-ipthresh %f', ), maxcomponents=dict(argstr='-maxcomponents %d', @@ -51,9 +55,15 @@ def test_TrackDT_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ), diff --git a/nipype/interfaces/camino/tests/test_auto_TrackPICo.py b/nipype/interfaces/camino/tests/test_auto_TrackPICo.py index 35049b1318..907d7e521f 100644 --- a/nipype/interfaces/camino/tests/test_auto_TrackPICo.py +++ b/nipype/interfaces/camino/tests/test_auto_TrackPICo.py @@ -9,6 +9,9 @@ def test_TrackPICo_inputs(): ), args=dict(argstr='%s', ), + curveinterval=dict(argstr='-curveinterval %f', + requires=['curvethresh'], + ), curvethresh=dict(argstr='-curvethresh %f', ), data_dims=dict(argstr='-datadims %s', @@ -23,7 +26,6 @@ def test_TrackPICo_inputs(): usedefault=True, ), in_file=dict(argstr='-inputfile %s', - mandatory=True, position=1, ), inputdatatype=dict(argstr='-inputdatatype %s', @@ -31,6 +33,8 @@ def test_TrackPICo_inputs(): inputmodel=dict(argstr='-inputmodel %s', usedefault=True, ), + interpolator=dict(argstr='-interpolator %s', + ), ipthresh=dict(argstr='-ipthresh %f', ), iterations=dict(argstr='-iterations %d', @@ -56,9 +60,15 @@ def test_TrackPICo_inputs(): seed_file=dict(argstr='-seedfile %s', position=2, ), + stepsize=dict(argstr='-stepsize %f', + requires=['tracker'], + ), terminal_output=dict(mandatory=True, nohash=True, ), + tracker=dict(argstr='-tracker %s', + usedefault=True, + ), voxel_dims=dict(argstr='-voxeldims %s', units='mm', ),