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.Texture
The
LookupTableTexture
class is a 1DTexture
which stores the colours of aLookupTable
as an OpenGL texture.A
LookupTable
stores 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 anumpy
array 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 aLookupTableTexture
can 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:lut
The
LookupTable
instance.alpha
Transparency, a value between 0.0 and 1.0. Defaults to 1.0
brightness
Brightness, a value between 0.0 and 1.0. Defaults to 0.5.
contrast
Contrast, 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 theLookupTable
has changed, so that the underlying texture is kept consistent with it.
- __refresh(*a)
Configures the underlying OpenGL texture.
- __annotations__ = {}
- __module__ = 'fsleyes.gl.textures.lookuptabletexture'