Skip to content

Commit 5ffcae8

Browse files
committed
fix automatic name forward of name_template
1 parent 239cf8a commit 5ffcae8

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,8 +2392,9 @@ class OutlierCountInputSpec(CommandLineInputSpec):
23922392
desc='write out the median + 3.5 MAD of outlier'
23932393
' count with each timepoint')
23942394
save_outliers = traits.Bool(False, usedefault=True, desc='enables out_file option')
2395-
outliers_file = File(name_template="%s_outliers", argstr='-save %s', name_source=["in_file"],
2396-
keep_extension=True, desc='output image file name')
2395+
outliers_file = File(
2396+
name_template="%s_outliers", argstr='-save %s', name_source=["in_file"],
2397+
output_name='out_outliers', keep_extension=True, desc='output image file name')
23972398

23982399
polort = traits.Int(argstr='-polort %d',
23992400
desc='detrend each voxel timeseries with polynomials')
@@ -2405,7 +2406,7 @@ class OutlierCountInputSpec(CommandLineInputSpec):
24052406

24062407

24072408
class OutlierCountOutputSpec(TraitedSpec):
2408-
outliers_file = File(exists=True, desc='output image file name')
2409+
out_outliers = File(exists=True, desc='output image file name')
24092410
out_file = File(
24102411
name_template='%s_tqual', name_source=['in_file'], argstr='> %s',
24112412
keep_extension=False, position=-1, desc='capture standard output')
@@ -2441,6 +2442,11 @@ def _parse_inputs(self, skip=None):
24412442
skip += ['outliers_file']
24422443
return super(OutlierCount, self)._parse_inputs(skip)
24432444

2445+
def _list_outputs(self):
2446+
outputs = self.output_spec().get()
2447+
if self.inputs.save_outliers:
2448+
outputs['out_outliers'] = op.abspath(self.inputs.outliers_file)
2449+
24442450

24452451
class QualityIndexInputSpec(CommandLineInputSpec):
24462452
in_file = File(argstr='%s', mandatory=True, exists=True, position=-2, desc='input dataset')

nipype/interfaces/afni/tests/test_auto_OutlierCount.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_OutlierCount_inputs():
4646
keep_extension=True,
4747
name_source=['in_file'],
4848
name_template='%s_outliers',
49+
output_name='out_outliers',
4950
),
5051
polort=dict(argstr='-polort %d',
5152
),
@@ -70,7 +71,7 @@ def test_OutlierCount_outputs():
7071
name_template='%s_tqual',
7172
position=-1,
7273
),
73-
outliers_file=dict(),
74+
out_outliers=dict(),
7475
)
7576
outputs = OutlierCount.output_spec()
7677

nipype/interfaces/freesurfer/tests/test_auto_MRIsConvert.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ def test_MRIsConvert_inputs():
3030
),
3131
origname=dict(argstr='-o %s',
3232
),
33-
out_datatype=dict(xor=['out_file'],
33+
out_datatype=dict(mandatory=True,
34+
xor=['out_file'],
3435
),
3536
out_file=dict(argstr='%s',
3637
genfile=True,
38+
mandatory=True,
3739
position=-1,
3840
xor=['out_datatype'],
3941
),

nipype/interfaces/freesurfer/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ def _format_arg(self, name, spec, value):
852852
if name == "out_file" and not os.path.isabs(value):
853853
value = os.path.abspath(value)
854854
return super(MRIsConvert, self)._format_arg(name, spec, value)
855-
855+
856856
def _list_outputs(self):
857857
outputs = self.output_spec().get()
858858
outputs["converted"] = os.path.abspath(self._gen_outfilename())

0 commit comments

Comments
 (0)