diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bc89f66edcd4c40216443cf517fee1f6a5b9c97..222356a9f7fc3b0fa529c254f4cb95583604dc35 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,19 @@ This document contains the ``fslpy`` release history in reverse chronological order. +3.8.0 (Under development) +------------------------- + + +Added +^^^^^ + + +* New :func:`.fslorient` wrapper function (!315). +* The :class:`.Bitmap` class has basic support for loading JPEG2000 images + (!316). + + 3.7.1 (Friday 12th November 2021) --------------------------------- diff --git a/fsl/data/bitmap.py b/fsl/data/bitmap.py index 4562300a794357d6382a3317a34b277f62d2b816..f101a0dda59ff5f0e48558d4ee1b58edcb32f370 100644 --- a/fsl/data/bitmap.py +++ b/fsl/data/bitmap.py @@ -22,7 +22,8 @@ log = logging.getLogger(__name__) BITMAP_EXTENSIONS = ['.bmp', '.png', '.jpg', '.jpeg', - '.tif', '.tiff', '.gif', '.rgba'] + '.tif', '.tiff', '.gif', '.rgba', + '.jp2', '.jpg2', '.jp2k'] """File extensions we understand. """ @@ -34,7 +35,10 @@ BITMAP_DESCRIPTIONS = [ 'TIFF', 'TIFF', 'Graphics Interchange Format', - 'Raw RGBA'] + 'Raw RGBA', + 'JPEG 2000', + 'JPEG 2000', + 'JPEG 2000'] """A description for each :attr:`BITMAP_EXTENSION`. """ @@ -54,9 +58,11 @@ class Bitmap(object): if isinstance(bmp, (pathlib.Path, str)): try: - # Allow big images - import PIL.Image as Image - Image.MAX_IMAGE_PIXELS = 1e9 + # Allow big/truncated images + import PIL.Image as Image + import PIL.ImageFile as ImageFile + Image .MAX_IMAGE_PIXELS = None + ImageFile.LOAD_TRUNCATED_IMAGES = True except ImportError: raise RuntimeError('Install Pillow to use the Bitmap class')