2929 afni = 'brik' , brik = 'brik' , bshort = 'bshort' ,
3030 spm = 'img' , analyze = 'img' , analyze4d = 'img' ,
3131 bfloat = 'bfloat' , nifti1 = 'img' , nii = 'nii' ,
32- niigz = 'nii.gz' )
32+ niigz = 'nii.gz' , gii = 'gii' )
3333
3434filetypes = ['cor' , 'mgh' , 'mgz' , 'minc' , 'analyze' ,
3535 'analyze4d' , 'spm' , 'afni' , 'brik' , 'bshort' ,
3636 'bfloat' , 'sdt' , 'outline' , 'otl' , 'gdf' ,
3737 'nifti1' , 'nii' , 'niigz' ]
38+ implicit_filetypes = ['gii' ]
3839
3940
4041def copy2subjdir (cls , in_file , folder = None , basename = None , subject_id = None ):
@@ -151,7 +152,8 @@ class SampleToSurfaceInputSpec(FSTraitedSpec):
151152 frame = traits .Int (argstr = "--frame %d" , desc = "save only one frame (0-based)" )
152153
153154 out_file = File (argstr = "--o %s" , genfile = True , desc = "surface file to write" )
154- out_type = traits .Enum (filetypes , argstr = "--out_type %s" , desc = "output file type" )
155+ out_type = traits .Enum (filetypes + implicit_filetypes ,
156+ argstr = "--out_type %s" , desc = "output file type" )
155157 hits_file = traits .Either (traits .Bool , File (exists = True ), argstr = "--srchit %s" ,
156158 desc = "save image with number of hits at each voxel" )
157159 hits_type = traits .Enum (filetypes , argstr = "--srchit_type" , desc = "hits file type" )
@@ -201,12 +203,6 @@ class SampleToSurface(FSCommand):
201203 input_spec = SampleToSurfaceInputSpec
202204 output_spec = SampleToSurfaceOutputSpec
203205
204- filemap = dict (cor = 'cor' , mgh = 'mgh' , mgz = 'mgz' , minc = 'mnc' ,
205- afni = 'brik' , brik = 'brik' , bshort = 'bshort' ,
206- spm = 'img' , analyze = 'img' , analyze4d = 'img' ,
207- bfloat = 'bfloat' , nifti1 = 'img' , nii = 'nii' ,
208- niigz = 'nii.gz' )
209-
210206 def _format_arg (self , name , spec , value ):
211207 if name == "sampling_method" :
212208 range = self .inputs .sampling_range
@@ -226,16 +222,18 @@ def _format_arg(self, name, spec, value):
226222 return spec .argstr % self .inputs .subject_id
227223 if name in ["hits_file" , "vox_file" ]:
228224 return spec .argstr % self ._get_outfilename (name )
225+ if name == "out_type" and value in implicit_filetypes :
226+ return ""
229227 return super (SampleToSurface , self )._format_arg (name , spec , value )
230228
231229 def _get_outfilename (self , opt = "out_file" ):
232230 outfile = getattr (self .inputs , opt )
233231 if not isdefined (outfile ) or isinstance (outfile , bool ):
234232 if isdefined (self .inputs .out_type ):
235233 if opt == "hits_file" :
236- suffix = '_hits.' + self . filemap [self .inputs .out_type ]
234+ suffix = '_hits.' + filemap [self .inputs .out_type ]
237235 else :
238- suffix = '.' + self . filemap [self .inputs .out_type ]
236+ suffix = '.' + filemap [self .inputs .out_type ]
239237 elif opt == "hits_file" :
240238 suffix = "_hits.mgz"
241239 else :
0 commit comments