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
655b9bd4
Commit
655b9bd4
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Some gltensor documentation.
parent
06d31aa9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/fsleyes/gl/gl21/gltensor_funcs.py
+4
-1
4 additions, 1 deletion
fsl/fsleyes/gl/gl21/gltensor_funcs.py
fsl/fsleyes/gl/gltensor.py
+54
-5
54 additions, 5 deletions
fsl/fsleyes/gl/gltensor.py
with
58 additions
and
6 deletions
fsl/fsleyes/gl/gl21/gltensor_funcs.py
+
4
−
1
View file @
655b9bd4
#!/usr/bin/env python
#
# gltensor_funcs.py -
# gltensor_funcs.py -
OpenGL2.1 functions used by the GLTensor class.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
...
...
@@ -26,6 +26,9 @@ log = logging.getLogger(__name__)
def
init
(
self
):
"""
Compiles and configures the vertex and fragment shader programs, and
creates textures and vertex buffers.
"""
image
=
self
.
image
...
...
This diff is collapsed.
Click to expand it.
fsl/fsleyes/gl/gltensor.py
+
54
−
5
View file @
655b9bd4
#!/usr/bin/env python
#
# gltensor.py -
# gltensor.py -
The GLTensor class.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""
This module provides the :class:`GLTensor` class, for displaying tensor
ellipsoids in a :class:`.TensorImage` overlay.
See :mod:`.gl21.gltensor_funcs`.
"""
import
logging
import
numpy
as
np
...
...
@@ -14,10 +17,11 @@ import glvector
import
fsl.fsleyes.gl
as
fslgl
log
=
logging
.
getLogger
(
__name__
)
class
GLTensor
(
glvector
.
GLVector
):
"""
The ``GLTensor`` class encapsulates the logic required to render
:class:`.TensorImage` overlays.
"""
def
__init__
(
self
,
image
,
display
):
...
...
@@ -30,13 +34,48 @@ class GLTensor(glvector.GLVector):
def
destroy
(
self
):
"""
Must be called when this ``GLTensor`` is no longer needed. Performs
cleanup tasks.
"""
glvector
.
GLVector
.
destroy
(
self
)
fslgl
.
gltensor_funcs
.
destroy
(
self
)
def
addListeners
(
self
):
"""
Overrides :meth:`.GLVector.addListeners`. Calls the base class
implementation, and adds some property listeners to the
:class:`.TensorOpts` instance associated with the
:class:`.TensorImage` being displayed.
"""
glvector
.
GLVector
.
addListeners
(
self
)
name
=
self
.
name
opts
=
self
.
displayOpts
def
shaderUpdate
(
*
a
):
self
.
updateShaderState
()
self
.
onUpdate
()
opts
.
addListener
(
'
lighting
'
,
name
,
shaderUpdate
,
weak
=
False
)
opts
.
addListener
(
'
tensorResolution
'
,
name
,
shaderUpdate
,
weak
=
False
)
def
removeListeners
(
self
):
"""
Overrides :meth:`.GLVector.removeListeners`. Calls the base class
implementation, and removes some property listeners.
"""
glvector
.
GLVector
.
removeListeners
(
self
)
name
=
self
.
name
opts
=
self
.
displayOpts
opts
.
removeListener
(
'
lighting
'
,
name
)
opts
.
removeListener
(
'
tensorResolution
'
,
name
)
def
getDataResolution
(
self
,
xax
,
yax
):
"""
Overrides :meth:`.GLVector.getDataResolution`. Returns a pixel
resolution suitable for rendering this ``GLTensor``.
resolution suitable for
off-screen
rendering
of
this ``GLTensor``.
"""
res
=
list
(
glvector
.
GLVector
.
getDataResolution
(
self
,
xax
,
yax
))
...
...
@@ -47,22 +86,32 @@ class GLTensor(glvector.GLVector):
def
compileShaders
(
self
):
"""
Overrides :meth:`.GLVector.compileShaders`.
"""
fslgl
.
gltensor_funcs
.
compileShaders
(
self
)
def
updateShaderState
(
self
):
"""
Overrides :meth:`.GLVector.updateShaderState`.
"""
fslgl
.
gltensor_funcs
.
updateShaderState
(
self
)
def
preDraw
(
self
):
"""
Overrides :meth:`.GLVector.preDraw`.
"""
glvector
.
GLVector
.
preDraw
(
self
)
fslgl
.
gltensor_funcs
.
preDraw
(
self
)
def
draw
(
self
,
zpos
,
xform
=
None
):
"""
"""
fslgl
.
gltensor_funcs
.
draw
(
self
,
zpos
,
xform
)
def
postDraw
(
self
):
"""
Overrides :meth:`.GLVector.postDraw`.
"""
glvector
.
GLVector
.
postDraw
(
self
)
fslgl
.
gltensor_funcs
.
postDraw
(
self
)
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