Skip to content

Commit 772f540

Browse files
committed
Find eddy command in FSL_BIN
1 parent c9a3b5e commit 772f540

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,25 @@ def _num_threads_update(self):
520520
self.inputs.environ['OMP_NUM_THREADS'] = str(
521521
self.inputs.num_threads)
522522

523+
@staticmethod
524+
def _eddycmd(use_cuda):
525+
if 'FSL_BIN' not in os.environ:
526+
raise RuntimeError("eddy command requires environment variable "
527+
"FSL_BIN to be set")
528+
FSL_BIN = os.environ['FSL_BIN']
529+
if use_cuda and os.path.exists(os.path.join(FSL_BIN, 'eddy_cuda')):
530+
return 'eddy_cuda'
531+
elif os.path.exists(os.path.join(FSL_BIN, 'eddy_openmp')):
532+
return 'eddy_openmp'
533+
elif os.path.exists(os.path.join(FSL_BIN, 'eddy')):
534+
return 'eddy'
535+
raise RuntimeError("eddy command not found in FSL_BIN: "
536+
"'{}'".format(FSL_BIN))
537+
523538
@property
524539
def _cmd(self):
525-
cuda = self.inputs.use_cuda
526-
return 'eddy_cuda' if isdefined(cuda) and cuda else 'eddy_openmp'
540+
return self._eddycmd(isdefined(self.inputs.use_cuda) and
541+
self.inputs.use_cuda)
527542

528543
def _format_arg(self, name, spec, value):
529544
if name == 'in_topup_fieldcoef':

0 commit comments

Comments
 (0)