Fills the user-allocated 8-bit LUT with values range between crStart and crEnd colors according to the selected LUT type.

Parameter

Description

pLUT

Pointer to an array to be updated with the RGB quad (i.e. lookup table).

ulLUTLen

The size of pLUT. The minimum size is 2 raised to the power of (uHighBit - uLowBit + 1).

crStart

Starting color value for the gradient.

crEnd

Ending color value for the gradient.

nLow

The low value of the window width, in pixels.

nHigh

The high value for the window width, in pixels.

uLowBit

Value indicating the low bit used for leveling. This is normally 0 and should be less then the uHighBit.

uHighBit

Value indicating the high bit used for leveling. This should be greater or equal to uLowBit and less then 11 for 12-bit grayscale or 15 for 16-bit grayscale.

nMinValue

The bitmap's minimum value. This value can be obtained by L_GetMinMaxVal.

nMaxValue

The bitmap's maximum value. This value can be obtained by L_GetMinMaxVal.

nFactor

Value that indicates the factor to be applied in the function operation specified in the uFlag parameter. This parameter is used only if uFlags is FILLLUT_EXPONENTIAL, FILLLUT_LOGARITHMIC or FILLLUT_SIGMOID. If FILLLUT_EXPONENTIAL or FILLLUT_SIGMOID flag is selected its value can be any integer (+/-). If FILLLUT_LOGARITHMIC flag is selected its value should be >= 0. If nFactor = 0, the lookup table will be filled linearly.

uFlags

Flags that indicate how the range is used to fill the LUT and the type of LUT and whether the LUT contains signed or unsigned data. The following flags indicate how the range is used to fill the LUT:

The nFactor parameter is used for log, exp and sigmoid functions only. If nFactor = 0 the function performs a linear interpolation between the two points nLow and nHigh and stores the results in the lookup table, regardless of the value in uFlags.

If uFlag is FILLLUT_EXPONENTIAL the value of nFactor modifies the lookup table values (see figure below) according to the following equations:

where:

x = the intensity value of the selected point

uStart = the nLow parameter of this function

uEnd = the nHigh parameter of this function

If uFlag is FILLLUT_LOGARITHMIC the value of nFactor modifies the lookup table values (see figure below) according to the following equations:

where:

x = the intensity value of the selected point

uStart = the nLow parameter of this function

uEnd = the nHigh parameter of this function

If uFlag is FILLLUT_SIGMOID the value of nFactor modifies the lookup table values (see figure below)according to the following equations:

where:

x = the intensity value of the selected point

uStart = the nLow parameter of this function

uEnd = the nHigh parameter of this function

If uFlag is FILLLUT_LINEAR, nFactor is ignored. The function fills the lookup table linearly.

Note: This function only works for 12 or 16 bit grayscale images. Trying to use this function with other images will result in an error.

You must allocate the memory for the LUT before calling this function. You can calculate the required size with (sizeof(RGBQUAD) * (1<<(pBitmap->HighBit - pBitmap->LowBit + 1))), as seen in the example below.

For example, suppose you are working with a 12 bit grayscale image. There are 4096 intensity levels in a 12 bit image (2 raised to the 12th power). Normally, the interval between 0 and 4095 for unsigned data would be mapped to colors between (0, 0, 0) and (255, 255, 255). With this function, any value that falls between the low level and the high level will be mapped to colors between the start color and the end color. If you do not want a mapping function, set the start and end colors equal.

If you only want to map the values between 1972 and 3273 (in a 12-bit unsigned image), then set nLow to 1972, set nHigh to 3273, and set FILLLUT_INSIDE option. To map the values less than 1972 and greater than 3273, select FILLLUT_OUTSIDE option.

LEADTOOLS supports two types of LUTs for 10-16-bit grayscale images (8-bit LUT and 16-bit LUT). Typical grayscale image display and processing is done using an 8-bit LUT. But, you can also use a 16-bit LUT, which offers more precision. Some special video cards and monitors also support display of grayscale images using a 16-bit LUT.