The IMAGE_1D property on the IDLgrImage object lets you load color lookup table (LUT) values into a texture map and pass the LUT to a shader program. LUTs are useful for a number of tasks including:

  • Displaying palletized images.
  • Adding color to greyscale images.
  • Optimizing the evaluation of expensive functions. For example, if your image is 8-bit greyscale and you need to apply an expensive function to each pixel it is normally more efficient to pass each of the 256 greyscale values to the function and store the result in a 256 entry LUT used for drawing.
  • Adjusting image brightness, gamma, contrast, color balance and other settings.
  • Adjusting data ranges such as converting an 11-bit image to 8-bits for display (see “High Precision Images” for more information).

Example Code

See shader_lut_doc__define.pro, located in the examples/doc/shaders subdirectory of the IDL distribution, for the complete, working example. Run the example by creating an instance of the object at the IDL command prompt using oLUTshader=OBJ_NEW('shader_lut_doc') or view the file in an IDL Editor window by entering:

.EDIT shader_lut_doc__define.pro