Skip to content

Commit 664f6fd

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

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
isdefined, Undefined )
2424

2525

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
2727

2828
warn = warnings.warn
2929
warnings.filterwarnings('always', category=UserWarning)
@@ -316,7 +316,8 @@ 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 = 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)
320321
flm = traits.Enum( ('linear','quadratic','cubic'), desc='First level EC model', argstr='--flm=%s' )
321322
fwhm = traits.Float( desc='FWHM for conditioning filter when estimating the parameters', argstr='--fwhm=%s' )
322323
niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s' )
@@ -357,6 +358,12 @@ def _parse_inputs( self, skip=None ):
357358
if skip is None:
358359
skip = []
359360

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+
360367
if not isdefined(self.inputs.out_base ):
361368
self.inputs.out_base = os.path.abspath( './eddy_corrected' )
362369
return super(Eddy, self)._parse_inputs(skip=skip)
@@ -365,7 +372,7 @@ def _parse_inputs( self, skip=None ):
365372
def _list_outputs(self):
366373
outputs = self.output_spec().get()
367374
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
369376
return outputs
370377

371378

0 commit comments

Comments
 (0)