23
23
isdefined , Undefined )
24
24
25
25
26
- from nipype .utils .filemanip import load_json , save_json , split_filename , fname_presuffix
26
+ from nipype .utils .filemanip import load_json , save_json , split_filename , fname_presuffix , FileNotFoundError
27
27
28
28
warn = warnings .warn
29
29
warnings .filterwarnings ('always' , category = UserWarning )
@@ -316,7 +316,8 @@ 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 = File (exists = True , desc = 'Base name for output files from topup' , argstr = '--topup=%s' )
319
+ in_topup = traits .Str ('topup_basename' , desc = 'Base name for output files from topup' ,
320
+ argstr = '--topup=%s' , usedefault = False )
320
321
flm = traits .Enum ( ('linear' ,'quadratic' ,'cubic' ), desc = 'First level EC model' , argstr = '--flm=%s' )
321
322
fwhm = traits .Float ( desc = 'FWHM for conditioning filter when estimating the parameters' , argstr = '--fwhm=%s' )
322
323
niter = traits .Int ( 5 , desc = 'Number of iterations' , argstr = '--niter=%s' )
@@ -357,6 +358,12 @@ def _parse_inputs( self, skip=None ):
357
358
if skip is None :
358
359
skip = []
359
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
+
360
367
if not isdefined (self .inputs .out_base ):
361
368
self .inputs .out_base = os .path .abspath ( './eddy_corrected' )
362
369
return super (Eddy , self )._parse_inputs (skip = skip )
@@ -365,7 +372,7 @@ def _parse_inputs( self, skip=None ):
365
372
def _list_outputs (self ):
366
373
outputs = self .output_spec ().get ()
367
374
outputs ['out_corrected' ] = '%s.nii.gz' % self .inputs .out_base
368
- outputs ['out_parameter' ] = '%s.. eddy_parameters' % self .inputs .out_base
375
+ outputs ['out_parameter' ] = '%s.eddy_parameters' % self .inputs .out_base
369
376
return outputs
370
377
371
378
0 commit comments