ImageGear for C and C++ on Windows v19.2 - Updated
Grayscale Look-Up Tables
User Guide > How to Work with... > Common Operations > Viewing > Grayscale Look-Up Tables

The ImageGear display API allows storing a grayscale (single-channel) look-up table (LUT) with an image's display settings. The grayscale look-up table can be set for any image, but ImageGear only uses it with 8...16-bit grayscale images, and ignores it with the other images. This look-up table specifies a transform from 16-bit image to 8-bit image, which allows the display of a particular part of an 8...16-bit image's contrast range, or enhanced image's contrast.

Grayscale Look Up Tables map a 8…16 bit image to 8 bit grayscale, allowing you to display a specific contrast range of an image, or to apply a non-linear transform to the image pixels for display. Many image processing functions also take the grayscale Look Up Tables into account, and apply processing on the contrast range specified by the grayscale LUT rather on the whole contrast range.

A grayscale LUT can be stored with a 16g image as well. However, if both the image and its display contain LUTs, the display LUT overrides the image's LUT. A LUT can be removed from an image and attached to a display, or vice versa.

Storing a grayscale LUT with display settings allows you to display the same image with different LUTs simultaneously in different windows.

A grayscale LUT can be used in combination with a RGB LUT. The grayscale LUT is applied first, and then the RGB LUT is applied.

ImageGear provides a set of functions for working with grayscale LUTs. A grayscale LUT object is represented as an opaque handle: HIGLUT. Use the IG_LUT_... group of functions to create, destroy, and access features of grayscale LUTs.

Use IG_dspl_grayscale_LUT_update_from() to create or update a grayscale LUT with the specified LUT. LUT data will be copied to the display settings. Set the lut parameter to NULL to remove the grayscale LUT from display settings.

Use IG_dspl_grayscale_LUT_exists() to check whether display settings contain a grayscale LUT.

Use IG_dspl_grayscale_LUT_copy_get() to obtain a copy of the display grayscale LUT.

ImageGear allows you to attach grayscale LUTs to images and to image display settings.

A HIGLUT object can have various input and output depths. Both input and output can be signed or unsigned.

The ImageGear Medical Component provides a set of API functions that allow building grayscale LUTs according to various DICOM display settings. See also Displaying Medical Grayscale Images.

The only allowed LUT configuration for display is: InputDepth = 16, OutputDepth = 8, Output is unsigned. Such LUTs can be used with grayscale images whose depth is 8... 16 bits per pixel.

Example:

 
Copy Code
HIGLUT GrayLUT;
AT_INT index;
// Create a LUT
IG_LUT_create(12, TRUE, 8, FALSE, &GrayLUT);
// Fill the LUT with a linear table, transforming 12-bit signed image to 8-bit
unsigned
for (index = -2048; index<2048; index++)
{
        value = (index + 2048) / 16;
        IG_LUT_item_set(GrayLUT, index, value);
}
IG_image_grayscale_LUT_update_from(hIGear, GrayLUT);