Displays the Window Level dialog box.
Syntax
Visual Basic (Declaration) | |
---|
Public Class RasterWindowLevelDialog
Inherits Form |
C# | |
---|
public class RasterWindowLevelDialog : Form |
Managed Extensions for C++ | |
---|
public __gc class RasterWindowLevelDialog : public Form |
C++/CLI | |
---|
public ref class RasterWindowLevelDialog : public Form |
Example
Visual Basic | Copy Code |
---|
Public Sub _windowLevleDlg_Help(ByVal sender As Object, ByVal e As RasterColorDialogHelpEventArgs) Handles _windowLevleDlg.Help
If e.Dialog = RasterColorDialogHelpName.WindowLevel Then
MessageBox.Show("Window Level dialog Help")
End If
End Sub
WithEvents _windowLevleDlg As New RasterWindowLevelDialog
Public Sub WindowLevelDialogExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp")
Dim size As Integer
Dim minMaxBitsCmd As MinMaxBitsCommand = New MinMaxBitsCommand
Dim minMaxValuesCmd As MinMaxValuesCommand = New MinMaxValuesCommand
size = (1 << (leadImage.HighBit - leadImage.LowBit + 1))
minMaxBitsCmd.Run(leadImage)
_windowLevleDlg.LowBit = minMaxBitsCmd.MinimumBit
_windowLevleDlg.HighBit = minMaxBitsCmd.MaximumBit
minMaxValuesCmd.Run(leadImage)
_windowLevleDlg.Low = minMaxValuesCmd.MinimumValue
_windowLevleDlg.High = minMaxValuesCmd.MaximumValue
ReDim _windowLevleDlg.LookupTable(size)
_windowLevleDlg.AutoProcess = False
_windowLevleDlg.Factor = 0
_windowLevleDlg.Image = leadImage
_windowLevleDlg.ZoomToFit = True
_windowLevleDlg.ShowPreview = True
_windowLevleDlg.ShowZoomLevel = True
_windowLevleDlg.ShowHelp = False
_windowLevleDlg.ShowRange = True
_windowLevleDlg.Signed = leadImage.Signed
_windowLevleDlg.StartColor = New Leadtools.RasterColor(0, 0, 0)
_windowLevleDlg.EndColor = New Leadtools.RasterColor(255, 255, 255)
_windowLevleDlg.WindowLevelFlags = Leadtools.RasterPaletteWindowLevelFlags.Inside Or Leadtools.RasterPaletteWindowLevelFlags.Linear
If DialogResult.OK = _windowLevleDlg.ShowDialog(Nothing) Then
Dim command As WindowLevelCommand = New WindowLevelCommand
command.HighBit = _windowLevleDlg.HighBit
command.LowBit = _windowLevleDlg.LowBit
command.LookupTable = _windowLevleDlg.LookupTable
command.Order = Leadtools.RasterByteOrder.Bgr
command.Run(leadImage)
End If
codecs.Save(leadImage, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\WindowLevelDialogResult.bmp", RasterImageFormat.Bmp, 24)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
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.Startup(); RasterCodecs codecs = new RasterCodecs(); // load an image RasterImage rasterImage = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp"); 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, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\WindowLevelDialogResult.bmp", RasterImageFormat.Bmp, 24); RasterCodecs.Shutdown(); } |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also