Skip to content

Commit e42d906

Browse files
committed
Use FSLDIR, warn instead of throwing exception
1 parent 5ab828d commit e42d906

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import nibabel as nb
2222
import warnings
2323

24+
from ... import logging
2425
from ...utils.filemanip import split_filename
2526
from ...utils import NUMPY_MMAP
2627

@@ -522,18 +523,20 @@ def _num_threads_update(self):
522523

523524
@staticmethod
524525
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')):
526+
logger = logging.getLogger('interface')
527+
if 'FSLDIR' not in os.environ:
528+
logger.warn("FSLDIR not set: assuming command 'eddy'")
529+
return 'eddy'
530+
531+
FSLDIR = os.environ['FSLDIR']
532+
if use_cuda and os.path.exists(os.path.join(FSLDIR, 'eddy_cuda')):
530533
return 'eddy_cuda'
531-
elif os.path.exists(os.path.join(FSL_BIN, 'eddy_openmp')):
534+
elif os.path.exists(os.path.join(FSLDIR, 'eddy_openmp')):
532535
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))
536+
elif not os.path.exists(os.path.join(FSLDIR, 'eddy')):
537+
logger.warn("No eddy binary found in FSLDIR; assuming command "
538+
"'eddy'\nFSLDIR: '{}'".format(FSLDIR))
539+
return 'eddy'
537540

538541
@property
539542
def _cmd(self):

0 commit comments

Comments
 (0)