Skip to content

Commit c131d0e

Browse files
committed
fix output naming
1 parent 60cc6ee commit c131d0e

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

nipype/interfaces/fsl/preprocess.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ class FIRSTInputSpec(FSLCommandInputSpec):
15161516
desc=("Method must be one of auto, fast, none, or it can be entered "
15171517
"using the 'method_as_numerical_threshold' input"))
15181518
method_as_numerical_threshold = traits.Float(
1519-
argstr='-m %d', position=4,
1519+
argstr='-m %.4f', position=4,
15201520
desc=("Specify a numerical threshold value or use the 'method' input "
15211521
"to choose auto, fast, or none"))
15221522
list_of_specific_structures = traits.List(
@@ -1592,12 +1592,18 @@ def _list_outputs(self):
15921592
def _gen_fname(self, name):
15931593
path, outname, ext = split_filename(self.inputs.out_file)
15941594

1595+
method = 'none'
1596+
if isdefined(self.inputs.method) and self.inputs.method == 'fast':
1597+
method = 'fast'
1598+
1599+
if isdefined(self.inputs.method_as_numerical_threshold):
1600+
thres = '%.4f' % self.inputs.method_as_numerical_threshold
1601+
method = thres.replace('.', '')
1602+
15951603
if name == 'original_segmentations':
1596-
fnames = glob.glob(op.abspath('%s_all_*_origsegs.nii.gz' % outname))
1597-
return op.abspath(fnames[0])
1604+
return op.abspath('%s_all_%s_origsegs.nii.gz' % (outname, method))
15981605
if name == 'segmentation_file':
1599-
fnames = glob.glob(op.abspath('%s_all_*_firstseg.nii.gz' % outname))
1600-
return op.abspath(fnames[0])
1606+
return op.abspath('%s_all_%s_firstseg.nii.gz' % (outname, method))
16011607

16021608
return None
16031609

@@ -1616,3 +1622,8 @@ def _gen_mesh_names(self, name, structures):
16161622
bvars.append(op.abspath(bvar))
16171623
return bvars
16181624
return None
1625+
1626+
@property
1627+
def cmdline(self):
1628+
print self._gen_fname('original_segmentations')
1629+
return super(FIRST, self).cmdline

nipype/interfaces/fsl/tests/test_auto_FIRST.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ def test_FIRST_inputs():
2626
position=5,
2727
sep=',',
2828
),
29-
method=dict(argstr='-m',
29+
method=dict(argstr='-m %s',
3030
position=4,
31+
usedefault=True,
3132
xor=['method_as_numerical_threshold'],
3233
),
33-
method_as_numerical_threshold=dict(argstr='-m',
34+
method_as_numerical_threshold=dict(argstr='-m %.4f',
3435
position=4,
3536
),
3637
no_cleanup=dict(argstr='-d',

0 commit comments

Comments
 (0)