Public Sub MedicalViewerMedicalViewerPlaneCutLineEventArgsExample()
Dim form As MainForm1 = New MainForm1()
form.ShowDialog()
End Sub
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
_medicalViewer = New MedicalViewer()
_medicalViewer.Rows = 1
_medicalViewer.Columns = 2
_medicalViewer.Location = New Point(0, 0)
_medicalViewer.Size = New Size(500, 500)
_medicalViewer.AddAction(MedicalViewerActionType.Rotate3DObject)
_medicalViewer.AddAction(MedicalViewerActionType.ReferenceLine)
_medicalViewer.AddAction(MedicalViewerActionType.WindowLevel)
_medicalViewer.AddAction(MedicalViewerActionType.Stack)
_medicalViewer.AddAction(MedicalViewerActionType.RotatePlane)
_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)
_image = _codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image1.dic")
_medicalViewer.Cells.Add(New MedicalViewer3DCell(_image))
_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
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)
_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)
_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 |