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
3cb87363
Commit
3cb87363
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Image textures now clamp to edge values, rather than returning 0.
parent
b25c9b12
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fsl/fslview/gl/gl21/glvolume_frag.glsl
+3
-3
3 additions, 3 deletions
fsl/fslview/gl/gl21/glvolume_frag.glsl
fsl/fslview/gl/gl21/test_in_bounds.glsl
+0
-11
0 additions, 11 deletions
fsl/fslview/gl/gl21/test_in_bounds.glsl
fsl/fslview/gl/textures.py
+7
-8
7 additions, 8 deletions
fsl/fslview/gl/textures.py
with
10 additions
and
22 deletions
fsl/fslview/gl/gl21/glvolume_frag.glsl
+
3
−
3
View file @
3cb87363
...
...
@@ -58,18 +58,18 @@ void main(void) {
/*
* Normalise voxel coordinates to (0.0, 1.0)
*/
voxCoords
.
xyz
=
voxCoords
.
xyz
/
imageShape
.
xyz
;
voxCoords
=
voxCoords
/
imageShape
;
/*
* Look up the voxel value
*/
float
voxValue
;
if
(
useSpline
)
voxValue
=
spline_interp
(
imageTexture
,
voxCoords
.
xyz
,
voxCoords
,
imageShape
,
0
);
else
voxValue
=
texture3D
(
imageTexture
,
voxCoords
.
xyz
).
r
;
voxCoords
).
r
;
/*
* Transform the voxel value to a colour map texture
...
...
This diff is collapsed.
Click to expand it.
fsl/fslview/gl/gl21/test_in_bounds.glsl
+
0
−
11
View file @
3cb87363
...
...
@@ -14,16 +14,5 @@ bool test_in_bounds(inout vec3 coords, vec3 shape) {
return
false
;
}
/*
* Be lenient at voxel boundaries
*/
if
(
coords
.
x
<
0
.
0
)
coords
.
x
=
0
.
01
;
if
(
coords
.
y
<
0
.
0
)
coords
.
y
=
0
.
01
;
if
(
coords
.
z
<
0
.
0
)
coords
.
z
=
0
.
01
;
if
(
coords
.
x
>=
shape
.
x
)
coords
.
x
=
shape
.
x
-
0
.
01
;
if
(
coords
.
y
>=
shape
.
y
)
coords
.
y
=
shape
.
y
-
0
.
01
;
if
(
coords
.
z
>=
shape
.
z
)
coords
.
z
=
shape
.
z
-
0
.
01
;
return
true
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fsl/fslview/gl/textures.py
+
7
−
8
View file @
3cb87363
...
...
@@ -437,20 +437,19 @@ class ImageTexture(object):
gl
.
GL_TEXTURE_MIN_FILTER
,
interp
)
# Make everything outside
# of the image transparent
gl
.
glTexParameterfv
(
gl
.
GL_TEXTURE_3D
,
gl
.
GL_TEXTURE_BORDER_COLOR
,
np
.
array
([
0
,
0
,
0
,
0
],
dtype
=
np
.
float32
))
# Clamp texture borders to the edge
# values - it is the responsibility
# of the rendering logic to not draw
# anything outside of the image space
gl
.
glTexParameteri
(
gl
.
GL_TEXTURE_3D
,
gl
.
GL_TEXTURE_WRAP_S
,
gl
.
GL_CLAMP_TO_
BORDER
)
gl
.
GL_CLAMP_TO_
EDGE
)
gl
.
glTexParameteri
(
gl
.
GL_TEXTURE_3D
,
gl
.
GL_TEXTURE_WRAP_T
,
gl
.
GL_CLAMP_TO_
BORDER
)
gl
.
GL_CLAMP_TO_
EDGE
)
gl
.
glTexParameteri
(
gl
.
GL_TEXTURE_3D
,
gl
.
GL_TEXTURE_WRAP_R
,
gl
.
GL_CLAMP_TO_
BORDER
)
gl
.
GL_CLAMP_TO_
EDGE
)
# create the texture according to
# the format determined by the
...
...
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