RasterWindowLevelDialog Class

Summary
Displays the Window Level dialog box.
Syntax
C#
C++
public class RasterWindowLevelDialog : Form 
vb[VB Syntax] 
  
Public Class RasterWindowLevelDialog  
   Inherits System.Windows.Forms.Form 
   Implements System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IContainerControl, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window 
public ref class RasterWindowLevelDialog : public System.Windows.Forms.Form, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IContainerControl, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window   
Remarks

The Window Level dialog can be seen below:

windowleveldialog.jpg
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.WinForms.CommonDialogs.Color; 
 
 
public void windowLevelDlg_Help(object sender, RasterColorDialogHelpEventArgs e) 
{ 
   if (e.Dialog == RasterColorDialogHelpName.WindowLevel) 
   { 
      MessageBox.Show("Window Level dialog Help"); 
   } 
} 
 
 
public void WindowLevelDialogExample() 
{       
   // initialize the RasterCodecs 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // load an image 
   RasterImage rasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Beauty16.jpg")); 
 
   int size; 
   RasterWindowLevelDialog windowLevelDlg = new RasterWindowLevelDialog(); 
   MinMaxBitsCommand minMaxBitsCmd = new MinMaxBitsCommand(); 
   MinMaxValuesCommand minMaxValuesCmd = new MinMaxValuesCommand(); 
 
   size = (1 << (rasterImage.HighBit - rasterImage.LowBit + 1)); 
 
   minMaxBitsCmd.Run(rasterImage); 
   windowLevelDlg.LowBit = minMaxBitsCmd.MinimumBit; 
   windowLevelDlg.HighBit = minMaxBitsCmd.MaximumBit; 
 
   minMaxValuesCmd.Run(rasterImage); 
   windowLevelDlg.Low = minMaxValuesCmd.MinimumValue; 
   windowLevelDlg.High = minMaxValuesCmd.MaximumValue; 
 
   windowLevelDlg.AutoProcess = false; 
   windowLevelDlg.Factor = 0; 
   windowLevelDlg.Image = rasterImage; 
   windowLevelDlg.ZoomToFit = true; 
   windowLevelDlg.ShowPreview = true; 
   windowLevelDlg.ShowZoomLevel = true; 
   windowLevelDlg.ShowHelp = false; 
   windowLevelDlg.ShowRange = true; 
   windowLevelDlg.Signed = rasterImage.Signed; 
   windowLevelDlg.LookupTable = new Leadtools.RasterColor[size]; 
   windowLevelDlg.StartColor = new Leadtools.RasterColor(0, 0, 0); 
   windowLevelDlg.EndColor = new Leadtools.RasterColor(255, 255, 255); 
   windowLevelDlg.WindowLevelFlags = Leadtools.RasterPaletteWindowLevelFlags.Inside | Leadtools.RasterPaletteWindowLevelFlags.Linear; 
   windowLevelDlg.Help += new EventHandler<RasterColorDialogHelpEventArgs>(windowLevelDlg_Help); 
 
 
   if (DialogResult.OK == windowLevelDlg.ShowDialog(null)) 
   { 
      WindowLevelCommand command = new WindowLevelCommand(); 
 
      command.HighBit = windowLevelDlg.HighBit; 
      command.LowBit = windowLevelDlg.LowBit; 
      command.LookupTable = windowLevelDlg.LookupTable; 
      command.Order = Leadtools.RasterByteOrder.Bgr; 
 
      command.Run(rasterImage); 
   } 
 
   // save the resulted image 
   codecs.Save(rasterImage, Path.Combine(LEAD_VARS.ImagesDir, "WindowLevelDialogResult.bmp"), RasterImageFormat.Bmp, 24); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.4.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.