L_DlgWindowLevel

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_DlgWindowLevel(hWndOwner, pDlgParams)

HWND hWndOwner;

/* owner of dialog */

LPWINDOWLEVELDLGPARAMS pDlgParams;

/* pointer to a structure */

Brings up the Window Level dialog box, and gets the options for L_WindowLevel. This function is available in the Medical toolkits.

Parameter

Description

hWndOwner

Handle of the window which owns the dialog.

pDlgParams

Pointer to a WINDOWLEVELDLGPARAMS structure to be updated with the user selected values. Set members of this structure to set the dialog initial values.

Returns

SUCCESS_DLG_OK

The dialog exits successfully after pressing the "OK" button.

SUCCESS_DLG_CANCEL

The dialog exits successfully after pressing the "Cancel" button.

< 1

An error occurred. Refer to Return Codes.

Comments

The Window Level dialog can be seen below:

 

Note:

This dialog only works for 12 or 16 bit grayscale images. Trying to use this dialog 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 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 gradient, set the start and end colors equal.

Required DLLs and Libraries

LTDLGCLR
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTDIS
LTIMG
LTKRN

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:

L_DlgInit, L_WindowLevel, L_WindowLevelBitmap.

Topics:

Dialogs: Color Manipulation

 

Using Imaging Common Dialog

Example

L_VOID ShowDlg(pBITMAPHANDLE pBitmap, HWND hWnd)
{
   WINDOWLEVELDLGPARAMS DlgParams;

   memset(&DlgParams, 0, sizeof (WINDOWLEVELDLGPARAMS));

   DlgParams.uStructSize       = sizeof (WINDOWLEVELDLGPARAMS);
   DlgParams.pBitmap           = pBitmap;
   DlgParams.pLUT              = (L_RGBQUAD L_HUGE*) malloc ( sizeof ( RGBQUAD ) * (1<<(pBitmap->HighBit - pBitmap->LowBit + 1)));
   DlgParams.uLowBit           = pBitmap->LowBit;
   DlgParams.uHighBit          = pBitmap->HighBit;
   DlgParams.nLow              = pBitmap->LowBit;
   DlgParams.nHigh             = 1<<(pBitmap->HighBit - pBitmap->LowBit + 1);
   DlgParams.crStart           = RGB(255,0,0);
   DlgParams.crEnd             = RGB(0,0,255);
   DlgParams.nFactor           = 10;
   DlgParams.uWindowLevelFlags = FILLLUT_INSIDE|FILLLUT_LOGARITHMIC;
   DlgParams.uDlgFlags         = DLG_WINDOWLEVEL_SHOW_PREVIEW | 
                                      DLG_WINDOWLEVEL_AUTOPROCESS | 
                                      DLG_WINDOWLEVEL_SHOW_TOOL_ZOOMLEVEL | 
                                      DLG_WINDOWLEVEL_SHOW_RANGE ;

   L_DlgInit ( DLG_INIT_COLOR ) ; 
   L_DlgWindowLevel ( hWnd, &DlgParams ) ;
   L_DlgFree ( ) ; 
   free(DlgParams.pLUT);
}