@@ -314,11 +314,9 @@ class ApplyTOPUPInputSpec(FSLCommandInputSpec):
314314 encoding_file = File (exists = True , mandatory = True ,
315315 desc = 'name of text file with PE directions/times' ,
316316 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' )
322320 in_topup_fieldcoef = File (exists = True , argstr = "--topup=%s" , copyfile = False ,
323321 requires = ['in_topup_movpar' ],
324322 desc = ('topup file containing the field '
@@ -360,7 +358,6 @@ class ApplyTOPUP(FSLCommand):
360358 >>> applytopup = ApplyTOPUP()
361359 >>> applytopup.inputs.in_files = ["epi.nii", "epi_rev.nii"]
362360 >>> applytopup.inputs.encoding_file = "topup_encoding.txt"
363- >>> applytopup.inputs.in_index = [1,2]
364361 >>> applytopup.inputs.in_topup_fieldcoef = "topup_fieldcoef.nii.gz"
365362 >>> applytopup.inputs.in_topup_movpar = "topup_movpar.txt"
366363 >>> applytopup.inputs.output_type = "NIFTI_GZ"
@@ -374,6 +371,17 @@ class ApplyTOPUP(FSLCommand):
374371 input_spec = ApplyTOPUPInputSpec
375372 output_spec = ApplyTOPUPOutputSpec
376373
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+
377385 def _format_arg (self , name , spec , value ):
378386 if name == 'in_topup_fieldcoef' :
379387 return spec .argstr % value .split ('_fieldcoef' )[0 ]
0 commit comments