ShowWindowLevelDlg example for Delphi
procedure TForm1.ShowWindowLevelDlg1Click (Sender: TObject);
var
i: L_INT;
nRet: L_INT;
begin
LEADImage1.GrayScale ( 12 ); {make image 12-bit grayscale}
LEADImage1.ForceRepaint ( );
LEADDlgColor1.WindowLevelStartColor:= clRed;
LEADDlgColor1.WindowLevelEndColor:= clBlue;
LEADDlgColor1.LEADImage:= LEADImage1; {assign the main control for processing}
LEADDlgColor1.DlgFlags:= DLG_WINDOWLEVEL_SHOW_PREVIEW +
DLG_WINDOWLEVEL_SHOW_TOOL_ZOOMLEVEL +
DLG_WINDOWLEVEL_SHOW_RANGE;
LEADImage1.GetMinMaxBits();
LEADImage1.GetMinMaxVal();
LEADDlgColor1.WindowLevelLowBit:= LEADImage1.MinBit;
LEADDlgColor1.WindowLevelHighBit:= LEADImage1.MaxBit;
LEADDlgColor1.WindowLevelLow:= LEADImage1.MinVal;
LEADDlgColor1.WindowLevelHigh:= LEADImage1.MaxVal;
LEADDlgColor1.WindowLevelFactor:= 10;
LEADDlgColor1.WindowLevelFlags:= FILLLUT_INSIDE + FILLLUT_LOGARITHMIC;
nRet:= LEADDlgColor1.ShowWindowLevelDlg ( Self );
if ( nRet = SUCCESS_DLG_OK ) then
begin
LEADImage1.WindowLevelBitmap:= false;
LEADImage1.LevelLowBit:= LEADDlgColor1.WindowLevelLowBit;
LEADImage1.LevelHighBit:= LEADDlgColor1.WindowLevelHighBit;
for i:= 0 to LEADDlgColor1.WindowLevelLUTLength -1 do
begin
LEADImage1.LevelLUT[i]:= LEADDlgColor1.WindowLevelLUT [i];
end;
LEADImage1.WindowLevel ( );
end;
end;