diff --git a/fsl/data/image.py b/fsl/data/image.py index bc1857e299e00c9dabbb1e5ead1c3240c985043e..0afc47c7473690970554cea7aab95ec385bcfd45 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -1389,10 +1389,17 @@ def loadIndexedImageFile(filename): Returns a tuple containing the ``nibabel`` NIFTI image, and the open ``IndexedGzipFile`` handle. + + If ``indexed_gzip`` is not present, the image is loaded normally via + ``nibabel.load``. """ - import threading - import indexed_gzip as igzip + import threading + + try: + import indexed_gzip as igzip + except ImportError: + return nib.load(filename), None log.debug('Loading {} using indexed gzip'.format(filename))