Capítulo 570 de 859

Chapter 570: Lut

Core Idea

Represents a lookup table for colormaps. It is used to determine the color values from a range of data values.

Key Concepts

  • isLut : boolean (readonly): This flag can be used for type testing.
  • lut : Array.<Color>: The lookup table for the selected color map
  • map : Array.<Array.<number>>: The currently selected color map.
  • maxV : number: The maximum value to be represented with the lookup table.
  • minV : number: The minimum value to be represented with the lookup table.
  • n : number: The number of colors of the current selected color map.

Code Examples

const lut = new Lut( 'rainbow', 512 );
const color = lut.getColor( 0.5 );
  • What it demonstrates: Typical usage of Lut.

Reference Tables

Constructor

Signature
`new Lut( colormap : 'rainbow'

Properties

PropertyDescription
.isLut : boolean (readonly)This flag can be used for type testing.
.lut : Array.<Color>The lookup table for the selected color map
.map : Array.<Array.<number>>The currently selected color map.
.maxV : numberThe maximum value to be represented with the lookup table.
.minV : numberThe minimum value to be represented with the lookup table.
.n : numberThe number of colors of the current selected color map.

Methods

MethodDescription
.addColorMap( name : string, arrayOfColors : Array.<Array.<number>> ) : LutAdds a color map to this Lut instance.
.copy( lut : Lut ) : LutCopies the given lut.
.createCanvas() : HTMLCanvasElementCreates a canvas in order to visualize the lookup table as a texture.
.getColor( alpha : number ) : ColorReturns an instance of Color for the given data value.
.set( value : Lut ) : LutSets the given LUT.
.setColorMap( colormap : string, count : number ) : LutConfigure the lookup table for the given color map and number of colors.
.setMax( max : number ) : LutSets the maximum value to be represented with this LUT.
.setMin( min : number ) : LutSets the minimum value to be represented with this LUT.
.updateCanvas( canvas : HTMLCanvasElement ) : HTMLCanvasElementUpdates the given canvas with the Lut's data.

Key Takeaways

  1. Most relevant properties: isLut, lut, map, maxV.
  2. Key methods: addColorMap, copy, createCanvas, getColor.

Connects To