Skip to content

Commit d8721d9

Browse files
name template for Pik interface
1 parent a7de3ea commit d8721d9

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

nipype/interfaces/minc/minc.py

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,11 @@ class PikInputSpec(CommandLineInputSpec):
14121412
desc='output file',
14131413
argstr='%s',
14141414
genfile=True,
1415-
position=-1)
1415+
position=-1,
1416+
name_source=['input_file'],
1417+
hash_files=False,
1418+
name_template='%s.png',
1419+
keep_extension=False)
14161420

14171421
clobber = traits.Bool(
14181422
desc='Overwrite existing file.',
@@ -1568,37 +1572,6 @@ def _format_arg(self, name, spec, value):
15681572
'Unknown value for "title" argument: ' + str(value))
15691573
return super(Pik, self)._format_arg(name, spec, value)
15701574

1571-
def _gen_outfilename(self):
1572-
return self._gen_filename('output_file')
1573-
1574-
def _gen_filename(self, name):
1575-
if name == 'output_file':
1576-
output_file = self.inputs.output_file
1577-
1578-
if isdefined(output_file):
1579-
# FIXME make a warning instead?
1580-
assert not isdefined(self.inputs.png)
1581-
# FIXME make a warning instead?
1582-
assert not isdefined(self.inputs.jpg)
1583-
return os.path.abspath(output_file)
1584-
else:
1585-
b = aggregate_filename([self.inputs.input_file], 'pik_output')
1586-
if isdefined(self.inputs.png) and self.inputs.png:
1587-
return b + '.png'
1588-
elif isdefined(self.inputs.jpg) and self.inputs.jpg:
1589-
return b + '.jpg'
1590-
else:
1591-
# By default we'll write a png file.
1592-
return b + '.png'
1593-
else:
1594-
raise NotImplemented
1595-
1596-
def _list_outputs(self):
1597-
outputs = self.output_spec().get()
1598-
outputs['output_file'] = os.path.abspath(
1599-
self._gen_filename('output_file'))
1600-
return outputs
1601-
16021575

16031576
class BlurInputSpec(CommandLineInputSpec):
16041577
""" FIXME not implemented

0 commit comments

Comments
 (0)