29
29
afni = 'brik' , brik = 'brik' , bshort = 'bshort' ,
30
30
spm = 'img' , analyze = 'img' , analyze4d = 'img' ,
31
31
bfloat = 'bfloat' , nifti1 = 'img' , nii = 'nii' ,
32
- niigz = 'nii.gz' )
32
+ niigz = 'nii.gz' , gii = 'gii' )
33
33
34
34
filetypes = ['cor' , 'mgh' , 'mgz' , 'minc' , 'analyze' ,
35
35
'analyze4d' , 'spm' , 'afni' , 'brik' , 'bshort' ,
36
36
'bfloat' , 'sdt' , 'outline' , 'otl' , 'gdf' ,
37
37
'nifti1' , 'nii' , 'niigz' ]
38
+ implicit_filetypes = ['gii' ]
38
39
39
40
40
41
def copy2subjdir (cls , in_file , folder = None , basename = None , subject_id = None ):
@@ -151,7 +152,8 @@ class SampleToSurfaceInputSpec(FSTraitedSpec):
151
152
frame = traits .Int (argstr = "--frame %d" , desc = "save only one frame (0-based)" )
152
153
153
154
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" )
155
157
hits_file = traits .Either (traits .Bool , File (exists = True ), argstr = "--srchit %s" ,
156
158
desc = "save image with number of hits at each voxel" )
157
159
hits_type = traits .Enum (filetypes , argstr = "--srchit_type" , desc = "hits file type" )
@@ -201,12 +203,6 @@ class SampleToSurface(FSCommand):
201
203
input_spec = SampleToSurfaceInputSpec
202
204
output_spec = SampleToSurfaceOutputSpec
203
205
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
-
210
206
def _format_arg (self , name , spec , value ):
211
207
if name == "sampling_method" :
212
208
range = self .inputs .sampling_range
@@ -226,16 +222,18 @@ def _format_arg(self, name, spec, value):
226
222
return spec .argstr % self .inputs .subject_id
227
223
if name in ["hits_file" , "vox_file" ]:
228
224
return spec .argstr % self ._get_outfilename (name )
225
+ if name == "out_type" and value in implicit_filetypes :
226
+ return ""
229
227
return super (SampleToSurface , self )._format_arg (name , spec , value )
230
228
231
229
def _get_outfilename (self , opt = "out_file" ):
232
230
outfile = getattr (self .inputs , opt )
233
231
if not isdefined (outfile ) or isinstance (outfile , bool ):
234
232
if isdefined (self .inputs .out_type ):
235
233
if opt == "hits_file" :
236
- suffix = '_hits.' + self . filemap [self .inputs .out_type ]
234
+ suffix = '_hits.' + filemap [self .inputs .out_type ]
237
235
else :
238
- suffix = '.' + self . filemap [self .inputs .out_type ]
236
+ suffix = '.' + filemap [self .inputs .out_type ]
239
237
elif opt == "hits_file" :
240
238
suffix = "_hits.mgz"
241
239
else :
0 commit comments