Skip to content

Commit d456dcc

Browse files
committed
FIX: MCFLIRT output paths are relative to out_file, not cwd
1 parent 0a7b0a5 commit d456dcc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nipype/interfaces/fsl/preprocess.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -820,16 +820,16 @@ def _format_arg(self, name, spec, value):
820820
return super(MCFLIRT, self)._format_arg(name, spec, value)
821821

822822
def _list_outputs(self):
823-
cwd = os.getcwd()
824823
outputs = self._outputs().get()
825824

826825
outputs['out_file'] = self._gen_outfilename()
826+
output_dir = os.path.dirname(outputs['out_file'])
827827

828828
if isdefined(self.inputs.stats_imgs) and self.inputs.stats_imgs:
829829
outputs['variance_img'] = self._gen_fname(
830-
outputs['out_file'] + '_variance.ext', cwd=cwd)
830+
outputs['out_file'] + '_variance.ext', cwd=output_dir)
831831
outputs['std_img'] = self._gen_fname(
832-
outputs['out_file'] + '_sigma.ext', cwd=cwd)
832+
outputs['out_file'] + '_sigma.ext', cwd=output_dir)
833833

834834
# The mean image created if -stats option is specified ('meanvol')
835835
# is missing the top and bottom slices. Therefore we only expose the
@@ -839,11 +839,11 @@ def _list_outputs(self):
839839

840840
if isdefined(self.inputs.mean_vol) and self.inputs.mean_vol:
841841
outputs['mean_img'] = self._gen_fname(
842-
outputs['out_file'] + '_mean_reg.ext', cwd=cwd)
842+
outputs['out_file'] + '_mean_reg.ext', cwd=output_dir)
843843

844844
if isdefined(self.inputs.save_mats) and self.inputs.save_mats:
845845
_, filename = os.path.split(outputs['out_file'])
846-
matpathname = os.path.join(cwd, filename + '.mat')
846+
matpathname = os.path.join(output_dir, filename + '.mat')
847847
_, _, _, timepoints = load(self.inputs.in_file).shape
848848
outputs['mat_file'] = []
849849
for t in range(timepoints):

0 commit comments

Comments
 (0)