Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
a2b84c22
Commit
a2b84c22
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Handle NIFTI images which have the wrong number of dimensions in their
header
parent
fb12da26
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/image.py
+22
-2
22 additions, 2 deletions
fsl/data/image.py
fsl/fslview/gl/textures.py
+43
-0
43 additions, 0 deletions
fsl/fslview/gl/textures.py
with
65 additions
and
2 deletions
fsl/data/image.py
+
22
−
2
View file @
a2b84c22
...
...
@@ -190,8 +190,28 @@ class Image(props.HasProperties):
be called if the ``loadData`` parameter passed to :meth:`__init__`
was ``False``.
"""
self
.
data
=
self
.
nibImage
.
get_data
()
self
.
data
.
flags
.
writeable
=
False
data
=
self
.
nibImage
.
get_data
()
# Squeeze out empty dimensions, as
# 3D image can sometimes be listed
# as having 4 or more dimensions
shape
=
data
.
shape
for
i
in
reversed
(
range
(
len
(
shape
))):
if
shape
[
i
-
1
]
==
1
:
data
=
data
.
squeeze
(
axis
=
i
-
1
)
data
.
flags
.
writeable
=
False
log
.
debug
(
'
Loaded image data ({}) - original
'
'
shape {}, squeezed shape {}
'
.
format
(
self
.
name
,
shape
,
data
.
shape
))
self
.
data
=
data
def
applyChange
(
self
,
offset
,
newVals
,
vol
=
None
):
...
...
This diff is collapsed.
Click to expand it.
fsl/fslview/gl/textures.py
+
43
−
0
View file @
a2b84c22
...
...
@@ -354,6 +354,49 @@ class ImageTexture(object):
voxValXform
=
transform
.
scaleOffsetXform
(
scale
,
offset
)
if
log
.
getEffectiveLevel
()
==
logging
.
DEBUG
:
if
texDtype
==
gl
.
GL_UNSIGNED_BYTE
:
sTexDtype
=
'
GL_UNSIGNED_BYTE
'
elif
texDtype
==
gl
.
GL_UNSIGNED_SHORT
:
sTexDtype
=
'
GL_UNSIGNED_SHORT
'
if
texFmt
==
gl
.
GL_LUMINANCE
:
sTexFmt
=
'
GL_LUMINANCE
'
elif
texFmt
==
gl
.
GL_LUMINANCE_ALPHA
:
sTexFmt
=
'
GL_LUMINANCE_ALPHA
'
elif
texFmt
==
gl
.
GL_RGB
:
sTexFmt
=
'
GL_RGB
'
elif
texFmt
==
gl
.
GL_RGBA
:
sTexFmt
=
'
GL_RGBA
'
if
intFmt
==
gl
.
GL_LUMINANCE8
:
sIntFmt
=
'
GL_LUMINANCE8
'
elif
intFmt
==
gl
.
GL_LUMINANCE16
:
sIntFmt
=
'
GL_LUMINANCE16
'
elif
intFmt
==
gl
.
GL_LUMINANCE8_ALPHA8
:
sIntFmt
=
'
GL_LUMINANCE8_ALPHA8
'
elif
intFmt
==
gl
.
GL_LUMINANCE16_ALPHA16
:
sIntFmt
=
'
GL_LUMINANCE16_ALPHA16
'
elif
intFmt
==
gl
.
GL_RGB8
:
sIntFmt
=
'
GL_RGB8
'
elif
intFmt
==
gl
.
GL_RGB16
:
sIntFmt
=
'
GL_RGB16
'
elif
intFmt
==
gl
.
GL_RGBA8
:
sIntFmt
=
'
GL_RGBA8
'
elif
intFmt
==
gl
.
GL_RGBA16
:
sIntFmt
=
'
GL_RGBA16
'
log
.
debug
(
'
Image texture ({}) is to be stored as {}/{}/{}
'
'
(normalised: {} - scale {}, offset {})
'
.
format
(
self
.
image
,
sTexDtype
,
sTexFmt
,
sIntFmt
,
self
.
normalise
,
scale
,
offset
))
return
texFmt
,
intFmt
,
texDtype
,
voxValXform
...
...
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