fsleyes.gl.textures.lookuptabletexture¶
This module provides the LookupTableTexture class, a 1D
Texture which stores the colours of a LookupTable
as an OpenGL texture.
-
class
fsleyes.gl.textures.lookuptabletexture.LookupTableTexture(name)[source]¶ Bases:
fsleyes.gl.textures.texture.TextureThe
LookupTableTextureclass is a 1DTexturewhich stores the colours of aLookupTableas an OpenGL texture.A
LookupTablestores a collection of label values (assumed to be unsigned 16 bit integers), and colours associated with each label. This mapping of{label : colour}is converted into anumpyarray of size \(max(labels)\times 3\) containing the lookup table, where a label value can be used as an array index to retrieve the corresponding colour. All aspects of aLookupTableTexturecan be configured via theset()method.As OpenGL textures are indexed by coordinates in the range
[0.0, 1.0], you will need to divide label values by \(max(labels)\) to convert them into texture coordinates.Note
Currently, the maximum label value in a lookup table cannot be greater than the maximum size of an OpenGL texture - this limit differs between platforms. In the future, if this class needs to be modified to support larger lookup tables, it will need to be changed to use a 2D texture, and users will need to ravel/unravel texture indices between 1D and 2D coordinates.
-
__init__(name)[source]¶ Create a
LookupTableTexture.- Parameters
name – A uniqe name for this
LookupTableTexture.
-
set(**kwargs)[source]¶ Set any parameters on this
LookupTableTexture. Valid keyword arguments are:lutThe
LookupTableinstance.alphaTransparency, a value between 0.0 and 1.0. Defaults to 1.0
brightnessBrightness, a value between 0.0 and 1.0. Defaults to 0.5.
contrastContrast, a value between 0.0 and 1.0. Defaults to 0.5.
-
refresh()[source]¶ Forces a refresh of this
LookupTableTexture. This method should be called when theLookupTablehas changed, so that the underlying texture is kept consistent with it.
-
_LookupTableTexture__refresh(*a)¶ Configures the underlying OpenGL texture.
-
__module__= 'fsleyes.gl.textures.lookuptabletexture'¶
-