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
63cf0779
Commit
63cf0779
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
GL14 volume supports separate clip image.
parent
b3098871
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/fsleyes/gl/gl14/glvolume_frag.prog
+28
-6
28 additions, 6 deletions
fsl/fsleyes/gl/gl14/glvolume_frag.prog
fsl/fsleyes/gl/gl14/glvolume_funcs.py
+12
-8
12 additions, 8 deletions
fsl/fsleyes/gl/gl14/glvolume_funcs.py
with
40 additions
and
14 deletions
fsl/fsleyes/gl/gl14/glvolume_frag.prog
+
28
−
6
View file @
63cf0779
...
@@ -35,8 +35,10 @@
...
@@ -35,8 +35,10 @@
# component determines the clipping direction - pass
# component determines the clipping direction - pass
# in -1 for the above behaviour, or +1 to invert
# in -1 for the above behaviour, or +1 to invert
# this behaviour (i.e. to clip values that are within
# this behaviour (i.e. to clip values that are within
# the range). Clipping values are assumed to be
# the range). The (w) component is a boolen flag which
# normalised to the image texture value range.
# indicates whether the image texture is to be used
# as the clip texture. Clipping values are assumed to
# be normalised to the image texture value range.
#
#
# program.local[6] - Negative colour map control. The (x) component
# program.local[6] - Negative colour map control. The (x) component
# is a boolean flag controlling whether the negative
# is a boolean flag controlling whether the negative
...
@@ -57,10 +59,12 @@ TEMP voxCoord;
...
@@ -57,10 +59,12 @@ TEMP voxCoord;
TEMP voxClipLo;
TEMP voxClipLo;
TEMP voxClipHi;
TEMP voxClipHi;
TEMP voxValue;
TEMP voxValue;
TEMP clipValue;
TEMP posColour;
TEMP posColour;
TEMP negColour;
TEMP negColour;
TEMP useNegCmap;
TEMP useNegCmap;
TEMP negVoxValue;
TEMP negVoxValue;
TEMP negClipValue;
PARAM imageShape = program.local[4];
PARAM imageShape = program.local[4];
PARAM clipping = program.local[5];
PARAM clipping = program.local[5];
...
@@ -81,8 +85,15 @@ MOV voxCoord, fragment.texcoord[1];
...
@@ -81,8 +85,15 @@ MOV voxCoord, fragment.texcoord[1];
#pragma include test_in_bounds.prog
#pragma include test_in_bounds.prog
# look up image voxel value
# look up image voxel value
# from 3D image texture
# and clipping value from 3D
TEX voxValue.x, fragment.texcoord[0], texture[0], 3D;
# image/clipping textures
TEX voxValue.x, fragment.texcoord[0], texture[0], 3D;
TEX clipValue.x, fragment.texcoord[0], texture[3], 3D;
# If the image texture is the clip
# texture, overwrite the clip value
# we just looked up.
CMP clipValue.x, clipping.w, clipValue.x, voxValue.x;
# Figure out which negative colour map
# Figure out which negative colour map
# should be used for this fragment.
# should be used for this fragment.
...
@@ -108,16 +119,27 @@ MUL useNegCmap.x, useNegCmap.x, -1;
...
@@ -108,16 +119,27 @@ MUL useNegCmap.x, useNegCmap.x, -1;
ADD negVoxValue.x, negCmap.y, negCmap.y;
ADD negVoxValue.x, negCmap.y, negCmap.y;
SUB negVoxValue.x, negVoxValue.x, voxValue.x;
SUB negVoxValue.x, negVoxValue.x, voxValue.x;
# And do the same for the clip value -
# this is necessary if the image texture
# is the clipping texture.
ADD negClipValue.x, negCmap.y, negCmap.y;
SUB negClipValue.x, negClipValue.x, clipValue.x;
# If we're using the negative colour
# If we're using the negative colour
# map, replace the original voxel
# map, replace the original voxel
# value with the inverted one.
# value with the inverted one.
CMP voxValue.x, useNegCmap.x, negVoxValue.x, voxValue.x;
CMP voxValue.x, useNegCmap.x, negVoxValue.x, voxValue.x;
# And do the same to the clip value if
# the image texture is the clip texture.
CMP negClipValue.x, useNegCmap.x, negClipValue.x, clipValue.x;
CMP clipValue.x, clipping.w, clipValue.x, negClipValue.x;
# Test the low clipping range
# Test the low clipping range
SUB voxClipLo,
vox
Value.x, clipping.x;
SUB voxClipLo,
clip
Value.x, clipping.x;
# And the high clipping range
# And the high clipping range
SUB voxClipHi,
vox
Value.x, clipping.y;
SUB voxClipHi,
clip
Value.x, clipping.y;
# Multiply the low/high results - after
# Multiply the low/high results - after
# this, voxClipLo will be positive if
# this, voxClipLo will be positive if
...
...
This diff is collapsed.
Click to expand it.
fsl/fsleyes/gl/gl14/glvolume_funcs.py
+
12
−
8
View file @
63cf0779
...
@@ -93,19 +93,23 @@ def updateShaderState(self):
...
@@ -93,19 +93,23 @@ def updateShaderState(self):
# And the clipping range, normalised
# And the clipping range, normalised
# to the image texture value range
# to the image texture value range
invClip
=
1
if
opts
.
invertClipping
else
-
1
invClip
=
1
if
opts
.
invertClipping
else
-
1
useNegCmap
=
1
if
opts
.
useNegativeCmap
else
0
useNegCmap
=
1
if
opts
.
useNegativeCmap
else
0
imageIsClip
=
1
if
opts
.
clipImage
is
None
else
-
1
xform
=
self
.
imageTexture
.
invVoxValXform
clipLo
=
opts
.
clippingRange
[
0
]
*
xform
[
0
,
0
]
+
xform
[
3
,
0
]
imgXform
=
self
.
imageTexture
.
invVoxValXform
clipHi
=
opts
.
clippingRange
[
1
]
*
xform
[
0
,
0
]
+
xform
[
3
,
0
]
if
opts
.
clipImage
is
None
:
clipXform
=
imgXform
texZero
=
0.0
*
xform
[
0
,
0
]
+
xform
[
3
,
0
]
else
:
clipXform
=
self
.
clipTexture
.
invVoxValXform
clipLo
=
opts
.
clippingRange
[
0
]
*
clipXform
[
0
,
0
]
+
clipXform
[
3
,
0
]
clipHi
=
opts
.
clippingRange
[
1
]
*
clipXform
[
0
,
0
]
+
clipXform
[
3
,
0
]
texZero
=
0.0
*
imgXform
[
0
,
0
]
+
imgXform
[
3
,
0
]
shaders
.
setVertexProgramVector
(
0
,
shape
+
[
0
])
shaders
.
setVertexProgramVector
(
0
,
shape
+
[
0
])
shaders
.
setFragmentProgramMatrix
(
0
,
voxValXform
)
shaders
.
setFragmentProgramMatrix
(
0
,
voxValXform
)
shaders
.
setFragmentProgramVector
(
4
,
shape
+
[
0
])
shaders
.
setFragmentProgramVector
(
4
,
shape
+
[
0
])
shaders
.
setFragmentProgramVector
(
5
,
[
clipLo
,
clipHi
,
invClip
,
0
])
shaders
.
setFragmentProgramVector
(
5
,
[
clipLo
,
clipHi
,
invClip
,
imageIsClip
])
shaders
.
setFragmentProgramVector
(
6
,
[
useNegCmap
,
texZero
,
0
,
0
])
shaders
.
setFragmentProgramVector
(
6
,
[
useNegCmap
,
texZero
,
0
,
0
])
gl
.
glDisable
(
arbvp
.
GL_VERTEX_PROGRAM_ARB
)
gl
.
glDisable
(
arbvp
.
GL_VERTEX_PROGRAM_ARB
)
...
...
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