@@ -316,8 +316,10 @@ class EddyInputSpec( FSLCommandInputSpec ):
316
316
317
317
318
318
session = File (exists = True , desc = 'File containing session indices for all volumes in --imain' , argstr = '--session=%s' )
319
- in_topup = traits .Str ('topup_basename' , desc = 'Base name for output files from topup' ,
320
- argstr = '--topup=%s' , usedefault = False )
319
+ in_topup_fieldcoef = File (exists = True , argstr = "--topup=%s" , requires = ['in_topup_movpar' ],
320
+ desc = 'topup file containing the field coefficients' )
321
+ in_topup_movpar = File (exists = True , requires = ['in_topup_fieldcoef' ],
322
+ desc = 'topup movpar.txt file' )
321
323
flm = traits .Enum ( ('linear' ,'quadratic' ,'cubic' ), desc = 'First level EC model' , argstr = '--flm=%s' )
322
324
fwhm = traits .Float ( desc = 'FWHM for conditioning filter when estimating the parameters' , argstr = '--fwhm=%s' )
323
325
niter = traits .Int ( 5 , desc = 'Number of iterations' , argstr = '--niter=%s' )
@@ -354,16 +356,15 @@ class Eddy( FSLCommand ):
354
356
input_spec = EddyInputSpec
355
357
output_spec = EddyOutputSpec
356
358
359
+ def _format_arg (self , name , spec , value ):
360
+ if name == 'in_topup_fieldcoef' :
361
+ return spec .argstr % value .split ('_fieldcoef' )[0 ]
362
+ return super (Eddy , self )._format_arg (name , spec , value )
363
+
357
364
def _parse_inputs ( self , skip = None ):
358
365
if skip is None :
359
366
skip = []
360
-
361
- if isdefined (self .inputs .in_topup ):
362
- if not os .path .isfile (self .inputs .in_topup + '_fieldcoef.nii.gz' ):
363
- raise FileNotFoundError ('File {} not found' .format (self .inputs .in_topup + '_fieldcoef.nii.gz' ))
364
- if not os .path .isfile (self .inputs .in_topup + '_movpar.txt' ):
365
- raise FileNotFoundError ('File {} not found' .format (self .inputs .in_topup + '_movpar.txt' ))
366
-
367
+
367
368
if not isdefined (self .inputs .out_base ):
368
369
self .inputs .out_base = os .path .abspath ( './eddy_corrected' )
369
370
return super (Eddy , self )._parse_inputs (skip = skip )
0 commit comments