#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_ApplyLinearVOILUT (pBitmap, fCenter, fWidth, uFlags)

Sets up the paint or paint and image processing functions' window leveling options for a specific bitmap through a linear transformation described by window center and width.



Pointer to the bitmap handle referencing the bitmap to be leveled.

L_DOUBLE fCenter

Window Center for display.


Window Width for display.

L_UINT uFlags

Flags which determine the behavior of this function. Possible values are one or an OR-ed combination of the following:

Value Meaning
VOI_LUT_UPDATE_MIN_MAX [0x0001] If set, the function will recalculate pBitmap->MinVal based on the minimum intensity inside the bitmap and recalculate pBitmap->MaxVal based on the maximum intensity inside the bitmap.
VOI_LUT_REVERSE_ORDER [0x0002] If set, the function will fill the bitmap display LUT in reverse order (light to dark instead of dark to light).
VOI_LUT_PAINT_ONLY [0x0004] Set the LUT for paint only, not image processing. For more information, refer to BITMAPHANDLE.Flags.UseLUT.
VOI_LUT_IGNORE_EXISTING_PALETTE [0x0008] If set, the function will exclude any existing LookupTable or palette from the calculations.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


This function sets up the paint or paint & image processing functions' window leveling options for a specific bitmap through a linear transformation described by window center and width. In the DICOM world, this is referred to as "applying a linear VOI LUT".

This function will remap the LUT used to display and process a bitmap by applying the linear transformation described by window center and window width. In the DICOM world this is referred to as applying a "linear VOI LUT". The DICOM standard states:

"Window Center and Window Width specify a linear conversion from stored pixel values (after any Modality LUT or Rescale Slope and Intercept specified in the IOD have been applied) to values to be displayed. Window Center contains the input value that is the center of the window. Window Width contains the width of the window." Please see "VOI LUT Module Attributes" in the DICOM standard for more details.

This function does not change the image data; it only updates the entries inside the bitmap LUT.

It is best to always set the VOI_LUT_UPDATE_MIN_MAX flag.

When working with DICOM files you will need to set VOI_LUT_REVERSE_ORDER flag if the photometric interpretation of the image is "MONOCHROME1". If an image is "MONOCHROME1", the minimum grayscale value is intended to be displayed as white after any VOI gray scale transformations have been performed.

This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available in the Document and Medical Imaging toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

The BITMAPHANDLE has some members in its structure that are intended for internal use, including pLUT, PaintHighBit and PaintLowBit that are useful when window-leveling. For more information about these members, used when displaying images or performing image processing, refer to Lookup Table (LUT) in BITMAPHANDLE and its use for Displaying Images and Performing Image Processing. More information can be found in the LTKRN.H header file, which describes the entire structure.

Required DLLs and Libraries


Win32, x64, Linux.

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help