From d456dccfb67e697f206b561871b52f6dba34b7d8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 17 Sep 2018 14:49:13 -0400 Subject: [PATCH] FIX: MCFLIRT output paths are relative to out_file, not cwd --- nipype/interfaces/fsl/preprocess.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nipype/interfaces/fsl/preprocess.py b/nipype/interfaces/fsl/preprocess.py index dd2c969945..da06a5c574 100644 --- a/nipype/interfaces/fsl/preprocess.py +++ b/nipype/interfaces/fsl/preprocess.py @@ -820,16 +820,16 @@ def _format_arg(self, name, spec, value): return super(MCFLIRT, self)._format_arg(name, spec, value) def _list_outputs(self): - cwd = os.getcwd() outputs = self._outputs().get() outputs['out_file'] = self._gen_outfilename() + output_dir = os.path.dirname(outputs['out_file']) if isdefined(self.inputs.stats_imgs) and self.inputs.stats_imgs: outputs['variance_img'] = self._gen_fname( - outputs['out_file'] + '_variance.ext', cwd=cwd) + outputs['out_file'] + '_variance.ext', cwd=output_dir) outputs['std_img'] = self._gen_fname( - outputs['out_file'] + '_sigma.ext', cwd=cwd) + outputs['out_file'] + '_sigma.ext', cwd=output_dir) # The mean image created if -stats option is specified ('meanvol') # is missing the top and bottom slices. Therefore we only expose the @@ -839,11 +839,11 @@ def _list_outputs(self): if isdefined(self.inputs.mean_vol) and self.inputs.mean_vol: outputs['mean_img'] = self._gen_fname( - outputs['out_file'] + '_mean_reg.ext', cwd=cwd) + outputs['out_file'] + '_mean_reg.ext', cwd=output_dir) if isdefined(self.inputs.save_mats) and self.inputs.save_mats: _, filename = os.path.split(outputs['out_file']) - matpathname = os.path.join(cwd, filename + '.mat') + matpathname = os.path.join(output_dir, filename + '.mat') _, _, _, timepoints = load(self.inputs.in_file).shape outputs['mat_file'] = [] for t in range(timepoints):