Skip to content

Commit 00b7aae

Browse files
committed
improve out_files path reconstruction
1 parent aef05c4 commit 00b7aae

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

nipype/interfaces/fsl/utils.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _format_arg(self, name, trait_spec, value):
264264

265265
class SliceInputSpec(FSLCommandInputSpec):
266266
in_file = File(exists=True, argstr="%s", position=0, mandatory=True,
267-
desc="input filename")
267+
desc="input filename", copyfile=False)
268268
out_base_name = traits.Str(argstr="%s", position=1, desc="outputs prefix")
269269

270270

@@ -311,18 +311,16 @@ def _list_outputs(self):
311311
"""
312312
outputs = self._outputs().get()
313313
ext = Info.output_type_to_ext(self.inputs.output_type)
314+
suffix = '_slice_*' + ext
314315
if isdefined(self.inputs.out_base_name):
315-
outbase = self.inputs.out_base_name + '_slice_*'
316-
out_dir = os.getcwd()
316+
fname_template = os.path.abspath(
317+
self.inputs.out_base_name + suffix)
317318
else:
318-
out_dir = os.path.dirname(self.inputs.in_file)
319-
in_base, _ = os.path.splitext(self.inputs.in_file)
320-
if '.gz' in self.inputs.in_file:
321-
in_base, _ = os.path.splitext(in_base)
322-
323-
outbase = in_base + '_slice*'
324-
outputs['out_files'] = sorted(glob(os.path.join(out_dir,
325-
outbase + ext)))
319+
fname_template = fname_presuffix(self.inputs.in_file,
320+
suffix=suffix, use_ext=False)
321+
322+
outputs['out_files'] = sorted(glob(fname_template))
323+
326324
return outputs
327325

328326

0 commit comments

Comments
 (0)