@@ -814,10 +814,12 @@ class MRIsConvertInputSpec(FSTraitedSpec):
814
814
origname = traits .String (argstr = "-o %s" , desc = "read orig positions" )
815
815
816
816
in_file = File (exists = True , mandatory = True , position = - 2 , argstr = '%s' , desc = 'File to read/convert' )
817
- out_file = File (argstr = './%s' , position = - 1 , genfile = True , desc = 'output filename or True to generate one' )
818
- # Not really sure why the ./ is necessary but the module fails without it
817
+ out_file = File (argstr = '%s' , position = - 1 , genfile = True ,
818
+ xor = ['out_datatype' ], mandatory = True ,
819
+ desc = 'output filename or True to generate one' )
819
820
820
- out_datatype = traits .Enum ("ico" , "tri" , "stl" , "vtk" , "gii" , "mgh" , "mgz" , mandatory = True ,
821
+ out_datatype = traits .Enum ("ico" , "tri" , "stl" , "vtk" , "gii" , "mgh" , "mgz" ,
822
+ xor = ['out_file' ], mandatory = True ,
821
823
desc = "These file formats are supported: ASCII: .asc"
822
824
"ICO: .ico, .tri GEO: .geo STL: .stl VTK: .vtk GIFTI: .gii MGH surface-encoded 'volume': .mgh, .mgz" )
823
825
@@ -846,19 +848,26 @@ class MRIsConvert(FSCommand):
846
848
input_spec = MRIsConvertInputSpec
847
849
output_spec = MRIsConvertOutputSpec
848
850
851
+ def _format_arg (self , name , spec , value ):
852
+ if name == "out_file" and not os .path .isabs (value ):
853
+ value = os .path .abspath (value )
854
+ return super (MRIsConvert , self )._format_arg (name , spec , value )
855
+
849
856
def _list_outputs (self ):
850
857
outputs = self .output_spec ().get ()
851
858
outputs ["converted" ] = os .path .abspath (self ._gen_outfilename ())
852
859
return outputs
853
860
854
861
def _gen_filename (self , name ):
855
862
if name is 'out_file' :
856
- return self ._gen_outfilename ()
863
+ return os . path . abspath ( self ._gen_outfilename () )
857
864
else :
858
865
return None
859
866
860
867
def _gen_outfilename (self ):
861
- if isdefined (self .inputs .annot_file ):
868
+ if isdefined (self .inputs .out_file ):
869
+ return self .inputs .out_file
870
+ elif isdefined (self .inputs .annot_file ):
862
871
_ , name , ext = split_filename (self .inputs .annot_file )
863
872
elif isdefined (self .inputs .parcstats_file ):
864
873
_ , name , ext = split_filename (self .inputs .parcstats_file )
0 commit comments