LBitmap::WindowLevel

#include "ltwrappr.h"

virtual L_INT LBitmap::WindowLevel(nLowBit, nHighBit, pLUT, uLUTLength, uFlags);

L_INT nLowBit;

/* low bit to use */

L_INT nHighBit;

/* high bit to use */

RGBQUAD * pLUT;

/* lookup table */

L_UINT uLUTLength;

/* number of entries */

L_UINT uFlags;

/* flag that indicates which functions use pLUT*/

Sets up the paint or paint and image processing functions' window leveling options for a specific bitmap.

Parameter

Description

nLowBit

Value indicating the low bit used for leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).

nHighBit

Value indicating the high bit used for leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).

pLUT

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.

uLUTLength

Value indicating the number of entries pointed to by pLUT.

uFlags

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

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.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBitmap::WindowLevelBitmap, LPaint::PaintDC, LPaint::PaintDCBuffer, LPaint::PaintRgnDC, LPaint::PaintRgnDCBuffer, LPaintEffect::PaintRgnDCEffect, Class Members

Topics:

Raster Image Functions: Palettes

 

Raster Image Functions:Displaying and Printing

 

Grayscale Images

 

Saving Window-Leveled Bitmaps

 

Color Halftones and Halftone Images

 

Raster Image Functions: Working with Color Halftones, Halftones, and Grayscale Images

 

Raster Image Functions: Processing an Image

Example

//WindowLevel

L_INT LBitmap__WindowLevelExample()
{
   L_INT nRet;
   LBitmap LeadBitmap;
   nRet =LeadBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\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;
}