Skip to content

Commit c0ae3a4

Browse files
committed
add name template and assign output filename for autobox
1 parent 20f0444 commit c0ae3a4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

nipype/interfaces/afni/utils.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ class AutoboxInputSpec(AFNICommandInputSpec):
115115
desc='Number of extra voxels to pad on each side of box')
116116
out_file = File(
117117
argstr='-prefix %s',
118-
name_source='in_file')
118+
name_source='in_file',
119+
name_template='%s_autobox')
119120
no_clustering = traits.Bool(
120121
argstr='-noclust',
121122
desc='Don\'t do any clustering to find box. Any non-zero voxel will '
@@ -151,7 +152,7 @@ class Autobox(AFNICommand):
151152
>>> abox.inputs.in_file = 'structural.nii'
152153
>>> abox.inputs.padding = 5
153154
>>> abox.cmdline # doctest: +ALLOW_UNICODE
154-
'3dAutobox -input structural.nii -prefix structural_generated -npad 5'
155+
'3dAutobox -input structural.nii -prefix structural_autobox -npad 5'
155156
>>> res = abox.run() # doctest: +SKIP
156157
157158
"""
@@ -161,7 +162,7 @@ class Autobox(AFNICommand):
161162
output_spec = AutoboxOutputSpec
162163

163164
def aggregate_outputs(self, runtime=None, needed_outputs=None):
164-
outputs = self._outputs()
165+
outputs = super(Autobox, self).aggregate_outputs(runtime, needed_outputs)
165166
pattern = 'x=(?P<x_min>-?\d+)\.\.(?P<x_max>-?\d+) '\
166167
'y=(?P<y_min>-?\d+)\.\.(?P<y_max>-?\d+) '\
167168
'z=(?P<z_min>-?\d+)\.\.(?P<z_max>-?\d+)'
@@ -172,13 +173,8 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
172173
for k in list(d.keys()):
173174
d[k] = int(d[k])
174175
outputs.set(**d)
175-
outputs.set(out_file=self._gen_filename('out_file'))
176176
return outputs
177177

178-
def _gen_filename(self, name):
179-
if name == 'out_file' and (not isdefined(self.inputs.out_file)):
180-
return Undefined
181-
return super(Autobox, self)._gen_filename(name)
182178

183179

184180
class BrickStatInputSpec(CommandLineInputSpec):

0 commit comments

Comments
 (0)