@@ -1477,7 +1477,7 @@ class MNIBiasCorrectionInputSpec(FSTraitedSpec):
1477
1477
in_file = File (exists = True , mandatory = True , argstr = "--i %s" ,
1478
1478
desc = "input volume. Input can be any format accepted by mri_convert." )
1479
1479
# 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 ,
1481
1481
name_template = '%s_output' , hash_files = False , keep_extension = True ,
1482
1482
desc = "output volume. Output can be any format accepted by mri_convert. " +
1483
1483
"If the output format is COR, then the directory must exist." )
@@ -1501,7 +1501,7 @@ class MNIBiasCorrectionInputSpec(FSTraitedSpec):
1501
1501
desc = "Shrink parameter for finer sampling (default is 4)" )
1502
1502
1503
1503
class MNIBiasCorrectionOutputSpec (TraitedSpec ):
1504
- out_file = File (desc = "output volume" )
1504
+ out_file = File (exists = True , desc = "output volume" )
1505
1505
1506
1506
1507
1507
class MNIBiasCorrection (FSCommand ):
@@ -1536,9 +1536,17 @@ class MNIBiasCorrection(FSCommand):
1536
1536
input_spec = MNIBiasCorrectionInputSpec
1537
1537
output_spec = MNIBiasCorrectionOutputSpec
1538
1538
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' )
1539
1544
def _list_outputs (self ):
1540
1545
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 )
1542
1550
return outputs
1543
1551
1544
1552
0 commit comments