Skip to content

Commit ff883ba

Browse files
committed
Fix version 2 for Eddy-Wrapper does not work properly #769
1 parent 664f6fd commit ff883ba

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ class EddyInputSpec( FSLCommandInputSpec ):
316316

317317

318318
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' )
321323
flm = traits.Enum( ('linear','quadratic','cubic'), desc='First level EC model', argstr='--flm=%s' )
322324
fwhm = traits.Float( desc='FWHM for conditioning filter when estimating the parameters', argstr='--fwhm=%s' )
323325
niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s' )
@@ -354,16 +356,15 @@ class Eddy( FSLCommand ):
354356
input_spec = EddyInputSpec
355357
output_spec = EddyOutputSpec
356358

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+
357364
def _parse_inputs( self, skip=None ):
358365
if skip is None:
359366
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+
367368
if not isdefined(self.inputs.out_base ):
368369
self.inputs.out_base = os.path.abspath( './eddy_corrected' )
369370
return super(Eddy, self)._parse_inputs(skip=skip)

0 commit comments

Comments
 (0)