@@ -314,11 +314,9 @@ class ApplyTOPUPInputSpec(FSLCommandInputSpec):
314
314
encoding_file = File (exists = True , mandatory = True ,
315
315
desc = 'name of text file with PE directions/times' ,
316
316
argstr = '--datain=%s' )
317
- in_index = traits .List (traits .Int , argstr = '--inindex=%s' , sep = ',' ,
318
- mandatory = True ,
319
- desc = ('comma separated list of indicies into '
320
- '--datain of the input image (to be '
321
- 'corrected)' ))
317
+ in_index = traits .List (
318
+ traits .Int , argstr = '--inindex=%s' , sep = ',' ,
319
+ desc = 'comma separated list of indices corresponding to --datain' )
322
320
in_topup_fieldcoef = File (exists = True , argstr = "--topup=%s" , copyfile = False ,
323
321
requires = ['in_topup_movpar' ],
324
322
desc = ('topup file containing the field '
@@ -360,7 +358,6 @@ class ApplyTOPUP(FSLCommand):
360
358
>>> applytopup = ApplyTOPUP()
361
359
>>> applytopup.inputs.in_files = ["epi.nii", "epi_rev.nii"]
362
360
>>> applytopup.inputs.encoding_file = "topup_encoding.txt"
363
- >>> applytopup.inputs.in_index = [1,2]
364
361
>>> applytopup.inputs.in_topup_fieldcoef = "topup_fieldcoef.nii.gz"
365
362
>>> applytopup.inputs.in_topup_movpar = "topup_movpar.txt"
366
363
>>> applytopup.inputs.output_type = "NIFTI_GZ"
@@ -374,6 +371,17 @@ class ApplyTOPUP(FSLCommand):
374
371
input_spec = ApplyTOPUPInputSpec
375
372
output_spec = ApplyTOPUPOutputSpec
376
373
374
+ def _parse_inputs (self , skip = None ):
375
+ if skip is None :
376
+ skip = []
377
+
378
+ # If not defined, assume index are the first N entries in the
379
+ # parameters file, for N input images.
380
+ if not isdefined (self .inputs .in_index ):
381
+ self .inputs .in_index = list (range (1 , len (self .inputs .in_files ) + 1 ))
382
+
383
+ return super (ApplyTOPUP , self )._parse_inputs (skip = skip )
384
+
377
385
def _format_arg (self , name , spec , value ):
378
386
if name == 'in_topup_fieldcoef' :
379
387
return spec .argstr % value .split ('_fieldcoef' )[0 ]
0 commit comments