Skip to content

Commit a5c6164

Browse files
committed
add options to tracking interface
1 parent 6d4c6ad commit a5c6164

File tree

2 files changed

+137
-7
lines changed

2 files changed

+137
-7
lines changed

nipype/interfaces/mrtrix3/tests/test_auto_Tractography.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ def test_Tractography_inputs():
88
algorithm=dict(argstr='-algorithm %s',
99
usedefault=True,
1010
),
11+
angle=dict(argstr='-angle %f',
12+
),
1113
args=dict(argstr='%s',
1214
),
1315
backtrack=dict(argstr='-backtrack',
@@ -16,6 +18,12 @@ def test_Tractography_inputs():
1618
),
1719
crop_at_gmwmi=dict(argstr='-crop_at_gmwmi',
1820
),
21+
cutoff=dict(argstr='-cutoff %f',
22+
),
23+
cutoff_init=dict(argstr='-initcutoff %f',
24+
),
25+
downsample=dict(argstr='-downsample %f',
26+
),
1927
environ=dict(nohash=True,
2028
usedefault=True,
2129
),
@@ -30,33 +38,68 @@ def test_Tractography_inputs():
3038
mandatory=True,
3139
position=-2,
3240
),
41+
init_dir=dict(argstr='-initdirection %f,%f,%f',
42+
),
43+
max_length=dict(argstr='-maxlength %f',
44+
),
45+
max_seed_attempts=dict(argstr='-max_seed_attempts %d',
46+
),
47+
max_tracks=dict(argstr='-maxnum %d',
48+
),
49+
min_length=dict(argstr='-minlength %f',
50+
),
51+
n_samples=dict(argstr='-samples %d',
52+
),
53+
n_tracks=dict(argstr='-number %d',
54+
),
55+
n_trials=dict(argstr='-trials %d',
56+
),
57+
noprecompt=dict(argstr='-noprecomputed',
58+
),
3359
out_file=dict(argstr='%s',
3460
mandatory=True,
3561
position=-1,
3662
usedefault=True,
3763
),
3864
out_seeds=dict(argstr='-output_seeds %s',
3965
),
66+
power=dict(argstr='-power %d',
67+
),
4068
roi_excl=dict(argstr='-exclude %s',
4169
),
4270
roi_incl=dict(argstr='-include %s',
4371
),
4472
roi_mask=dict(argstr='-mask %s',
4573
),
74+
seed_dynamic=dict(argstr='-seed_dynamic %s',
75+
),
76+
seed_gmwmi=dict(argstr='-seed_gmwmi %s',
77+
requires=['act_file'],
78+
),
4679
seed_grid_voxel=dict(argstr='-seed_grid_per_voxel %s %d',
4780
xor=['seed_image', 'seed_rnd_voxel'],
4881
),
4982
seed_image=dict(argstr='-seed_image %s',
5083
),
84+
seed_rejection=dict(argstr='-seed_rejection %s',
85+
),
5186
seed_rnd_voxel=dict(argstr='-seed_random_per_voxel %s %d',
5287
xor=['seed_image', 'seed_grid_voxel'],
5388
),
5489
seed_sphere=dict(argstr='-seed_sphere %f,%f,%f,%f',
5590
),
5691
sph_trait=dict(argstr='%f,%f,%f,%f',
5792
),
93+
step_size=dict(argstr='-step %f',
94+
),
95+
stop=dict(argstr='-stop',
96+
),
5897
terminal_output=dict(nohash=True,
5998
),
99+
unidirectional=dict(argstr='-unidirectional',
100+
),
101+
use_rk4=dict(argstr='-rk4',
102+
),
60103
)
61104
inputs = Tractography.input_spec()
62105

nipype/interfaces/mrtrix3/tracking.py

Lines changed: 94 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,77 @@ class TractographyInputSpec(CommandLineInputSpec):
5050
desc=('specify a masking region of interest. If defined,'
5151
'streamlines exiting the mask will be truncated'))
5252

53-
# Here streamlines tractography
53+
# Streamlines tractography options
54+
step_size = traits.Float(
55+
argstr='-step %f',
56+
desc=('set the step size of the algorithm in mm (default is 0.1'
57+
' x voxelsize; for iFOD2: 0.5 x voxelsize)'))
58+
angle = traits.Float(
59+
argstr='-angle %f',
60+
desc=('set the maximum angle between successive steps (default '
61+
'is 90deg x stepsize / voxelsize)'))
62+
n_tracks = traits.Int(
63+
argstr='-number %d',
64+
desc=('set the desired number of tracks. The program will continue'
65+
' to generate tracks until this number of tracks have been '
66+
'selected and written to the output file'))
67+
max_tracks = traits.Int(
68+
argstr='-maxnum %d',
69+
desc=('set the maximum number of tracks to generate. The program '
70+
'will not generate more tracks than this number, even if '
71+
'the desired number of tracks hasn\'t yet been reached '
72+
'(default is 100 x number)'))
73+
max_length = traits.Float(
74+
argstr='-maxlength %f',
75+
desc=('set the maximum length of any track in mm (default is '
76+
'100 x voxelsize)'))
77+
min_length = traits.Float(
78+
argstr='-minlength %f',
79+
desc=('set the minimum length of any track in mm (default is '
80+
'5 x voxelsize)'))
81+
cutoff = traits.Float(
82+
argstr='-cutoff %f',
83+
desc=('set the FA or FOD amplitude cutoff for terminating '
84+
'tracks (default is 0.1)'))
85+
cutoff_init = traits.Float(
86+
argstr='-initcutoff %f',
87+
desc=('set the minimum FA or FOD amplitude for initiating '
88+
'tracks (default is the same as the normal cutoff)'))
89+
n_trials = traits.Int(
90+
argstr='-trials %d',
91+
desc=('set the maximum number of sampling trials at each point'
92+
' (only used for probabilistic tracking)'))
93+
unidirectional = traits.Bool(
94+
argstr='-unidirectional',
95+
desc=('track from the seed point in one direction only '
96+
'(default is to track in both directions)'))
97+
init_dir = traits.Tuple(
98+
traits.Float, traits.Float, traits.Float,
99+
argstr='-initdirection %f,%f,%f',
100+
desc=('specify an initial direction for the tracking (this '
101+
'should be supplied as a vector of 3 comma-separated values'))
102+
noprecompt = traits.Bool(
103+
argstr='-noprecomputed',
104+
desc=('do NOT pre-compute legendre polynomial values. Warning: this '
105+
'will slow down the algorithm by a factor of approximately 4'))
106+
power = traits.Int(
107+
argstr='-power %d',
108+
desc=('raise the FOD to the power specified (default is 1/nsamples)'))
109+
n_samples = traits.Int(
110+
4, argstr='-samples %d',
111+
desc=('set the number of FOD samples to take per step for the 2nd '
112+
'order (iFOD2) method'))
113+
use_rk4 = traits.Bool(
114+
argstr='-rk4',
115+
desc=('use 4th-order Runge-Kutta integration (slower, but eliminates'
116+
' curvature overshoot in 1st-order deterministic methods)'))
117+
stop = traits.Bool(
118+
argstr='-stop',
119+
desc=('stop propagating a streamline once it has traversed all '
120+
'include regions'))
121+
downsample = traits.Float(
122+
argstr='-downsample %f',
123+
desc=('downsample the generated streamlines to reduce output file size'))
54124

55125
# Anatomically-Constrained Tractography options
56126
act_file = File(
@@ -72,22 +142,39 @@ class TractographyInputSpec(CommandLineInputSpec):
72142
argstr='-seed_sphere %f,%f,%f,%f', desc='spherical seed')
73143
seed_image = File(exists=True, argstr='-seed_image %s',
74144
desc='seed streamlines entirely at random within mask')
75-
seed_rnd_voxel = traits.Enum(
76-
traits.Int(), File(exists=True),
145+
seed_rnd_voxel = traits.Tuple(
146+
File(exists=True), traits.Int(),
77147
argstr='-seed_random_per_voxel %s %d',
78148
xor=['seed_image', 'seed_grid_voxel'],
79149
desc=('seed a fixed number of streamlines per voxel in a mask '
80150
'image; random placement of seeds in each voxel'))
81-
seed_grid_voxel = traits.Enum(
82-
traits.Int(), File(exists=True),
151+
seed_grid_voxel = traits.Tuple(
152+
File(exists=True), traits.Int(),
83153
argstr='-seed_grid_per_voxel %s %d',
84154
xor=['seed_image', 'seed_rnd_voxel'],
85155
desc=('seed a fixed number of streamlines per voxel in a mask '
86156
'image; place seeds on a 3D mesh grid (grid_size argument '
87157
'is per axis; so a grid_size of 3 results in 27 seeds per'
88158
' voxel)'))
89-
90-
# missing opts: seed_rejection, seed_gmwmi, seed_dynamic, max_seed_attempts
159+
seed_rejection = File(
160+
exists=True, argstr='-seed_rejection %s',
161+
desc=('seed from an image using rejection sampling (higher '
162+
'values = more probable to seed from'))
163+
seed_gmwmi = File(
164+
exists=True, argstr='-seed_gmwmi %s', requires=['act_file'],
165+
desc=('seed from the grey matter - white matter interface (only '
166+
'valid if using ACT framework)'))
167+
seed_dynamic = File(
168+
exists=True, argstr='-seed_dynamic %s',
169+
desc=('determine seed points dynamically using the SIFT model '
170+
'(must not provide any other seeding mechanism). Note that'
171+
' while this seeding mechanism improves the distribution of'
172+
' reconstructed streamlines density, it should NOT be used '
173+
'as a substitute for the SIFT method itself.'))
174+
max_seed_attempts = traits.Int(argstr='-max_seed_attempts %d',
175+
desc=('set the maximum number of times that the tracking '
176+
'algorithm should attempt to find an appropriate tracking'
177+
' direction from a given seed point'))
91178
out_seeds = File(
92179
'out_seeds.nii.gz', argstr='-output_seeds %s',
93180
desc=('output the seed location of all successful streamlines to'

0 commit comments

Comments
 (0)