Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
2e519abc
Commit
2e519abc
authored
Nov 30, 2021
by
Paul McCarthy
🚵
Browse files
Merge branch 'mnt/jpeg2000' into 'master'
MNT: Rudimentary support for JPEG 2000. See merge request fsl/fslpy!316
parents
8d1f3fa3
decb9bec
Pipeline
#12188
passed with stages
in 16 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.rst
View file @
2e519abc
...
...
@@ -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)
---------------------------------
...
...
fsl/data/bitmap.py
View file @
2e519abc
...
...
@@ -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'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment