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.GLVectorThe
GLRGBVectorclass encapsulates the logic required to render ax*y*z*3Imageinstance 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). TheGLRGBVectorclass assumes that theDisplayinstance associated with theImageoverlay holds a reference to aRGBVectorOptsinstance, which containsGLRGBVector-specific display settings. TheGLRGBVectoris a sub-class of theGLVectorclass, and uses the functionality provided byGLVector.A
GLRGBVectorcan only show the magnitude of a vector, not its orientation. Therefore, the absolute values of theImageinstance are stored in theImageTexture. This is accomplished by passing aprefilterfunction toGLVector.__init__(), which forces the image values to be unsigned.The
GLRGBVectoruses two OpenGL version-specific modules, thegl14.glrgbvector_funcsandgl21.glrgbvector_funcsmodules, 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
ImageorDTIFitTensorinstance.overlayList – The
OverlayListdisplayCtx – The
DisplayContextmanaging the scene.canvas – The canvas doing the drawing.
threedee – 2D or 3D rendering
-
destroy()[source]¶ Must be called when this
GLRGBVectoris no longer needed. Removes some property listeners from theRGBVectorOptsinstance, calls the OpenGL version-specificdestroyfunction, 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.interpolationproperty changes. Updates theImageTextureinterpolation.
-
__unitLengthChanged(*a)¶ Called when
RGBVectorOpts.unitLengthchanges. Refreshes the texture data.
-
compileShaders()[source]¶ Overrides
GLVector.compileShaders(). Calls the OpenGL version-specificcompileShadersfunction.
-
updateShaderState()[source]¶ Overrides
GLVector.compileShaders(). Calls the OpenGL version-specificupdateShaderStatefunction.
-
preDraw(xform=None, bbox=None)[source]¶ Overrides
GLVector.preDraw(). Calls the base class implementation, and the OpenGL version-specificpreDrawfunction.
-
draw2D(*args, **kwargs)[source]¶ Overrides
GLVector.draw2D(). Calls the OpenGL version-specificdraw2Dfunction.
-
draw3D(*args, **kwargs)[source]¶ Overrides
GLVector.draw3D(). Calls the OpenGL version-specificdraw3Dfunction.
-
drawAll(*args, **kwargs)[source]¶ Overrides
GLVector.drawAll(). Calls the OpenGL version-specificdrawAllfunction.
-
postDraw(xform=None, bbox=None)[source]¶ Overrides
GLVector.postDraw(). Calls the base class implementation, and the OpenGL version-specificpostDrawfunction.
-
__module__= 'fsleyes.gl.glrgbvector'¶
-