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
a32bb518
Commit
a32bb518
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Comment updates
parent
5f201514
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/fslview/slicecanvas.py
+19
-18
19 additions, 18 deletions
fsl/fslview/slicecanvas.py
with
19 additions
and
18 deletions
fsl/fslview/slicecanvas.py
+
19
−
18
View file @
a32bb518
...
...
@@ -27,24 +27,24 @@ import fsl.data.fslimage as fslimage
class
GLImageData
(
object
):
"""
A GLImageData object encapsulates the OpenGL information necessary
to render
an
image.
to render
2D slices of a 3D
image.
A slice from one image is rendered using
three
buffers and
one
texture. The first buffer, the
'
geometry buffer
'
simply contains four
vertices, which define
the geometry
of a single voxel (us
in
g
t
riangle
strips).
The second buffer, the
'
position buffer
'
, contains the location of every
voxel in one slice of the image (these locations are identical for every
slice of the image, so we can re-use the location information for every
slice). The four vertices for each voxel (from the geometry buffer, above)
are offset by the voxel position, which is read from this position buffer.
The
third buffer, the
'
image buffer
'
contains the image data itself,
s
caled to lie between 0 and 255. It is used to calculate voxel colours.
Finally,
the
texture
, the
'
colour buffer
'
,
is used to store a lookup table
containing colours
.
A slice from one image is rendered using
four
buffers and
two textures.
The first buffer,
the
'
geometry
buffer
'
simply conta
in
s
t
he 3D
coordinates (single precision floating point) of four vertices, which
define the geometry of a single voxel (using triangle strips).
The remaining buffers contain the X, Y, and Z coordinates of the voxels
in the slice to be displayed. These coordinates are stored as single
precision floating points, and used both to position a voxel, and to
look up its value in the 3D data texture (see below).
The
image data itself is stored as a 3D texture, with each voxel value
s
tored as a single unsigned byte in the range 0-255.
Finally,
a 1D
texture
is used
is used to store a lookup table
containing
an RGBA8 colour map, to colour each voxel according to its value
.
"""
def
__init__
(
self
,
image
,
canvas
):
...
...
@@ -201,6 +201,7 @@ class GLImageData(object):
return
imageBuffer
def
updateColourBuffer
(
self
):
"""
Regenerates the colour buffer used to colour image voxels.
...
...
@@ -235,7 +236,7 @@ class GLImageData(object):
colourmap
=
display
.
cmap
(
newRange
)
# The colour data is stored on
# the GPU as 8 bit rgb t
ri
ple
t
s
# the GPU as 8 bit rgb
a
t
u
ples
colourmap
=
np
.
floor
(
colourmap
*
255
)
colourmap
=
np
.
array
(
colourmap
,
dtype
=
np
.
uint8
)
colourmap
=
colourmap
.
ravel
(
order
=
'
C
'
)
...
...
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