fsleyes.gl.gltensor
¶
This module provides the GLTensor
class, for displaying tensor
ellipsoids in a DTIFitTensor
overlay, or compatible Image
overlay.
See gl21.gltensor_funcs
.
-
class
fsleyes.gl.gltensor.
GLTensor
(image, overlayList, displayCtx, canvas, threedee)¶ Bases:
fsleyes.gl.glvector.GLVector
The
GLTensor
class encapsulates the logic required to renderTensorImage
overlays. Most of the functionality is in thegl21.gltensor_funcs
module.Note
The
GLTensor
is not currently supported on versions of OpenGL older than 2.1 (and probably never will be).The eigenvalues and eigenvectors of the overlay are stored as 3D
ImageTexture
instances, using thegl.resources
module. These textures are added as attributes of a GLTensor instance - this is in addition to the textures that are used forGLVector
instances (of which theGLTensor
is a sub-class):Attribute name
Description
Texture unit
v1Texture
First eigenvector
gl.GL_TEXTURE8
v2Texture
Second eigenvector
gl.GL_TEXTURE9
v3Texture
Third eigenvector
gl.GL_TEXTURE10
l1Texture
First eigenvalue
gl.GL_TEXTURE11
l2Texture
Second eigenvalue
gl.GL_TEXTURE12
l3Texture
Third eigenvalue
gl.GL_TEXTURE13
-
__init__
(image, overlayList, displayCtx, canvas, threedee)¶ Create a
GLTensor
. Prepares the eigenvalue and eigenvector textures, and calls thegl21.gltensor_funcs.init()
function.- Parameters
image – A
DTIFitTensor
or compatibleImage
overlay.overlayList – The
OverlayList
displayCtx – The
DisplayContext
managing the scene.canvas – The canvas doing the drawing.
threedee – 2D or 3D rendering.
-
destroy
()¶ Must be called when this
GLTensor
is no longer needed. Performs cleanup tasks.
-
texturesReady
()¶ Overrides
GLVector.texturesReady()
. ReturnsTrue
if all of the textures are ready,False
otherwise.
-
addListeners
()¶ Overrides
GLVector.addListeners()
. Calls the base class implementation, and adds some property listeners to theTensorOpts
instance associated with the overlay being displayed.
-
removeListeners
()¶ Overrides
GLVector.removeListeners()
. Calls the base class implementation, and removes some property listeners.
-
getDataResolution
(xax, yax)¶ Overrides
GLVector.getDataResolution()
. Returns a pixel resolution suitable for off-screen rendering of thisGLTensor
.
-
compileShaders
()¶ Overrides
GLVector.compileShaders()
. Calls thegl21.gltensor_funcs.compileShaders()
function.
-
updateShaderState
()¶ Overrides
GLVector.updateShaderState()
. Calls thegl21.gltensor_funcs.updateShaderState()
function.
-
preDraw
(xform=None, bbox=None)¶ Overrides
GLVector.preDraw()
. Binds the eigenvalue and eigenvector textures, calls theGLVector.preDraw()
method, and thegl21.gltensor_funcs.preDraw()
function.
-
draw2D
(*args, **kwargs)¶ Overrides
GLVector.draw2D()
. Calls thegl21.gltensor_funcs.draw2D()
function.
-
draw3D
(*args, **kwargs)¶ Overrides
GLVector.draw3D()
. Calls thegl21.gltensor_funcs.draw3D()
function.
-
postDraw
(xform=None, bbox=None)¶ Overrides
GLVector.postDraw()
. Unbinds the eigenvalue and eigenvector textures, calls theGLVector.postDraw()
method, and thegl21.gltensor_funcs.postDraw()
function.
-
_GLTensor__tensorResolutionChanged
(*a)¶ Called when the
TensorOpts.tensorResolution
property changes. CallsasyncUpdateShaderState()
.
-
__module__
= 'fsleyes.gl.gltensor'¶
-