@@ -263,11 +263,13 @@ def _overload_extension(self, value, name=None):
263
263
264
264
class ApplyTOPUPInputSpec (FSLCommandInputSpec ):
265
265
in_files = InputMultiPath (File (exists = True ), mandatory = True ,
266
- desc = 'name of 4D file with images' , argstr = '%s' )
266
+ desc = 'name of 4D file with images' ,
267
+ argstr = '--imain=%s...' , sep = ',' )
267
268
encoding_file = File (exists = True , mandatory = True ,
268
269
desc = 'name of text file with PE directions/times' ,
269
270
argstr = '--datain=%s' )
270
- in_index = traits .List (argstr = '%s' , mandatory = True ,
271
+ in_index = traits .List (traits .Int , argstr = '--inindex=%d...' , sep = ',' ,
272
+ mandatory = True ,
271
273
desc = ('comma separated list of indicies into '
272
274
'--datain of the input image (to be '
273
275
'corrected)' ))
@@ -290,7 +292,9 @@ class ApplyTOPUPInputSpec(FSLCommandInputSpec):
290
292
291
293
292
294
class ApplyTOPUPOutputSpec ( TraitedSpec ):
293
- out_corrected = File ( exists = True , desc = 'name of 4D image file with unwarped images' )
295
+ out_corrected = File ( exists = True , desc = ('name of 4D image file with '
296
+ 'unwarped images' ))
297
+
294
298
295
299
class ApplyTOPUP ( FSLCommand ):
296
300
""" Interface for FSL topup, a tool for estimating and correcting susceptibility induced distortions.
@@ -306,9 +310,10 @@ class ApplyTOPUP( FSLCommand ):
306
310
>>> applytopup.inputs.in_files = [ "epi.nii", "epi_rev.nii" ]
307
311
>>> applytopup.inputs.encoding_file = "topup_encoding.txt"
308
312
>>> applytopup.inputs.in_index = [ 1,2 ]
309
- >>> applytopup.inputs.in_topup = "my_topup_results"
313
+ >>> applytopup.inputs.in_topup_fieldcoef = "topup_fieldcoef.nii.gz"
314
+ >>> applytopup.inputs.in_topup_movpar = "topup_movpar.txt"
310
315
>>> applytopup.cmdline #doctest: +ELLIPSIS
311
- 'applytopup --datain=topup_encoding.txt --imain=epi.nii,epi_rev.nii --inindex=1,2 --topup=my_topup_results --out=.../nipypeatu '
316
+ 'applytopup --datain=topup_encoding.txt --imain=epi.nii,--imain= epi_rev.nii --inindex=1,--inindex= 2 --topup=topup --out=epi_corrected.nii.gz '
312
317
>>> res = applytopup.run() # doctest: +SKIP
313
318
314
319
"""
@@ -317,35 +322,9 @@ class ApplyTOPUP( FSLCommand ):
317
322
output_spec = ApplyTOPUPOutputSpec
318
323
319
324
def _format_arg (self , name , spec , value ):
320
- # first do what should be done in general
321
- formated = super (ApplyTOPUP , self )._format_arg (name , spec , value )
322
- if name == 'in_files' or name == 'in_index' :
323
- if name == 'in_files' :
324
- formated = '--imain='
325
- else :
326
- formated = '--inindex='
327
-
328
- formated = formated + "%s" % value [0 ]
329
- for fname in value [1 :]:
330
- formated = formated + ",%s" % fname
331
- return formated
332
-
333
- def _parse_inputs ( self , skip = None ):
334
- if skip is None :
335
- skip = []
336
-
337
- if not isdefined (self .inputs .out_base ):
338
- self .inputs .out_base = './nipypeatu'
339
-
340
- self .inputs .out_base = os .path .abspath (self .inputs .out_base )
341
- return super (ApplyTOPUP , self )._parse_inputs (skip = skip )
342
-
343
-
344
- def _list_outputs (self ):
345
- outputs = self .output_spec ().get ()
346
- outputs ['out_corrected' ] = '%s.nii.gz' % self .inputs .out_base
347
- return outputs
348
-
325
+ if name == 'in_topup_fieldcoef' :
326
+ return spec .argstr % value .split ('_fieldcoef' )[0 ]
327
+ return super (ApplyTOPUP , self )._format_arg (name , spec , value )
349
328
350
329
351
330
class EddyInputSpec ( FSLCommandInputSpec ):
0 commit comments