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
Model registry
Operate
Environments
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
FSL
fslpy
Commits
59fdc02a
Commit
59fdc02a
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Normalised image textures are now stored as 16 bit, rather than 8
bit. Was getting precision errors in clipping.
parent
fb1a598f
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/fslview/gl/gl21/glvolume_funcs.py
+8
-11
8 additions, 11 deletions
fsl/fslview/gl/gl21/glvolume_funcs.py
fsl/fslview/gl/textures/imagetexture.py
+7
-7
7 additions, 7 deletions
fsl/fslview/gl/textures/imagetexture.py
with
15 additions
and
18 deletions
fsl/fslview/gl/gl21/glvolume_funcs.py
+
8
−
11
View file @
59fdc02a
...
@@ -125,21 +125,18 @@ def updateShaderState(self):
...
@@ -125,21 +125,18 @@ def updateShaderState(self):
# range, but the shader needs them to be in image
# range, but the shader needs them to be in image
# texture value range (0.0 - 1.0). So let's scale
# texture value range (0.0 - 1.0). So let's scale
# them.
# them.
clipLow
=
opts
.
clippingRange
[
0
]
*
\
xform
=
self
.
imageTexture
.
invVoxValXform
self
.
imageTexture
.
invVoxValXform
[
0
,
0
]
+
\
clipLow
=
opts
.
clippingRange
[
0
]
*
xform
[
0
,
0
]
+
xform
[
3
,
0
]
self
.
imageTexture
.
invVoxValXform
[
3
,
0
]
clipHigh
=
opts
.
clippingRange
[
1
]
*
xform
[
0
,
0
]
+
xform
[
3
,
0
]
clipHigh
=
opts
.
clippingRange
[
1
]
*
\
self
.
imageTexture
.
invVoxValXform
[
0
,
0
]
+
\
self
.
imageTexture
.
invVoxValXform
[
3
,
0
]
gl
.
glUniform1f
(
self
.
clipLowPos
,
clipLow
)
gl
.
glUniform1f
(
self
.
clipLowPos
,
clipLow
)
gl
.
glUniform1f
(
self
.
clipHighPos
,
clipHigh
)
gl
.
glUniform1f
(
self
.
clipHighPos
,
clipHigh
)
gl
.
glUniform1f
(
self
.
invertClipPos
,
opts
.
invertClipping
)
gl
.
glUniform1f
(
self
.
invertClipPos
,
opts
.
invertClipping
)
# Bind transformation matri
ces
to transform
# Bind transformation matri
x
to transform
#
display coordinat
es to voxel
coordinat
es,
#
from image texture valu
es to voxel
valu
es,
# and to scale voxel values to
colour map
# and
and
to scale
said
voxel values to
# texture coordinates
#
colour map
texture coordinates
vvx
=
transform
.
concat
(
self
.
imageTexture
.
voxValXform
,
vvx
=
transform
.
concat
(
self
.
imageTexture
.
voxValXform
,
self
.
colourTexture
.
getCoordinateTransform
())
self
.
colourTexture
.
getCoordinateTransform
())
vvx
=
np
.
array
(
vvx
,
dtype
=
np
.
float32
).
ravel
(
'
C
'
)
vvx
=
np
.
array
(
vvx
,
dtype
=
np
.
float32
).
ravel
(
'
C
'
)
...
...
This diff is collapsed.
Click to expand it.
fsl/fslview/gl/textures/imagetexture.py
+
7
−
7
View file @
59fdc02a
...
@@ -227,7 +227,7 @@ class ImageTexture(texture.Texture):
...
@@ -227,7 +227,7 @@ class ImageTexture(texture.Texture):
# for signed types.
# for signed types.
# Texture data type
# Texture data type
if
self
.
__normalise
:
texDtype
=
gl
.
GL_UNSIGNED_
BYTE
if
self
.
__normalise
:
texDtype
=
gl
.
GL_UNSIGNED_
SHORT
elif
dtype
==
np
.
uint8
:
texDtype
=
gl
.
GL_UNSIGNED_BYTE
elif
dtype
==
np
.
uint8
:
texDtype
=
gl
.
GL_UNSIGNED_BYTE
elif
dtype
==
np
.
int8
:
texDtype
=
gl
.
GL_UNSIGNED_BYTE
elif
dtype
==
np
.
int8
:
texDtype
=
gl
.
GL_UNSIGNED_BYTE
elif
dtype
==
np
.
uint16
:
texDtype
=
gl
.
GL_UNSIGNED_SHORT
elif
dtype
==
np
.
uint16
:
texDtype
=
gl
.
GL_UNSIGNED_SHORT
...
@@ -246,28 +246,28 @@ class ImageTexture(texture.Texture):
...
@@ -246,28 +246,28 @@ class ImageTexture(texture.Texture):
# Internal texture format
# Internal texture format
if
self
.
nvals
==
1
:
if
self
.
nvals
==
1
:
if
self
.
__normalise
:
intFmt
=
gl
.
GL_LUMINANCE
8
if
self
.
__normalise
:
intFmt
=
gl
.
GL_LUMINANCE
16
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_LUMINANCE8
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_LUMINANCE8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_LUMINANCE8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_LUMINANCE8
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_LUMINANCE16
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_LUMINANCE16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_LUMINANCE16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_LUMINANCE16
elif
self
.
nvals
==
2
:
elif
self
.
nvals
==
2
:
if
self
.
__normalise
:
intFmt
=
gl
.
GL_LUMINANCE
8
_ALPHA
8
if
self
.
__normalise
:
intFmt
=
gl
.
GL_LUMINANCE
16
_ALPHA
16
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_LUMINANCE8_ALPHA8
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_LUMINANCE8_ALPHA8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_LUMINANCE8_ALPHA8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_LUMINANCE8_ALPHA8
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_LUMINANCE16_ALPHA16
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_LUMINANCE16_ALPHA16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_LUMINANCE16_ALPHA16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_LUMINANCE16_ALPHA16
elif
self
.
nvals
==
3
:
elif
self
.
nvals
==
3
:
if
self
.
__normalise
:
intFmt
=
gl
.
GL_RGB
8
if
self
.
__normalise
:
intFmt
=
gl
.
GL_RGB
16
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_RGB8
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_RGB8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_RGB8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_RGB8
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_RGB16
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_RGB16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_RGB16
elif
dtype
==
np
.
int16
:
intFmt
=
gl
.
GL_RGB16
elif
self
.
nvals
==
4
:
elif
self
.
nvals
==
4
:
if
self
.
__normalise
:
intFmt
=
gl
.
GL_RGBA
8
if
self
.
__normalise
:
intFmt
=
gl
.
GL_RGBA
16
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_RGBA8
elif
dtype
==
np
.
uint8
:
intFmt
=
gl
.
GL_RGBA8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_RGBA8
elif
dtype
==
np
.
int8
:
intFmt
=
gl
.
GL_RGBA8
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_RGBA16
elif
dtype
==
np
.
uint16
:
intFmt
=
gl
.
GL_RGBA16
...
@@ -385,8 +385,8 @@ class ImageTexture(texture.Texture):
...
@@ -385,8 +385,8 @@ class ImageTexture(texture.Texture):
dmax
=
float
(
data
.
max
())
dmax
=
float
(
data
.
max
())
if
dmax
!=
dmin
:
if
dmax
!=
dmin
:
data
=
(
data
-
dmin
)
/
(
dmax
-
dmin
)
data
=
(
data
-
dmin
)
/
(
dmax
-
dmin
)
data
=
np
.
round
(
data
*
25
5
)
data
=
np
.
round
(
data
*
6553
5
)
data
=
np
.
array
(
data
,
dtype
=
np
.
uint
8
)
data
=
np
.
array
(
data
,
dtype
=
np
.
uint
16
)
elif
dtype
==
np
.
uint8
:
pass
elif
dtype
==
np
.
uint8
:
pass
elif
dtype
==
np
.
int8
:
data
=
np
.
array
(
data
+
128
,
dtype
=
np
.
uint8
)
elif
dtype
==
np
.
int8
:
data
=
np
.
array
(
data
+
128
,
dtype
=
np
.
uint8
)
...
...
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