fsleyes.gl.textures.selectiontexture

This module provides the SelectionTexture class, a Texture type which can be used to store Selection instances.

The SelectionTexture class is used by the VoxelSelection annotation.

class fsleyes.gl.textures.selectiontexture.SelectionTexture(name, selection)

Bases: fsleyes.gl.textures.texture.Texture

The SelectionTexture class is a Texture which can be used to represent a Selection instance. The Selection image array is stored as a single channel 3D texture, which is updated whenever the Selection.selection property changes, and whenever the refresh() method is called.

__init__(name, selection)

Create a SelectionTexture.

Parameters:
  • name – A unique name for this SelectionTexture.
  • selection – The Selection instance.
destroy()

Must be called when this SelectionTexture is no longer needed. Calls the Texture.destroy() method, and removes the listener on the Selection.selection property.

refresh(block=None, offset=None)

Refreshes the texture data from the Selection image data.

If block and offset are not provided, the entire texture is refreshed from the Selection instance. If you know that only part of the selection data has changed, you can use the block and offset arguments to refresh a specific region of the texture (which will be faster than a full : refresh).

Parameters:
  • block – A 3D numpy array containing the new selection data.
  • offset – A tuple specifying the (x, y, z) offset of the block into the selection array.
_SelectionTexture__init()

Called by __init__(). Configures the GL texture.

_SelectionTexture__selectionChanged(*a)

Called when the Selection.selection changes. Updates the texture data via the refresh() method.

__module__ = 'fsleyes.gl.textures.selectiontexture'