@@ -814,10 +814,12 @@ class MRIsConvertInputSpec(FSTraitedSpec):
814814 origname = traits .String (argstr = "-o %s" , desc = "read orig positions" )
815815
816816 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' )
819820
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 ,
821823 desc = "These file formats are supported: ASCII: .asc"
822824 "ICO: .ico, .tri GEO: .geo STL: .stl VTK: .vtk GIFTI: .gii MGH surface-encoded 'volume': .mgh, .mgz" )
823825
@@ -846,19 +848,26 @@ class MRIsConvert(FSCommand):
846848 input_spec = MRIsConvertInputSpec
847849 output_spec = MRIsConvertOutputSpec
848850
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+
849856 def _list_outputs (self ):
850857 outputs = self .output_spec ().get ()
851858 outputs ["converted" ] = os .path .abspath (self ._gen_outfilename ())
852859 return outputs
853860
854861 def _gen_filename (self , name ):
855862 if name is 'out_file' :
856- return self ._gen_outfilename ()
863+ return os . path . abspath ( self ._gen_outfilename () )
857864 else :
858865 return None
859866
860867 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 ):
862871 _ , name , ext = split_filename (self .inputs .annot_file )
863872 elif isdefined (self .inputs .parcstats_file ):
864873 _ , name , ext = split_filename (self .inputs .parcstats_file )
0 commit comments