Skip to content

Commit a5fc440

Browse files
committed
fix: grab out file
1 parent cb74279 commit a5fc440

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ class MNIBiasCorrectionInputSpec(FSTraitedSpec):
14771477
in_file = File(exists=True, mandatory=True, argstr="--i %s",
14781478
desc="input volume. Input can be any format accepted by mri_convert.")
14791479
# optional
1480-
out_file = File(argstr="--o %s", name_source=['in_file'],
1480+
out_file = File(argstr="--o %s", name_source=['in_file'], genfile=True,
14811481
name_template='%s_output', hash_files=False, keep_extension=True,
14821482
desc="output volume. Output can be any format accepted by mri_convert. " +
14831483
"If the output format is COR, then the directory must exist.")
@@ -1501,7 +1501,7 @@ class MNIBiasCorrectionInputSpec(FSTraitedSpec):
15011501
desc="Shrink parameter for finer sampling (default is 4)")
15021502

15031503
class MNIBiasCorrectionOutputSpec(TraitedSpec):
1504-
out_file = File(desc="output volume")
1504+
out_file = File(exists=True, desc="output volume")
15051505

15061506

15071507
class MNIBiasCorrection(FSCommand):
@@ -1536,9 +1536,17 @@ class MNIBiasCorrection(FSCommand):
15361536
input_spec = MNIBiasCorrectionInputSpec
15371537
output_spec = MNIBiasCorrectionOutputSpec
15381538

1539+
def _gen_filename(self):
1540+
# if outfile was not defined
1541+
if not isdefined(self.inputs.out_file):
1542+
return self._gen_fname(self.inputs.in_file,
1543+
suffix='_output')
15391544
def _list_outputs(self):
15401545
outputs = self.output_spec().get()
1541-
outputs["out_file"] = os.path.abspath(self.inputs.out_file)
1546+
if not isdefined(self.inputs.out_file):
1547+
outputs["out_file"] = self._gen_filename()
1548+
else:
1549+
outputs["out_file"] = os.path.abspath(self.inputs.out_file)
15421550
return outputs
15431551

15441552

0 commit comments

Comments
 (0)