fsleyes.gl.textures.imagetexture

This module provides the ImageTexture class, a Texture3D for storing a Image instance.

class fsleyes.gl.textures.imagetexture.ImageTexture(name, image, **kwargs)

Bases: fsleyes.gl.textures.texture3d.Texture3D

The ImageTexture class contains the logic required to create and manage a 3D texture which represents a Image instance.

Once created, the Image instance is available as an attribute of an ImageTexture object, called image. See the Texture3D documentation for more details.

__init__(name, image, **kwargs)

Create an ImageTexture. A listener is added to the Image.data property, so that the texture data can be refreshed whenever the image data changes - see the __imageDataChanged() method.

Parameters:
  • name – A name for this imageTexure.
  • image – The Image instance.
  • volume – Initial volume index/indices, for >3D images.

All other arguments are passed through to the Texture3D.__init__() method, and thus used as initial texture settings.

destroy()

Must be called when this ImageTexture is no longer needed. Deletes the texture handle, and removes the listener on the Image.data property.

setVolume(volume)

For Image instances with more than three dimensions, specifies the indices for the fourth and above dimensions with which to extract the 3D texture data. If the image has four dimensions, this may be a scalar, otherwise it must be a sequence of (Image.ndim - 3) the correct length.

set(**kwargs)

Overrides Texture3D.set(). Set any parameters on this ImageTexture. This method accepts any parameters that are accepted by Texture3D.set(), plus the following:

volume See setVolume().
volRefresh If True (the default), the texture data will be refreshed even if the volume parameter hasn’t changed. Otherwise, if volume hasn’t changed, the texture will not be refreshed.
Returns:True if any settings have changed and the ImageTexture is to be refreshed , False otherwise.
_ImageTexture__imageDataChanged(image, topic, sliceobj)

Called when the Image notifies about a data changes. Triggers an image texture refresh via a call to set().

Parameters:
  • image – The Image instance
  • topic – The string 'data'
  • sliceobj – Slice object specifying the portion of the image that was changed.
__module__ = 'fsleyes.gl.textures.imagetexture'