fsleyes.gl.glrgbvector
¶
This mdoule provides the GLRGBVector
class, for displaying 3D
vector Image
overlays in RGB mode.
- class fsleyes.gl.glrgbvector.GLRGBVector(image, overlayList, displayCtx, canvas, threedee)[source]¶
Bases:
fsleyes.gl.glvector.GLVector
The
GLRGBVector
class encapsulates the logic required to render ax*y*z*3
Image
instance as a vector image, where the direction of the vector at each voxel is represented by a combination of three colours (one colour per axis). TheGLRGBVector
class assumes that theDisplay
instance associated with theImage
overlay holds a reference to aRGBVectorOpts
instance, which containsGLRGBVector
-specific display settings. TheGLRGBVector
is a sub-class of theGLVector
class, and uses the functionality provided byGLVector
.A
GLRGBVector
can only show the magnitude of a vector, not its orientation. Therefore, the absolute values of theImage
instance are stored in theImageTexture
. This is accomplished by passing aprefilter
function toGLVector.__init__()
, which forces the image values to be unsigned.The
GLRGBVector
uses two OpenGL version-specific modules, thegl14.glrgbvector_funcs
andgl21.glrgbvector_funcs
modules, to manage the vertex/fragment shader programs that are used in rendering. These modules are assumed to provide the following functions:init(GLRGBVector)
Perform any necessary initialisation.
destroy(GLRGBVector)
Perform any necessary clean up.
compileShaders(GLRGBVector)
Compiles vertex/fragment shaders.
updateShaderState(GLRGBVector)
Updates vertex/fragment shaders.
preDraw(GLRGBVector, xform, bbox)
Prepare the GL state for drawing.
draw2D(GLRGBVector, zpos, xform, bbox)
Draw the slice specified by
zpos
.draw3D(GLRGBVector, zpos, xform)
Draw the volume in 3D
drawAll(GLRGBVector, zposes, xforms)
Draw all slices specified by
zposes
.postDraw(GLRGBVector, xform, bbox)
Clean up the GL state after drawing.
- __init__(image, overlayList, displayCtx, canvas, threedee)[source]¶
Create a
GLRGBVector
.- Parameters
image – An
Image
orDTIFitTensor
instance.overlayList – The
OverlayList
displayCtx – The
DisplayContext
managing the scene.canvas – The canvas doing the drawing.
threedee – 2D or 3D rendering
- destroy()[source]¶
Must be called when this
GLRGBVector
is no longer needed. Removes some property listeners from theRGBVectorOpts
instance, calls the OpenGL version-specificdestroy
function, and calls theGLVector.destroy()
method.
- refreshImageTexture()[source]¶
Overrides
GLVector.refreshImageTexture()
. Calls the base class implementation.
- registerAuxImage(which, image, onReady=None)[source]¶
Overrides
GLVector.refreshAuxTexture()
. Calls the base class implementation.
- __interpChanged(*a)¶
Called when the
RGBVectorOpts.interpolation
property changes. Updates theImageTexture
interpolation.
- __unitLengthChanged(*a)¶
Called when
RGBVectorOpts.unitLength
changes. Refreshes the texture data.
- compileShaders()[source]¶
Overrides
GLVector.compileShaders()
. Calls the OpenGL version-specificcompileShaders
function.
- updateShaderState()[source]¶
Overrides
GLVector.compileShaders()
. Calls the OpenGL version-specificupdateShaderState
function.
- preDraw(xform=None, bbox=None)[source]¶
Overrides
GLVector.preDraw()
. Calls the base class implementation, and the OpenGL version-specificpreDraw
function.
- draw2D(*args, **kwargs)[source]¶
Overrides
GLVector.draw2D()
. Calls the OpenGL version-specificdraw2D
function.
- draw3D(*args, **kwargs)[source]¶
Overrides
GLVector.draw3D()
. Calls the OpenGL version-specificdraw3D
function.
- drawAll(*args, **kwargs)[source]¶
Overrides
GLVector.drawAll()
. Calls the OpenGL version-specificdrawAll
function.
- postDraw(xform=None, bbox=None)[source]¶
Overrides
GLVector.postDraw()
. Calls the base class implementation, and the OpenGL version-specificpostDraw
function.
- __annotations__ = {}¶
- __module__ = 'fsleyes.gl.glrgbvector'¶