diff --git a/fsl/data/bitmap.py b/fsl/data/bitmap.py index c7d172c25ab656ff6b62d8f084bfd09171c7c658..ec7b6b1fe1c9e12c5fa8e52c6e52589f1be3281c 100644 --- a/fsl/data/bitmap.py +++ b/fsl/data/bitmap.py @@ -5,7 +5,7 @@ # Author: Paul McCarthy <pauldmccarthy@gmail.com> # """This module contains the :class:`Bitmap` class, for loading bitmap image -files. +files. Pillow is required to use the ``Bitmap`` class. """ @@ -14,7 +14,6 @@ import logging import six import numpy as np -import PIL.Image as Image from . import image as fslimage @@ -52,6 +51,11 @@ class Bitmap(object): data. """ + try: + import PIL.Image as Image + except ImportError: + raise RuntimeError('Install Pillow to use the Bitmap class') + if isinstance(bmp, six.string_types): source = bmp data = np.array(Image.open(source))