Skip to content

Commit f3404c1

Browse files
author
Erik Ziegler
committed
Updates for MRtrix FilterTracks interface
1 parent 4992953 commit f3404c1

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

nipype/interfaces/mrtrix/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
22
# vi: set ft=python sts=4 ts=4 sw=4 et:
3-
from .tracking import (Tracks2Prob, StreamlineTrack,
3+
from .tracking import (Tracks2Prob, FilterTracks, StreamlineTrack,
44
DiffusionTensorStreamlineTrack,
55
SphericallyDeconvolutedStreamlineTrack,
66
ProbabilisticSphericallyDeconvolutedStreamlineTrack)

nipype/interfaces/mrtrix/tracking.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ class FilterTracksInputSpec(CommandLineInputSpec):
3232

3333
out_filename = File(genfile=True, argstr='%s', position=-1, desc='Output filtered track filename')
3434
no_mask_interpolation = traits.Bool(argstr='-nomaskinterp', desc="Turns off trilinear interpolation of mask images.")
35-
invert = traits.Bool(argstr='-invert', desc="invert the matching process, so that tracks that would" /
35+
invert = traits.Bool(argstr='-invert', desc="invert the matching process, so that tracks that would" \
3636
"otherwise have been included are now excluded and vice-versa.")
3737

3838

3939
quiet = traits.Bool(argstr='-quiet', position=1, desc="Do not display information messages or progress status.")
4040
debug = traits.Bool(argstr='-debug', position=1, desc="Display debugging messages.")
4141

4242
class FilterTracksOutputSpec(TraitedSpec):
43-
out_file = File(exists=True, desc='the output image of the major eigenvectors of the diffusion tensor image.')
43+
out_file = File(exists=True, desc='the output filtered tracks')
4444

4545
class FilterTracks(CommandLine):
4646
"""
47-
Use regions-of-interest to select a sub-set of tracks
48-
from a given track file.
47+
Use regions-of-interest to select a subset of tracks
48+
from a given MRtrix track file.
4949
5050
Example
5151
-------
@@ -62,21 +62,22 @@ class FilterTracks(CommandLine):
6262

6363
def _list_outputs(self):
6464
outputs = self.output_spec().get()
65-
outputs['out_file'] = self.inputs.out_filename
66-
if not isdefined(outputs['out_file']):
67-
outputs['out_file'] = op.abspath(self._gen_outfilename())
68-
else:
69-
outputs['out_file'] = op.abspath(outputs['out_file'])
65+
outputs['out_file'] = op.abspath(self._gen_outfilename())
7066
return outputs
7167

7268
def _gen_filename(self, name):
7369
if name is 'out_filename':
7470
return self._gen_outfilename()
7571
else:
7672
return None
73+
7774
def _gen_outfilename(self):
78-
_, name , _ = split_filename(self.inputs.in_file)
79-
return name + '_filt.tck'
75+
if isdefined(self.inputs.out_filename):
76+
path, name , _ = split_filename(self.inputs.out_filename)
77+
return op.join(path, name + '.tck')
78+
else:
79+
_, name , _ = split_filename(self.inputs.in_file)
80+
return op.abspath(name + '_filt.tck')
8081

8182

8283
class Tracks2ProbInputSpec(CommandLineInputSpec):

0 commit comments

Comments
 (0)