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)

Bases: fsleyes.gl.glvector.GLVector

The GLRGBVector class encapsulates the logic required to render a x*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). The GLRGBVector class assumes that the Display instance associated with the Image overlay holds a reference to a RGBVectorOpts instance, which contains GLRGBVector-specific display settings. The GLRGBVector is a sub-class of the GLVector class, and uses the functionality provided by GLVector.

A GLRGBVector can only show the magnitude of a vector, not its orientation. Therefore, the absolute values of the Image instance are stored in the ImageTexture. This is accomplished by passing a prefilter function to GLVector.__init__(), which forces the image values to be unsigned.

The GLRGBVector uses two OpenGL version-specific modules, the gl14.glrgbvector_funcs and gl21.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)

Create a GLRGBVector.

Parameters
  • image – An Image or DTIFitTensor instance.

  • 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 GLRGBVector is no longer needed. Removes some property listeners from the RGBVectorOpts instance, calls the OpenGL version-specific destroy function, and calls the GLVector.destroy() method.

refreshImageTexture()

Overrides GLVector.refreshImageTexture(). Calls the base class implementation.

refreshAuxTexture(which)

Overrides GLVector.refreshAuxTexture(). Calls the base class implementation.

compileShaders()

Overrides GLVector.compileShaders(). Calls the OpenGL version-specific compileShaders function.

updateShaderState()

Overrides GLVector.compileShaders(). Calls the OpenGL version-specific updateShaderState function.

preDraw(xform=None, bbox=None)

Overrides GLVector.preDraw(). Calls the base class implementation, and the OpenGL version-specific preDraw function.

draw2D(*args, **kwargs)

Overrides GLVector.draw2D(). Calls the OpenGL version-specific draw2D function.

draw3D(*args, **kwargs)

Overrides GLVector.draw3D(). Calls the OpenGL version-specific draw3D function.

drawAll(*args, **kwargs)

Overrides GLVector.drawAll(). Calls the OpenGL version-specific drawAll function.

postDraw(xform=None, bbox=None)

Overrides GLVector.postDraw(). Calls the base class implementation, and the OpenGL version-specific postDraw function.

_GLRGBVector__interpChanged(*a)

Called when the RGBVectorOpts.interpolation property changes. Updates the ImageTexture interpolation.

__module__ = 'fsleyes.gl.glrgbvector'