Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
f0a7333b
Commit
f0a7333b
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
BF: Support palette images
parent
cd79e13e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/bitmap.py
+14
-6
14 additions, 6 deletions
fsl/data/bitmap.py
with
14 additions
and
6 deletions
fsl/data/bitmap.py
+
14
−
6
View file @
f0a7333b
...
...
@@ -61,12 +61,20 @@ class Bitmap(object):
except
ImportError
:
raise
RuntimeError
(
'
Install Pillow to use the Bitmap class
'
)
source
=
bmp
data
=
np
.
array
(
Image
.
open
(
source
))
src
=
bmp
img
=
Image
.
open
(
src
)
# If this is a palette/LUT
# image, convert it into a
# regular rgb(a) image.
if
img
.
mode
==
'
P
'
:
img
=
img
.
convert
()
data
=
np
.
array
(
img
)
elif
isinstance
(
bmp
,
np
.
ndarray
):
s
ou
rc
e
=
'
array
'
data
=
np
.
copy
(
bmp
)
src
=
'
array
'
data
=
np
.
copy
(
bmp
)
else
:
raise
ValueError
(
'
unknown bitmap: {}
'
.
format
(
bmp
))
...
...
@@ -83,8 +91,8 @@ class Bitmap(object):
w
,
h
=
data
.
shape
[:
2
]
self
.
__data
=
data
self
.
__dataSource
=
s
ou
rc
e
self
.
__name
=
op
.
basename
(
s
ou
rc
e
)
self
.
__dataSource
=
src
self
.
__name
=
op
.
basename
(
src
)
def
__hash__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment