Skip to content

Commit 6b7f29d

Browse files
committed
Fix FreeSurfer SurfaceTransform gen out_file
SurfaceTransform may specify either a source_file or a source_annot_file (mutually exclusive). However, if out_file is not specified and source_annot_file is specified, _list_outputs will try to generate the out_file name using the source_file (which won't be defined in this case). Added an extra check to see if self.input.source_file is defined and if it's not then use self.inputs.source_annot_file instead.
1 parent 11111cd commit 6b7f29d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/interfaces/freesurfer/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ def _list_outputs(self):
355355
outputs = self._outputs().get()
356356
outputs["out_file"] = self.inputs.out_file
357357
if not isdefined(outputs["out_file"]):
358-
source = self.inputs.source_file
358+
if isdefined(self.inputs.source_file):
359+
source = self.inputs.source_file
360+
else:
361+
source = self.inputs.source_annot_file
362+
359363
# Some recon-all files don't have a proper extension (e.g. "lh.thickness")
360364
# so we have to account for that here
361365
bad_extensions = [".%s" % e for e in ["area", "mid", "pial", "avg_curv", "curv", "inflated",
@@ -1276,4 +1280,4 @@ def _gen_outfilename(self):
12761280
return os.path.abspath(self.inputs.out_file)
12771281
else:
12781282
_, name, ext = split_filename(self.inputs.in_file)
1279-
return os.path.abspath(name + '_smoothed' + ext)
1283+
return os.path.abspath(name + '_smoothed' + ext)

0 commit comments

Comments
 (0)