Sets up the paint or paint and image processing functions' window leveling options for a specific bitmap.
#include "ltwrappr.h"
virtual L_INT LBitmap::WindowLevel(nLowBit, nHighBit, pLUT, uLUTLength, uFlags)
Value indicating the low bit used for leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).
Value indicating the high bit used for leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).
Optional lookup table that can be used to implement a user defined conversion. For every intensity value between 0 and 2 raised to the power of (nHighBit - nLowBit + 1) - 1 there should be a corresponding entry in the lookup table that contains an RGB quad. If pLUT is NULL, the conversion is a normal shift (right or left) and the painted bitmap is 8-bit grayscale. If pLUT is not NULL, the painted bitmap is a 24-bit bitmap.
Value indicating the number of entries pointed to by pLUT.
Flag that indicates whether pLUT is used by the paint and image processing functions or only by the paint functions. Possible values are:
Value | Meaning |
---|---|
WINDOWLEVEL_PAINT | [0x00] pLUT is used only by the paint functions. |
WINDOWLEVEL_PAINT_AND_PROCESSING | [0x01] pLUT is used for both paint and image processing routines. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Provides "on demand" window leveling for the paint functions and does not alter the image data. To convert the image data to a window leveled bitmap, use LBitmap::WindowLevelBitmap.
If WINDOWLEVEL_PAINT_PROCESSING is specified, then all image processing functions will take the pLUT into account.
For information on saving bitmaps that have been window leveled, refer to Saving Window-Leveled Bitmaps.
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.
This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical 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.
Win32, x64.
//WindowLevel
L_INT LBitmap__WindowLevelExample()
{
L_INT nRet;
LBitmap LeadBitmap;
nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")), 0,ORDER_BGR);
if(nRet !=SUCCESS)
return nRet;
nRet =LeadBitmap.WindowLevel(1, 5, NULL, 0, 0);
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document