Skip to content

Commit eed7698

Browse files
Revert on NlpFit interface.
1 parent 30fb067 commit eed7698

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

nipype/interfaces/minc/minc.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,11 +3153,7 @@ class NlpFitInputSpec(CommandLineInputSpec):
31533153
desc='output xfm file',
31543154
genfile=True,
31553155
argstr='%s',
3156-
position=-1,
3157-
name_source=['source'],
3158-
hash_files=False,
3159-
name_template='%s_nlpfit.mnc',
3160-
keep_extension=False)
3156+
position=-1,)
31613157

31623158
# This is a dummy input.
31633159
input_grid_files = InputMultiPath(
@@ -3224,13 +3220,27 @@ class NlpFit(CommandLine):
32243220
output_spec = NlpFitOutputSpec
32253221
_cmd = 'nlpfit'
32263222

3223+
def _gen_filename(self, name):
3224+
if name == 'output_xfm':
3225+
output_xfm = self.inputs.output_xfm
3226+
3227+
if isdefined(output_xfm):
3228+
return os.path.abspath(output_xfm)
3229+
else:
3230+
return aggregate_filename(
3231+
[self.inputs.source, self.inputs.target], 'nlpfit_xfm_output') + '.xfm'
3232+
else:
3233+
raise NotImplemented
3234+
32273235
def _list_outputs(self):
3228-
outputs = super(NlpFit, self)._list_outputs()
3236+
outputs = self.output_spec().get()
3237+
outputs['output_xfm'] = os.path.abspath(
3238+
self._gen_filename('output_xfm'))
32293239

3230-
if os.path.exists(outputs['output_xfm']):
3231-
if 'grid' in open(outputs['output_xfm'], 'r').read():
3232-
outputs['output_grid'] = re.sub(
3233-
'.(nlxfm|xfm)$', '_grid_0.mnc', outputs['output_xfm'])
3240+
assert os.path.exists(outputs['output_xfm'])
3241+
if 'grid' in open(outputs['output_xfm'], 'r').read():
3242+
outputs['output_grid'] = re.sub(
3243+
'.(nlxfm|xfm)$', '_grid_0.mnc', outputs['output_xfm'])
32343244

32353245
return outputs
32363246

0 commit comments

Comments
 (0)