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)[source]¶ Bases:
fsleyes.gl.glvector.GLVectorThe
GLTensorclass encapsulates the logic required to renderTensorImageoverlays. Most of the functionality is in thegl21.gltensor_funcsmodule.Note
The
GLTensoris 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
ImageTextureinstances, using thegl.resourcesmodule. These textures are added as attributes of a GLTensor instance - this is in addition to the textures that are used forGLVectorinstances (of which theGLTensoris a sub-class):Attribute name
Description
Texture unit
v1TextureFirst eigenvector
gl.GL_TEXTURE8v2TextureSecond eigenvector
gl.GL_TEXTURE9v3TextureThird eigenvector
gl.GL_TEXTURE10l1TextureFirst eigenvalue
gl.GL_TEXTURE11l2TextureSecond eigenvalue
gl.GL_TEXTURE12l3TextureThird eigenvalue
gl.GL_TEXTURE13-
__init__(image, overlayList, displayCtx, canvas, threedee)[source]¶ Create a
GLTensor. Prepares the eigenvalue and eigenvector textures, and calls thegl21.gltensor_funcs.init()function.- Parameters
image – A
DTIFitTensoror compatibleImageoverlay.overlayList – The
OverlayListdisplayCtx – The
DisplayContextmanaging the scene.canvas – The canvas doing the drawing.
threedee – 2D or 3D rendering.
-
texturesReady()[source]¶ Overrides
GLVector.texturesReady(). ReturnsTrueif all of the textures are ready,Falseotherwise.
-
addListeners()[source]¶ Overrides
GLVector.addListeners(). Calls the base class implementation, and adds some property listeners to theTensorOptsinstance associated with the overlay being displayed.
-
removeListeners()[source]¶ Overrides
GLVector.removeListeners(). Calls the base class implementation, and removes some property listeners.
-
getDataResolution(xax, yax)[source]¶ Overrides
GLVector.getDataResolution(). Returns a pixel resolution suitable for off-screen rendering of thisGLTensor.
-
compileShaders()[source]¶ Overrides
GLVector.compileShaders(). Calls thegl21.gltensor_funcs.compileShaders()function.
-
updateShaderState()[source]¶ Overrides
GLVector.updateShaderState(). Calls thegl21.gltensor_funcs.updateShaderState()function.
-
preDraw(xform=None, bbox=None)[source]¶ Overrides
GLVector.preDraw(). Binds the eigenvalue and eigenvector textures, calls theGLVector.preDraw()method, and thegl21.gltensor_funcs.preDraw()function.
-
draw2D(*args, **kwargs)[source]¶ Overrides
GLVector.draw2D(). Calls thegl21.gltensor_funcs.draw2D()function.
-
draw3D(*args, **kwargs)[source]¶ Overrides
GLVector.draw3D(). Calls thegl21.gltensor_funcs.draw3D()function.
-
postDraw(xform=None, bbox=None)[source]¶ Overrides
GLVector.postDraw(). Unbinds the eigenvalue and eigenvector textures, calls theGLVector.postDraw()method, and thegl21.gltensor_funcs.postDraw()function.
-
__tensorResolutionChanged(*a)¶ Called when the
TensorOpts.tensorResolutionproperty changes. CallsasyncUpdateShaderState().
-
__module__= 'fsleyes.gl.gltensor'¶
-