Skip to content

Commit aaa48be

Browse files
committed
Fixed tracking specs
1 parent 2bc9ef0 commit aaa48be

6 files changed

+73
-43
lines changed

CHANGES

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
Release 0.9.2 (January 31, 2014)
2-
===========
1+
Next Release
2+
============
33

44
* ENH: New ANTs interface: ApplyTransformsToPoints
5+
* FIX: MRTrix tracking algorithms were ignoring mask parameters.
6+
7+
Release 0.9.2 (January 31, 2014)
8+
============
59

610
* FIX: DataFinder was broken due to a typo
711
* FIX: Order of DataFinder outputs was not guaranteed, it's human sorted now

nipype/interfaces/mrtrix/tests/test_auto_DiffusionTensorStreamlineTrack.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def test_DiffusionTensorStreamlineTrack_inputs():
1616
usedefault=True,
1717
),
1818
exclude_file=dict(argstr='-exclude %s',
19-
position=2,
19+
xor=['exclude_file', 'exclude_spec'],
2020
),
21-
exclude_spec=dict(argstr='-seed %s',
21+
exclude_spec=dict(argstr='-exclude %s',
2222
position=2,
2323
sep=',',
2424
units='mm',
25+
xor=['exclude_file', 'exclude_spec'],
2526
),
2627
gradient_encoding_file=dict(argstr='-grad %s',
2728
mandatory=True,
@@ -35,12 +36,13 @@ def test_DiffusionTensorStreamlineTrack_inputs():
3536
position=-2,
3637
),
3738
include_file=dict(argstr='-include %s',
38-
position=2,
39+
xor=['include_file', 'include_spec'],
3940
),
40-
include_spec=dict(argstr='-seed %s',
41+
include_spec=dict(argstr='-include %s',
4142
position=2,
4243
sep=',',
4344
units='mm',
45+
xor=['include_file', 'include_spec'],
4446
),
4547
initial_cutoff_value=dict(argstr='-initcutoff %s',
4648
units='NA',
@@ -52,13 +54,14 @@ def test_DiffusionTensorStreamlineTrack_inputs():
5254
position=-3,
5355
usedefault=True,
5456
),
55-
mask_file=dict(argstr='-exclude %s',
56-
position=2,
57+
mask_file=dict(argstr='-mask %s',
58+
xor=['mask_file', 'mask_spec'],
5759
),
58-
mask_spec=dict(argstr='-seed %s',
60+
mask_spec=dict(argstr='-mask %s',
5961
position=2,
6062
sep=',',
6163
units='mm',
64+
xor=['mask_file', 'mask_spec'],
6265
),
6366
maximum_number_of_tracks=dict(argstr='-maxnum %d',
6467
),
@@ -78,12 +81,13 @@ def test_DiffusionTensorStreamlineTrack_inputs():
7881
position=-1,
7982
),
8083
seed_file=dict(argstr='-seed %s',
81-
position=2,
84+
xor=['seed_file', 'seed_spec'],
8285
),
8386
seed_spec=dict(argstr='-seed %s',
8487
position=2,
8588
sep=',',
8689
units='mm',
90+
xor=['seed_file', 'seed_spec'],
8791
),
8892
step_size=dict(argstr='-step %s',
8993
units='mm',

nipype/interfaces/mrtrix/tests/test_auto_ProbabilisticSphericallyDeconvolutedStreamlineTrack.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def test_ProbabilisticSphericallyDeconvolutedStreamlineTrack_inputs():
1616
usedefault=True,
1717
),
1818
exclude_file=dict(argstr='-exclude %s',
19-
position=2,
19+
xor=['exclude_file', 'exclude_spec'],
2020
),
21-
exclude_spec=dict(argstr='-seed %s',
21+
exclude_spec=dict(argstr='-exclude %s',
2222
position=2,
2323
sep=',',
2424
units='mm',
25+
xor=['exclude_file', 'exclude_spec'],
2526
),
2627
ignore_exception=dict(nohash=True,
2728
usedefault=True,
@@ -31,12 +32,13 @@ def test_ProbabilisticSphericallyDeconvolutedStreamlineTrack_inputs():
3132
position=-2,
3233
),
3334
include_file=dict(argstr='-include %s',
34-
position=2,
35+
xor=['include_file', 'include_spec'],
3536
),
36-
include_spec=dict(argstr='-seed %s',
37+
include_spec=dict(argstr='-include %s',
3738
position=2,
3839
sep=',',
3940
units='mm',
41+
xor=['include_file', 'include_spec'],
4042
),
4143
initial_cutoff_value=dict(argstr='-initcutoff %s',
4244
units='NA',
@@ -48,13 +50,14 @@ def test_ProbabilisticSphericallyDeconvolutedStreamlineTrack_inputs():
4850
position=-3,
4951
usedefault=True,
5052
),
51-
mask_file=dict(argstr='-exclude %s',
52-
position=2,
53+
mask_file=dict(argstr='-mask %s',
54+
xor=['mask_file', 'mask_spec'],
5355
),
54-
mask_spec=dict(argstr='-seed %s',
56+
mask_spec=dict(argstr='-mask %s',
5557
position=2,
5658
sep=',',
5759
units='mm',
60+
xor=['mask_file', 'mask_spec'],
5861
),
5962
maximum_number_of_tracks=dict(argstr='-maxnum %d',
6063
),
@@ -76,12 +79,13 @@ def test_ProbabilisticSphericallyDeconvolutedStreamlineTrack_inputs():
7679
position=-1,
7780
),
7881
seed_file=dict(argstr='-seed %s',
79-
position=2,
82+
xor=['seed_file', 'seed_spec'],
8083
),
8184
seed_spec=dict(argstr='-seed %s',
8285
position=2,
8386
sep=',',
8487
units='mm',
88+
xor=['seed_file', 'seed_spec'],
8589
),
8690
step_size=dict(argstr='-step %s',
8791
units='mm',

nipype/interfaces/mrtrix/tests/test_auto_SphericallyDeconvolutedStreamlineTrack.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def test_SphericallyDeconvolutedStreamlineTrack_inputs():
1616
usedefault=True,
1717
),
1818
exclude_file=dict(argstr='-exclude %s',
19-
position=2,
19+
xor=['exclude_file', 'exclude_spec'],
2020
),
21-
exclude_spec=dict(argstr='-seed %s',
21+
exclude_spec=dict(argstr='-exclude %s',
2222
position=2,
2323
sep=',',
2424
units='mm',
25+
xor=['exclude_file', 'exclude_spec'],
2526
),
2627
ignore_exception=dict(nohash=True,
2728
usedefault=True,
@@ -31,12 +32,13 @@ def test_SphericallyDeconvolutedStreamlineTrack_inputs():
3132
position=-2,
3233
),
3334
include_file=dict(argstr='-include %s',
34-
position=2,
35+
xor=['include_file', 'include_spec'],
3536
),
36-
include_spec=dict(argstr='-seed %s',
37+
include_spec=dict(argstr='-include %s',
3738
position=2,
3839
sep=',',
3940
units='mm',
41+
xor=['include_file', 'include_spec'],
4042
),
4143
initial_cutoff_value=dict(argstr='-initcutoff %s',
4244
units='NA',
@@ -48,13 +50,14 @@ def test_SphericallyDeconvolutedStreamlineTrack_inputs():
4850
position=-3,
4951
usedefault=True,
5052
),
51-
mask_file=dict(argstr='-exclude %s',
52-
position=2,
53+
mask_file=dict(argstr='-mask %s',
54+
xor=['mask_file', 'mask_spec'],
5355
),
54-
mask_spec=dict(argstr='-seed %s',
56+
mask_spec=dict(argstr='-mask %s',
5557
position=2,
5658
sep=',',
5759
units='mm',
60+
xor=['mask_file', 'mask_spec'],
5861
),
5962
maximum_number_of_tracks=dict(argstr='-maxnum %d',
6063
),
@@ -74,12 +77,13 @@ def test_SphericallyDeconvolutedStreamlineTrack_inputs():
7477
position=-1,
7578
),
7679
seed_file=dict(argstr='-seed %s',
77-
position=2,
80+
xor=['seed_file', 'seed_spec'],
7881
),
7982
seed_spec=dict(argstr='-seed %s',
8083
position=2,
8184
sep=',',
8285
units='mm',
86+
xor=['seed_file', 'seed_spec'],
8387
),
8488
step_size=dict(argstr='-step %s',
8589
units='mm',

nipype/interfaces/mrtrix/tests/test_auto_StreamlineTrack.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def test_StreamlineTrack_inputs():
1616
usedefault=True,
1717
),
1818
exclude_file=dict(argstr='-exclude %s',
19-
position=2,
19+
xor=['exclude_file', 'exclude_spec'],
2020
),
21-
exclude_spec=dict(argstr='-seed %s',
21+
exclude_spec=dict(argstr='-exclude %s',
2222
position=2,
2323
sep=',',
2424
units='mm',
25+
xor=['exclude_file', 'exclude_spec'],
2526
),
2627
ignore_exception=dict(nohash=True,
2728
usedefault=True,
@@ -31,12 +32,13 @@ def test_StreamlineTrack_inputs():
3132
position=-2,
3233
),
3334
include_file=dict(argstr='-include %s',
34-
position=2,
35+
xor=['include_file', 'include_spec'],
3536
),
36-
include_spec=dict(argstr='-seed %s',
37+
include_spec=dict(argstr='-include %s',
3738
position=2,
3839
sep=',',
3940
units='mm',
41+
xor=['include_file', 'include_spec'],
4042
),
4143
initial_cutoff_value=dict(argstr='-initcutoff %s',
4244
units='NA',
@@ -48,13 +50,14 @@ def test_StreamlineTrack_inputs():
4850
position=-3,
4951
usedefault=True,
5052
),
51-
mask_file=dict(argstr='-exclude %s',
52-
position=2,
53+
mask_file=dict(argstr='-mask %s',
54+
xor=['mask_file', 'mask_spec'],
5355
),
54-
mask_spec=dict(argstr='-seed %s',
56+
mask_spec=dict(argstr='-mask %s',
5557
position=2,
5658
sep=',',
5759
units='mm',
60+
xor=['mask_file', 'mask_spec'],
5861
),
5962
maximum_number_of_tracks=dict(argstr='-maxnum %d',
6063
),
@@ -74,12 +77,13 @@ def test_StreamlineTrack_inputs():
7477
position=-1,
7578
),
7679
seed_file=dict(argstr='-seed %s',
77-
position=2,
80+
xor=['seed_file', 'seed_spec'],
7881
),
7982
seed_spec=dict(argstr='-seed %s',
8083
position=2,
8184
sep=',',
8285
units='mm',
86+
xor=['seed_file', 'seed_spec'],
8387
),
8488
step_size=dict(argstr='-step %s',
8589
units='mm',

nipype/interfaces/mrtrix/tracking.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,26 @@ class StreamlineTrackInputSpec(CommandLineInputSpec):
7575
in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='the image containing the source data.' \
7676
'The type of data required depends on the type of tracking as set in the preceeding argument. For DT methods, ' \
7777
'the base DWI are needed. For SD methods, the SH harmonic coefficients of the FOD are needed.')
78-
79-
seed_file = File(exists=True, argstr='-seed %s', position=2, desc='seed file')
78+
79+
seed_xor = ['seed_file', 'seed_spec']
80+
seed_file = File(exists=True, argstr='-seed %s', desc='seed file', xor = seed_xor)
8081
seed_spec = traits.List(traits.Float, desc='seed specification in mm and radius (x y z r)', position=2,
81-
argstr='-seed %s', minlen=4, maxlen=4, sep=',', units='mm')
82-
include_file = File(exists=True, argstr='-include %s', position=2, desc='inclusion file')
82+
argstr='-seed %s', minlen=4, maxlen=4, sep=',', units='mm', xor = seed_xor)
83+
84+
include_xor = ['include_file', 'include_spec']
85+
include_file = File(exists=True, argstr='-include %s', desc='inclusion file', xor = include_xor)
8386
include_spec = traits.List(traits.Float, desc='inclusion specification in mm and radius (x y z r)', position=2,
84-
argstr='-seed %s', minlen=4, maxlen=4, sep=',', units='mm')
85-
exclude_file = File(exists=True, argstr='-exclude %s', position=2, desc='exclusion file')
87+
argstr='-include %s', minlen=4, maxlen=4, sep=',', units='mm', xor = include_xor)
88+
89+
exclude_xor = ['exclude_file', 'exclude_spec']
90+
exclude_file = File(exists=True, argstr='-exclude %s', desc='exclusion file', xor = exclude_xor)
8691
exclude_spec = traits.List(traits.Float, desc='exclusion specification in mm and radius (x y z r)', position=2,
87-
argstr='-seed %s', minlen=4, maxlen=4, sep=',', units='mm')
88-
mask_file = File(exists=True, argstr='-exclude %s', position=2, desc='mask file. Only tracks within mask.')
92+
argstr='-exclude %s', minlen=4, maxlen=4, sep=',', units='mm', xor = exclude_xor)
93+
94+
mask_xor = ['mask_file', 'mask_spec']
95+
mask_file = File(exists=True, argstr='-mask %s', desc='mask file. Only tracks within mask.', xor = mask_xor)
8996
mask_spec = traits.List(traits.Float, desc='Mask specification in mm and radius (x y z r). Tracks will be terminated when they leave the ROI.', position=2,
90-
argstr='-seed %s', minlen=4, maxlen=4, sep=',', units='mm')
97+
argstr='-mask %s', minlen=4, maxlen=4, sep=',', units='mm', xor = mask_xor)
9198

9299
inputmodel = traits.Enum('DT_STREAM', 'SD_PROB', 'SD_STREAM',
93100
argstr='%s', desc='input model type', usedefault=True, position=-3)
@@ -140,6 +147,9 @@ class StreamlineTrack(CommandLine):
140147
>>> strack.inputs.inputmodel = 'SD_PROB'
141148
>>> strack.inputs.in_file = 'data.Bfloat'
142149
>>> strack.inputs.seed_file = 'seed_mask.nii'
150+
>>> strack.inputs.mask_file = 'mask.nii'
151+
>>> strack.cmdline
152+
'streamtrack -mask mask.nii -seed seed_mask.nii SD_PROB data.Bfloat data_tracked.tck'
143153
>>> strack.run() # doctest: +SKIP
144154
"""
145155
_cmd = 'streamtrack'

0 commit comments

Comments
 (0)