public class MedicalViewer : Control
Public Class MedicalViewer
Inherits System.Windows.Forms.Control
Implements System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
public ref class MedicalViewer : public System.Windows.Forms.Control, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
The MedicalViewer is used to display graphics from a bitmap, metafile, icon, JPEG, GIF or PNG (or any other image file format supported by LEADTOOLS toolkits) file. It provides support for displaying one or more images and for the real-time manipulation of one or more images. This control is available only in the Medical toolkits. For more information, refer to Document/Medical Edition Support and Licensing Requirements
This control is a high-level component for building medical display applications such as DICOM viewers, view stations, Teleradiology solutions, and high-end diagnostic workstations found in radiology and other medical specialty departments. When building a PACS for radiology, cardiology, mammography, ophthalmology, pathology, dermatology, dentistry or any other specialty, this control will eliminate project complexity and provide a solid, reliable foundation.
Typical applications that can be built using this control include:
Key Features:
For more information, refer to Applying Actions and Using the Image Viewer.
This examples creates a control and adds an image
using Leadtools;
using Leadtools.Codecs;
using Leadtools.MedicalViewer;
public void MedicalViewerExample()
{
MainForm1 form = new MainForm1();
form.ShowDialog();
}
// MainForm1 will be the owner of the medical viewer control.
class MainForm1 : Form
{
private MedicalViewer _medicalViewer;
void MedicalViewerForm_SizeChanged(object sender, EventArgs e)
{
_medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom);
}
public MainForm1()
{
RasterCodecs _codecs = new RasterCodecs();
RasterImage _image;
// Create the medical viewer and adjust the size and the location.
_medicalViewer = new MedicalViewer(1, 2);
_medicalViewer.Location = new Point(0, 0);
_medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom);
// Load an image and then add it to the control.
_image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image3.cmp"));
MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1);
// add some actions that will be used to change the properties of the images inside the control.
cell.AddAction(MedicalViewerActionType.WindowLevel);
cell.AddAction(MedicalViewerActionType.Scale);
cell.AddAction(MedicalViewerActionType.Offset);
cell.AddAction(MedicalViewerActionType.Stack);
// assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated.
cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
cell.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active);
cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);
// assign the added actions to a keyboard keys that will work like the mouse.
MedicalViewerKeys medicalKeys = new MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None);
cell.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys);
medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl;
cell.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys);
medicalKeys.MouseDown = Keys.PageDown;
medicalKeys.MouseUp = Keys.PageUp;
cell.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys);
medicalKeys.MouseDown = Keys.Subtract;
medicalKeys.MouseUp = Keys.Add;
cell.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys);
_medicalViewer.Cells.Add(cell);
// adjust some properties of the cell and add some tags.
cell.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448");
cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);
cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy");
cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445");
cell.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929");
cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999");
cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit);
cell.Rows = 1;
cell.Columns = 1;
cell.Frozen = false;
cell.DisplayRulers = MedicalViewerRulers.Both;
cell.ApplyOnIndividualSubCell = false;
cell.ApplyActionOnMove = true;
cell.FitImageToCell = true;
cell.Selected = true;
cell.ShowTags = true;
// Load an image and then add it to the control.
_image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image2.cmp"));
MedicalViewerMultiCell cell1 = new MedicalViewerMultiCell(_image);
_medicalViewer.Cells.Add(cell1);
// add some actions that will be used to change the properties of the images inside the control.
cell1.AddAction(MedicalViewerActionType.WindowLevel);
cell1.AddAction(MedicalViewerActionType.Scale);
cell1.AddAction(MedicalViewerActionType.Offset);
cell1.AddAction(MedicalViewerActionType.Stack);
// assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated.
cell1.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
cell1.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
cell1.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active);
cell1.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);
// assign the added actions to a keyboard keys that will work like the mouse.
medicalKeys = new MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None);
cell1.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys);
medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl;
cell1.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys);
medicalKeys.MouseDown = Keys.PageDown;
medicalKeys.MouseUp = Keys.PageUp;
cell1.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys);
medicalKeys.MouseDown = Keys.Subtract;
medicalKeys.MouseUp = Keys.Add;
cell1.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys);
// adjust some properties of the cell and add some tags.
cell1.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448");
cell1.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
cell1.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
cell1.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
cell1.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);
cell1.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy");
cell1.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445");
cell1.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929");
cell1.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999");
cell1.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit);
cell1.Rows = 2;
cell1.Columns = 2;
cell1.Frozen = false;
cell1.DisplayRulers = MedicalViewerRulers.Both;
cell1.ApplyOnIndividualSubCell = false;
cell1.ApplyActionOnMove = true;
cell1.FitImageToCell = true;
cell1.Selected = true;
cell1.ShowTags = true;
Controls.Add(_medicalViewer);
_medicalViewer.Dock = DockStyle.Fill;
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.MedicalViewer
Public Sub MedicalViewerExample()
Dim form As MainForm1 = New MainForm1()
form.ShowDialog()
End Sub
' MainForm1 will be the owner of the medical viewer control.
Private Class MainForm1 : Inherits Form
Private _medicalViewer As MedicalViewer
Private Sub MedicalViewerForm_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
_medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
End Sub
Public Sub New()
Dim _codecs As RasterCodecs = New RasterCodecs()
Dim _image As RasterImage
' Create the medical viewer and adjust the size and the location.
_medicalViewer = New MedicalViewer(1, 2)
_medicalViewer.Location = New Point(0, 0)
_medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
' Load an image and then add it to the control.
_image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\Image3.cmp"))
Dim cell As MedicalViewerMultiCell = New MedicalViewerMultiCell(_image, True, 1, 1)
' add some actions that will be used to change the properties of the images inside the control.
cell.AddAction(MedicalViewerActionType.WindowLevel)
cell.AddAction(MedicalViewerActionType.Scale)
cell.AddAction(MedicalViewerActionType.Offset)
cell.AddAction(MedicalViewerActionType.Stack)
' assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated.
cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active)
cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active)
cell.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active)
cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active)
' assign the added actions to a keyboard keys that will work like the mouse.
Dim medicalKeys As MedicalViewerKeys = New MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None)
cell.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys)
medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl
cell.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys)
medicalKeys.MouseDown = Keys.PageDown
medicalKeys.MouseUp = Keys.PageUp
cell.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys)
medicalKeys.MouseDown = Keys.Subtract
medicalKeys.MouseUp = Keys.Add
cell.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys)
_medicalViewer.Cells.Add(cell)
' adjust some properties of the cell and add some tags.
cell.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")
cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)
cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy")
cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445")
cell.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929")
cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999")
cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit)
cell.Rows = 1
cell.Columns = 1
cell.Frozen = False
cell.DisplayRulers = MedicalViewerRulers.Both
cell.ApplyOnIndividualSubCell = False
cell.ApplyActionOnMove = True
cell.FitImageToCell = True
cell.Selected = True
cell.ShowTags = True
' Load an image and then add it to the control.
_image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image2.cmp"))
Dim cell1 As MedicalViewerMultiCell = New MedicalViewerMultiCell(_image)
_medicalViewer.Cells.Add(cell1)
' add some actions that will be used to change the properties of the images inside the control.
cell1.AddAction(MedicalViewerActionType.WindowLevel)
cell1.AddAction(MedicalViewerActionType.Scale)
cell1.AddAction(MedicalViewerActionType.Offset)
cell1.AddAction(MedicalViewerActionType.Stack)
' assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated.
cell1.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active)
cell1.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active)
cell1.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active)
cell1.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active)
' assign the added actions to a keyboard keys that will work like the mouse.
medicalKeys = New MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None)
cell1.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys)
medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl
cell1.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys)
medicalKeys.MouseDown = Keys.PageDown
medicalKeys.MouseUp = Keys.PageUp
cell1.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys)
medicalKeys.MouseDown = Keys.Subtract
medicalKeys.MouseUp = Keys.Add
cell1.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys)
' adjust some properties of the cell and add some tags.
cell1.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")
cell1.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
cell1.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
cell1.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
cell1.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)
cell1.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy")
cell1.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445")
cell1.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929")
cell1.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999")
cell1.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit)
cell1.Rows = 2
cell1.Columns = 2
cell1.Frozen = False
cell1.DisplayRulers = MedicalViewerRulers.Both
cell1.ApplyOnIndividualSubCell = False
cell1.ApplyActionOnMove = True
cell1.FitImageToCell = True
cell1.Selected = True
cell1.ShowTags = True
Controls.Add(_medicalViewer)
_medicalViewer.Dock = DockStyle.Fill
End Sub
End Class
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document