L_DlgWindowLevel

#include "l_bitmap.h"

L_LTDLG_API L_INT L_DlgWindowLevel(hWndOwner, pDlgParams)

L_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 MedicalMedical 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.

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_INT DlgWindowLevelExample(HWND           hWnd, 
                             pBITMAPHANDLE  pBitmap) 
{ 
   L_INT nRet; 
   L_INT nSize = 0 ; 
   L_INT nHighBit,nLowBit; 
   WINDOWLEVELDLGPARAMS DlgParams; 
 
   nLowBit = pBitmap->LowBit; 
   nHighBit = 1<<(pBitmap->HighBit - pBitmap->LowBit + 1); 
 
   memset(&DlgParams, 0, sizeof (WINDOWLEVELDLGPARAMS)); 
 
   nSize = ( L_UINT32 ) ( 1L<< ( nHighBit - nLowBit + 1 ) ) ; 
 
   DlgParams.uStructSize       = sizeof (WINDOWLEVELDLGPARAMS); 
   DlgParams.pBitmap           = pBitmap; 
   DlgParams.pLUT              = ( RGBQUAD * ) malloc ( ( nSize * sizeof ( RGBQUAD ) ) ) ; 
   DlgParams.uLUTLength        = ( L_UINT32 ) nSize ; 
   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          ; 
 
   nRet = L_DlgInit ( DLG_INIT_COLOR ) ; 
   if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED) 
      return nRet; 
 
   nRet = L_DlgWindowLevel ( hWnd, &DlgParams ) ; 
   if(nRet < 1) 
      return nRet; 
 
   L_DlgFree(); 
   free(DlgParams.pLUT); 
   return SUCCESS; 
} 
Help Version 20.0.2019.3.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Common Dialog C API Help