Represents the class that is used to create the MedicalViewerPlaneCutLine, and adjust to reference line properties of this cell.
public class MedicalViewerReferenceLineProperties Public Class MedicalViewerReferenceLineProperties
public ref class MedicalViewerReferenceLineProperties
To show the reference line of this cell on the other cells correctly, the following properties will need to set by retrieving their values from the DICOM Data Set:
using Leadtools;using Leadtools.Dicom;using Leadtools.Medical3D;using Leadtools.Codecs;using Leadtools.MedicalViewer;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;using Leadtools.ImageProcessing.Color;using Leadtools.Annotations.Engine;using Leadtools.Annotations.Designers;class MedicalViewerLocalizer : Form{private MedicalViewer _medicalViewer;private MedicalViewerSeriesManager _seriesManager;void MedicalViewerLocalizer_SizeChanged(object sender, EventArgs e){_medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom);}public MedicalViewerLocalizer(MedicalViewerSeriesManager output){DicomEngine.Startup();RasterCodecs _codecs = new RasterCodecs();this.SizeChanged += new EventHandler(MedicalViewerLocalizer_SizeChanged);// 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);_seriesManager = output;MedicalViewerMultiCell cell = new MedicalViewerMultiCell(null, true, 1, 1);int index;int count = output.Stacks[0].Items.Count;CodecsImageInfo codecsInformation;MedicalViewerImageInformation[] imageInformation = new MedicalViewerImageInformation[count];for (index = 0; index < count; index++){codecsInformation = _codecs.GetInformation((string)(output.Stacks[0].Items[index].Data), true);imageInformation[index] = new MedicalViewerImageInformation();imageInformation[index].ImageHeight = codecsInformation.Width;imageInformation[index].ImageWidth = codecsInformation.Width;imageInformation[index].XResolution = codecsInformation.XResolution;imageInformation[index].YResolution = codecsInformation.YResolution;}cell.FramesRequested += new EventHandler<MedicalViewerRequestedFramesInformationEventArgs>(cell_FramesRequested);FormClosing += new FormClosingEventHandler(MedicalViewerLocalizer_FormClosing);cell.EnableLowMemoryUsage(2, count, imageInformation);_medicalViewer.Cells.Add(cell);// add some actions that will be used to change the properties of the images inside the control.cell.AddAction(MedicalViewerActionType.WindowLevel);cell.AddAction(MedicalViewerActionType.Alpha);cell.AddAction(MedicalViewerActionType.Offset);// 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.Alpha, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active);cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);cell.ReferenceLine.Enabled = true;cell.ReferenceLine.Color = Color.Yellow;cell.ShowCellBoundaries = true;// adjust some properties of the cell and add some tags._medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448");_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);cell.PixelSpacing = output.Stacks[0].PixelSpacing;for (index = 0; index < count; index++){cell.SetImagePosition(index, output.Stacks[0].Items[index].ImagePosition, (index == count - 1));}cell.ImageOrientation = output.Stacks[0].Items[0].ImageOrientationArray;cell.FrameOfReferenceUID = output.Stacks[0].Items[0].FrameOfReferenceUID;cell = new MedicalViewerMultiCell();DicomDataSet ds = new DicomDataSet();ds.Load(@"\\pc202\readwritefolder\DICOM Dataset\DICOM Volume datasets" + "\\Miller James-CT Head full Study\\0023\\20345460", DicomDataSetLoadFlags.None);DicomElement patientElement = null;patientElement = ds.FindFirstElement(null,DicomTag.ImagePositionPatient,true);double[] doubleArray = ds.GetDoubleValue(patientElement, 0, 3);cell.SetImagePosition(0, Point3D.FromDoubleArray(doubleArray), true);patientElement = ds.FindFirstElement(null,DicomTag.FrameOfReferenceUID,true);string referenceUID = ds.GetConvertValue(patientElement);cell.FrameOfReferenceUID = referenceUID;patientElement = ds.FindFirstElement(null,DicomTag.ImageOrientationPatient,true);doubleArray = ds.GetDoubleValue(patientElement, 0, 6);cell.ImageOrientation = new float[] {(float)doubleArray[0], (float)doubleArray[1], (float)doubleArray[2], (float)doubleArray[3], (float)doubleArray[4], (float)doubleArray[5]};patientElement = ds.FindFirstElement(null,DicomTag.PixelSpacing,true);doubleArray = ds.GetDoubleValue(patientElement, 0, 2);cell.PixelSpacing = new Point2D((float)doubleArray[0], (float)doubleArray[1]);cell.ReferenceLine.Enabled = true;cell.ReferenceLine.Color = Color.LightBlue;cell.ShowCellBoundaries = true;cell.Image = ds.GetImage(null, 0, 0, RasterByteOrder.Gray, DicomGetImageFlags.AutoApplyVoiLut | DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AllowRangeExpansion);_medicalViewer.Cells.Add(cell);Controls.Add(_medicalViewer);_medicalViewer.Dock = DockStyle.Fill;DicomEngine.Shutdown();}void MedicalViewerLocalizer_FormClosing(object sender, FormClosingEventArgs e){}void cell_FramesRequested(object sender, MedicalViewerRequestedFramesInformationEventArgs e){MedicalViewerMultiCell cell = (MedicalViewerMultiCell)(sender);RasterCodecs _codecs = new RasterCodecs();int i;RasterImage image;string fileName;if (e.RequestedFramesIndexes.Length > 0){fileName = (string)(_seriesManager.Stacks[0].Items[e.RequestedFramesIndexes[0]].Data);image = _codecs.Load(fileName);}elsereturn;for (i = 1; i < e.RequestedFramesIndexes.Length; i++){fileName = (string)(_seriesManager.Stacks[0].Items[e.RequestedFramesIndexes[i]].Data);image.AddPage(_codecs.Load(fileName));}cell.SetRequestedImage(image, e.RequestedFramesIndexes, MedicalViewerSetImageOptions.Insert);}public MedicalViewer Viewer{get { return _medicalViewer; }}}MedicalViewerLocalizer GetMedicalViewerLocalizerControl(){MedicalViewerSeriesManagerFrom form = new MedicalViewerSeriesManagerFrom();MedicalViewerSeriesManager output = form.LoadJamesHead();return new MedicalViewerLocalizer(output);}// This example changes the default window level value by decrease the width by 100. Then resets the images based on the new value.public void MedicalViewerLocalizerExample(){MedicalViewerLocalizer myForm = GetMedicalViewerLocalizerControl();MedicalViewer medicalViewer = myForm.Viewer;myForm.ShowDialog();}
Imports LeadtoolsImports Leadtools.DicomImports Leadtools.Medical3DImports Leadtools.CodecsImports Leadtools.MedicalViewerImports Leadtools.Annotations.EngineImports Leadtools.Annotations.DesignersImports Leadtools.ImageProcessing.CorePrivate Class MedicalViewerLocalizer : Inherits FormPrivate _medicalViewer As MedicalViewerPrivate _seriesManager As MedicalViewerSeriesManagerPrivate Sub MedicalViewer_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)_medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)End SubPublic Sub New(ByVal output As MedicalViewerSeriesManager)DicomEngine.Startup()Dim _codecs As RasterCodecs = New RasterCodecs()AddHandler SizeChanged, AddressOf MedicalViewer_SizeChanged' 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)_seriesManager = outputDim cell As MedicalViewerMultiCell = New MedicalViewerMultiCell(Nothing, True, 1, 1)Dim index As IntegerDim count As Integer = output.Stacks(0).Items.CountDim codecsInformation As CodecsImageInfoDim imageInformation As MedicalViewerImageInformation() = New MedicalViewerImageInformation(count - 1) {}index = 0Do While index < countcodecsInformation = _codecs.GetInformation(CStr(output.Stacks(0).Items(index).Data), True)imageInformation(index) = New MedicalViewerImageInformation()imageInformation(index).ImageHeight = codecsInformation.WidthimageInformation(index).ImageWidth = codecsInformation.WidthimageInformation(index).XResolution = codecsInformation.XResolutionimageInformation(index).YResolution = codecsInformation.YResolutionindex += 1LoopAddHandler cell.FramesRequested, AddressOf cell_FramesRequestedAddHandler FormClosing, AddressOf MedicalViewerLocalizer_FormClosingcell.EnableLowMemoryUsage(2, count, imageInformation)_medicalViewer.Cells.Add(cell)' add some actions that will be used to change the properties of the images inside the control.cell.AddAction(MedicalViewerActionType.WindowLevel)cell.AddAction(MedicalViewerActionType.Alpha)cell.AddAction(MedicalViewerActionType.Offset)' 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.Alpha, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active)cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active)cell.ReferenceLine.Enabled = Truecell.ReferenceLine.Color = Color.Yellowcell.ShowCellBoundaries = True' adjust some properties of the cell and add some tags._medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")_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)cell.PixelSpacing = output.Stacks(0).PixelSpacingcell.ImageOrientation = output.Stacks(0).Items(0).ImageOrientationArrayindex = 0Do While index < countcell.SetImagePosition(index, output.Stacks(0).Items(index).ImagePosition, (index = count - 1))index += 1Loopcell.FrameOfReferenceUID = output.Stacks(0).Items(0).FrameOfReferenceUIDcell = New MedicalViewerMultiCell()Dim ds As DicomDataSet = New DicomDataSet()ds.Load("\\pc202\readwritefolder\DICOM Dataset\DICOM Volume datasets" & "\Miller James-CT Head full Study\0023\20345460", DicomDataSetLoadFlags.None)Dim patientElement As DicomElement = NothingpatientElement = ds.FindFirstElement(Nothing, DicomTag.ImagePositionPatient, True)Dim doubleArray As Double() = ds.GetDoubleValue(patientElement, 0, 3)cell.SetImagePosition(0, Point3D.FromDoubleArray(doubleArray), True)patientElement = ds.FindFirstElement(Nothing, DicomTag.FrameOfReferenceUID, True)Dim referenceUID As String = ds.GetConvertValue(patientElement)cell.FrameOfReferenceUID = referenceUIDpatientElement = ds.FindFirstElement(Nothing, DicomTag.ImageOrientationPatient, True)doubleArray = ds.GetDoubleValue(patientElement, 0, 6)cell.ImageOrientation = New Single() {CSng(doubleArray(0)), CSng(doubleArray(1)), CSng(doubleArray(2)), CSng(doubleArray(3)), CSng(doubleArray(4)), CSng(doubleArray(5))}patientElement = ds.FindFirstElement(Nothing, DicomTag.PixelSpacing, True)doubleArray = ds.GetDoubleValue(patientElement, 0, 2)cell.PixelSpacing = New Point2D(CSng(doubleArray(0)), CSng(doubleArray(1)))cell.ReferenceLine.Enabled = Truecell.ReferenceLine.Color = Color.LightBluecell.ShowCellBoundaries = Truecell.Image = ds.GetImage(Nothing, 0, 0, RasterByteOrder.Gray, DicomGetImageFlags.AutoApplyVoiLut Or DicomGetImageFlags.AutoApplyModalityLut Or DicomGetImageFlags.AllowRangeExpansion)_medicalViewer.Cells.Add(cell)Controls.Add(_medicalViewer)_medicalViewer.Dock = DockStyle.FillDicomEngine.Shutdown()End SubPrivate Sub MedicalViewerLocalizer_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)End SubPrivate Sub cell_FramesRequested(ByVal sender As Object, ByVal e As MedicalViewerRequestedFramesInformationEventArgs)Dim cell As MedicalViewerMultiCell = CType(sender, MedicalViewerMultiCell)Dim _codecs As RasterCodecs = New RasterCodecs()Dim i As IntegerDim image As RasterImageDim fileName As StringIf e.RequestedFramesIndexes.Length > 0 ThenfileName = CStr(_seriesManager.Stacks(0).Items(e.RequestedFramesIndexes(0)).Data)image = _codecs.Load(fileName)ElseReturnEnd Ifi = 1Do While i < e.RequestedFramesIndexes.LengthfileName = CStr(_seriesManager.Stacks(0).Items(e.RequestedFramesIndexes(i)).Data)image.AddPage(_codecs.Load(fileName))i += 1Loopcell.SetRequestedImage(image, e.RequestedFramesIndexes, MedicalViewerSetImageOptions.Insert)End SubPublic ReadOnly Property Viewer() As MedicalViewerGetReturn _medicalViewerEnd GetEnd PropertyEnd ClassPrivate Function GetMedicalViewerLocalizerControl() As MedicalViewerLocalizerDim form As MedicalViewerSeriesManagerFrom = New MedicalViewerSeriesManagerFrom()Dim output As MedicalViewerSeriesManager = form.LoadJamesHead()Return New MedicalViewerLocalizer(output)End Function' This example changes the default window level value by decrease the width by 100. Then resets the images based on the new value.<TestMethod()> _Public Sub MedicalViewerLocalizerExample()Dim myForm As MedicalViewerLocalizer = GetMedicalViewerLocalizerControl()Dim medicalViewer As MedicalViewer = myForm.ViewermyForm.ShowDialog()End Sub
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
