Leadtools.MedicalViewer Requires Medical Imaging license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
MedicalViewerRotate3DPlane Class
See Also  Members   Example 
Leadtools.MedicalViewer Namespace : MedicalViewerRotate3DPlane Class



Represents the class that contains the properties of the rotate 3D plane action, used only with MedicalViewer3DCell.

Syntax

Visual Basic (Declaration) 
Public Class MedicalViewerRotate3DPlane 
   Inherits MedicalViewerCommonActions
Visual Basic (Usage)Copy Code
Dim instance As MedicalViewerRotate3DPlane
C# 
public class MedicalViewerRotate3DPlane : MedicalViewerCommonActions 
C++/CLI 
public ref class MedicalViewerRotate3DPlane : public MedicalViewerCommonActions 

Example

Visual BasicCopy Code
Public Sub MedicalViewerMedicalViewerPlaneCutLineEventArgsExample()
   Dim form As MainForm1 = New MainForm1()
   form.ShowDialog()
End Sub


' MainForm1 will be the owner of the medical viewer control that contains the 3D cell.
Private Class MainForm1 : Inherits Form
   Public _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()
      RasterCodecs.Startup()
      Dim _codecs As RasterCodecs = New RasterCodecs()
      Dim _image As RasterImage

      ' Create the medical viewer and adjust some properties.
      _medicalViewer = New MedicalViewer()
      _medicalViewer.Rows = 1
      _medicalViewer.Columns = 2
      _medicalViewer.Location = New Point(0, 0)
      _medicalViewer.Size = New Size(500, 500)

      ' add some action that will be used to change the properties of the images inside the control.
      _medicalViewer.AddAction(MedicalViewerActionType.Rotate3DObject)
      _medicalViewer.AddAction(MedicalViewerActionType.ReferenceLine)
      _medicalViewer.AddAction(MedicalViewerActionType.WindowLevel)
      _medicalViewer.AddAction(MedicalViewerActionType.Stack)
      _medicalViewer.AddAction(MedicalViewerActionType.RotatePlane)


      ' assign the added actions to a mouse button, meaning that when the user click and drag the mouse button, the associted action will be activated.
      _medicalViewer.SetAction(MedicalViewerActionType.Rotate3DObject, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
      _medicalViewer.SetAction(MedicalViewerActionType.RotatePlane, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
      _medicalViewer.SetAction(MedicalViewerActionType.ReferenceLine, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
      _medicalViewer.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)

      ' Load an image and then add it to the control.
      _image = _codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image1.dic")
      _medicalViewer.Cells.Add(New MedicalViewer3DCell(_image))

      ' adjust some properties to the cell and add some tags.
      _medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Overlay Text1")
      _medicalViewer.Cells(0).SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
      _medicalViewer.Cells(0).SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
      _medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
      _medicalViewer.Cells(0).SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)
      _medicalViewer.Cells(0).SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text2")
      _medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text3")
      _medicalViewer.Cells(0).SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text4")
      _medicalViewer.Cells(0).SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text5")
      _medicalViewer.Cells(0).SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit)
      _medicalViewer.Cells(0).Selected = True

      ' Add a plane
      CType(_medicalViewer.Cells(0), MedicalViewer3DCell).Container.Objects(0).VRT.Planes.Add(New Medical3DPlane())

      Dim rotate3DPlane As MedicalViewerRotate3DPlane = CType(_medicalViewer.GetActionProperties(MedicalViewerActionType.RotatePlane), MedicalViewerRotate3DPlane)
      rotate3DPlane.Axis = Medical3DAxis.Z
      rotate3DPlane.Space = Medical3DSpace.Object

      _medicalViewer.SetActionProperties(MedicalViewerActionType.RotatePlane, rotate3DPlane)

      ' Load an image and then add it to the control.
      _image = _codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image1.dic")
      Dim cell As MedicalViewerCell = New MedicalViewerCell()
      cell.Image = _image
      cell.Rows = 2
      cell.Columns = 2
      cell.Frozen = False
      cell.DisplayRulers = MedicalViewerRulers.Both
      cell.ApplyOnIndividualSubCell = False
      cell.ApplyActionOnMove = True
      cell.FitImageToCell = True
      cell.Selected = True
      cell.ShowTags = True
      _medicalViewer.Cells.Add(cell)

      ' adjust some properties to the cell and add some tags.
      _medicalViewer.Cells(1).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Overlay Text1")
      _medicalViewer.Cells(1).SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
      _medicalViewer.Cells(1).SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
      _medicalViewer.Cells(1).SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
      _medicalViewer.Cells(1).SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)
      _medicalViewer.Cells(1).SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text2")
      _medicalViewer.Cells(1).SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text3")
      _medicalViewer.Cells(1).SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text4")
      _medicalViewer.Cells(1).SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text5")
      _medicalViewer.Cells(1).SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit)
      _medicalViewer.Cells(1).SetTag(0, MedicalViewerTagAlignment.TopCenter, MedicalViewerTagType.TopOrientation)
      _medicalViewer.Cells(1).SetTag(0, MedicalViewerTagAlignment.BottomCenter, MedicalViewerTagType.BottomOrientation)
      _medicalViewer.Cells(1).SetTag(0, MedicalViewerTagAlignment.LeftCenter, MedicalViewerTagType.LeftOrientation)
      _medicalViewer.Cells(1).SetTag(0, MedicalViewerTagAlignment.RightCenter, MedicalViewerTagType.RightOrientation)


      AddHandler _medicalViewer.PlaneCutLineClicked, AddressOf _medicalViewer_PlaneCutLineClicked


      _medicalViewer.Cells(1).VoxelSpacing = New Medical3DPoint(1.0F, 1.0F, 1.0F)
      _medicalViewer.Cells(1).FirstPosition = New Medical3DPoint(0, 0, 0)
      _medicalViewer.Cells(1).SecondPosition = New Medical3DPoint(0, 0, 1.0F)
      Dim _imageOrientation As Single() = New Single(5) {}
      _imageOrientation(0) = 1
      _imageOrientation(1) = 0
      _imageOrientation(2) = 0
      _imageOrientation(3) = 0
      _imageOrientation(4) = 1
      _imageOrientation(5) = 0
      _medicalViewer.Cells(1).ImageOrientation = _imageOrientation
      _medicalViewer.Cells(1).FrameOfReferenceUID = "Image1.dic"

      Dim cutLine As MedicalViewerCutPlaneLine = New MedicalViewerCutPlaneLine()
      cutLine.Point1 = New MedicalViewerPoint(0, _image.Height / 2)
      cutLine.Point2 = New MedicalViewerPoint(_image.Width - 1, _image.Height / 2)
      _medicalViewer.Cells(1).ReferenceLine.CutPlaneLines.Add(cutLine)
      _medicalViewer.Cells(1).ReferenceLine.Color = Color.Blue
      _medicalViewer.Cells(1).ReferenceLine.Enabled = True

      RasterCodecs.Shutdown()
      Controls.Add(_medicalViewer)
   End Sub

   Private Sub _medicalViewer_PlaneCutLineClicked(ByVal sender As Object, ByVal e As MedicalViewerPlaneCutLineEventArgs)
      Text = e.Button & " " & e.CellIndex & " " & e.CutLineIndex & " " & e.X & " " & e.Y
   End Sub
End Class
C#Copy Code
public void MedicalViewerMedicalViewerPlaneCutLineEventArgsExample() 

   MainForm1 form = new MainForm1(); 
   form.ShowDialog(); 

 
 
// MainForm1 will be the owner of the medical viewer control that contains the 3D cell. 
class MainForm1 : Form 

   public MedicalViewer _medicalViewer; 
 
   void MedicalViewerForm_SizeChanged(object sender, EventArgs e) 
   { 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
   } 
 
   public MainForm1() 
   { 
      RasterCodecs.Startup(); 
      RasterCodecs _codecs = new RasterCodecs(); 
      RasterImage _image; 
 
      // Create the medical viewer and adjust some properties. 
      _medicalViewer = new MedicalViewer(); 
      _medicalViewer.Rows = 1; 
      _medicalViewer.Columns = 2; 
      _medicalViewer.Location = new Point(0, 0); 
      _medicalViewer.Size = new Size(500, 500); 
 
      // add some action that will be used to change the properties of the images inside the control. 
      _medicalViewer.AddAction(MedicalViewerActionType.Rotate3DObject); 
      _medicalViewer.AddAction(MedicalViewerActionType.ReferenceLine); 
      _medicalViewer.AddAction(MedicalViewerActionType.WindowLevel); 
      _medicalViewer.AddAction(MedicalViewerActionType.Stack); 
      _medicalViewer.AddAction(MedicalViewerActionType.RotatePlane); 
 
 
      // assign the added actions to a mouse button, meaning that when the user click and drag the mouse button, the associted action will be activated. 
      _medicalViewer.SetAction(MedicalViewerActionType.Rotate3DObject, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime); 
      _medicalViewer.SetAction(MedicalViewerActionType.RotatePlane, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime); 
      _medicalViewer.SetAction(MedicalViewerActionType.ReferenceLine, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime); 
      _medicalViewer.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime); 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image1.dic"); 
      _medicalViewer.Cells.Add(new MedicalViewer3DCell(_image)); 
 
      // adjust some properties to the cell and add some tags. 
      _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Overlay Text1"); 
      _medicalViewer.Cells[0].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); 
      _medicalViewer.Cells[0].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); 
      _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); 
      _medicalViewer.Cells[0].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); 
      _medicalViewer.Cells[0].SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text2"); 
      _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text3"); 
      _medicalViewer.Cells[0].SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text4"); 
      _medicalViewer.Cells[0].SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text5"); 
      _medicalViewer.Cells[0].SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit); 
      _medicalViewer.Cells[0].Selected = true; 
 
      // Add a plane 
      ((MedicalViewer3DCell)_medicalViewer.Cells[0]).Container.Objects[0].VRT.Planes.Add(new Medical3DPlane()); 
 
      MedicalViewerRotate3DPlane rotate3DPlane = (MedicalViewerRotate3DPlane)_medicalViewer.GetActionProperties(MedicalViewerActionType.RotatePlane); 
      rotate3DPlane.Axis = Medical3DAxis.Z; 
      rotate3DPlane.Space = Medical3DSpace.Object; 
 
      _medicalViewer.SetActionProperties(MedicalViewerActionType.RotatePlane, rotate3DPlane); 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image1.dic"); 
      MedicalViewerCell cell = new MedicalViewerCell(); 
      cell.Image = _image; 
      cell.Rows = 2; 
      cell.Columns = 2; 
      cell.Frozen = false; 
      cell.DisplayRulers = MedicalViewerRulers.Both; 
      cell.ApplyOnIndividualSubCell = false; 
      cell.ApplyActionOnMove = true; 
      cell.FitImageToCell = true; 
      cell.Selected = true; 
      cell.ShowTags = true; 
      _medicalViewer.Cells.Add(cell); 
 
      // adjust some properties to the cell and add some tags. 
      _medicalViewer.Cells[1].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Overlay Text1"); 
      _medicalViewer.Cells[1].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); 
      _medicalViewer.Cells[1].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); 
      _medicalViewer.Cells[1].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); 
      _medicalViewer.Cells[1].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); 
      _medicalViewer.Cells[1].SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text2"); 
      _medicalViewer.Cells[1].SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text3"); 
      _medicalViewer.Cells[1].SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text4"); 
      _medicalViewer.Cells[1].SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Overlay Text5"); 
      _medicalViewer.Cells[1].SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit); 
      _medicalViewer.Cells[1].SetTag(0, MedicalViewerTagAlignment.TopCenter, MedicalViewerTagType.TopOrientation); 
      _medicalViewer.Cells[1].SetTag(0, MedicalViewerTagAlignment.BottomCenter, MedicalViewerTagType.BottomOrientation); 
      _medicalViewer.Cells[1].SetTag(0, MedicalViewerTagAlignment.LeftCenter, MedicalViewerTagType.LeftOrientation); 
      _medicalViewer.Cells[1].SetTag(0, MedicalViewerTagAlignment.RightCenter, MedicalViewerTagType.RightOrientation); 
 
 
      _medicalViewer.PlaneCutLineClicked += new EventHandler<MedicalViewerPlaneCutLineEventArgs>(_medicalViewer_PlaneCutLineClicked); 
 
 
 
      _medicalViewer.Cells[1].VoxelSpacing = new Medical3DPoint(1.0f, 1.0f, 1.0f); 
      _medicalViewer.Cells[1].FirstPosition = new Medical3DPoint(0, 0, 0); 
      _medicalViewer.Cells[1].SecondPosition = new Medical3DPoint(0, 0, 1.0f); 
      float[] _imageOrientation = new float[6]; 
      _imageOrientation[0] = 1; 
      _imageOrientation[1] = 0; 
      _imageOrientation[2] = 0; 
      _imageOrientation[3] = 0; 
      _imageOrientation[4] = 1; 
      _imageOrientation[5] = 0; 
      _medicalViewer.Cells[1].ImageOrientation = _imageOrientation; 
      _medicalViewer.Cells[1].FrameOfReferenceUID = "Image1.dic"; 
 
      MedicalViewerCutPlaneLine cutLine = new MedicalViewerCutPlaneLine(); 
      cutLine.Point1 = new MedicalViewerPoint(0, _image.Height / 2); 
      cutLine.Point2 = new MedicalViewerPoint(_image.Width - 1, _image.Height / 2); 
      _medicalViewer.Cells[1].ReferenceLine.CutPlaneLines.Add(cutLine); 
      _medicalViewer.Cells[1].ReferenceLine.Color = Color.Blue; 
      _medicalViewer.Cells[1].ReferenceLine.Enabled = true; 
 
      RasterCodecs.Shutdown(); 
      Controls.Add(_medicalViewer); 
   } 
 
   void _medicalViewer_PlaneCutLineClicked(object sender, MedicalViewerPlaneCutLineEventArgs e) 
   { 
      Text = e.Button + " " + e.CellIndex + " " + e.CutLineIndex + " " + e.X + " " + e.Y; 
   } 
}

Remarks

To set the properties of the rotate 3D plane action, call the SetActionProperties method, and to retrieve the properties call the GetActionProperties method.

The mouse controls the actions as follows:

  • Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
  • Dragging the mouse towards any direction will rotate the 3D plane.

Inheritance Hierarchy

System.Object
   Leadtools.MedicalViewer.MedicalViewerBaseAction
      Leadtools.MedicalViewer.MedicalViewerCommonActions
         Leadtools.MedicalViewer.MedicalViewerRotate3DPlane

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

Leadtools.MedicalViewer requires a Medical Imaging license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features