Skip to content

Commit 9a82862

Browse files
committed
Merge pull request #976 from mick-d/spm
Interface SPM ApplyTransform generated an error if out_file was not provided
2 parents 8e3d0cd + e2f2be6 commit 9a82862

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nipype/interfaces/spm/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ class ApplyTransform(SPMCommand):
146146

147147
def _make_matlab_command(self, _):
148148
"""checks for SPM, generates script"""
149+
outputs = self._list_outputs()
150+
self.inputs.out_file = outputs['out_file']
149151
script = """
150152
infile = '%s';
151153
outfile = '%s'
@@ -168,16 +170,14 @@ def _make_matlab_command(self, _):
168170
def _list_outputs(self):
169171
outputs = self.output_spec().get()
170172
if not isdefined(self.inputs.out_file):
171-
_, name, _ = split_filename(self.inputs.in_file)
172-
outputs['out_file'] = os.path.abspath(name + '_trans.nii')
173+
outputs['out_file'] = os.path.abspath(self._gen_outfilename())
173174
else:
174175
outputs['out_file'] = os.path.abspath(self.inputs.out_file)
175176
return outputs
176177

177-
def _gen_filename(self, name):
178-
if name == 'out_file':
179-
return self._list_outputs()[name]
180-
return None
178+
def _gen_outfilename(self):
179+
_, name, _ = split_filename(self.inputs.in_file)
180+
return name + '_trans.nii'
181181

182182
class ResliceInputSpec(SPMCommandInputSpec):
183183
in_file = File( exists = True, mandatory=True,

0 commit comments

Comments
 (0)