Leadtools.Dicom.Annotations.Core Namespace > DicomAnnotationsUtilities Class : FromAnnObjectToDataSet Method |
public void FromAnnObjectToDataSet( DicomDataSet ds, AnnObject annObject, DicomElement graphicAnnSqItem )
'Declaration Public Sub FromAnnObjectToDataSet( _ ByVal ds As DicomDataSet, _ ByVal annObject As AnnObject, _ ByVal graphicAnnSqItem As DicomElement _ )
'Usage Dim instance As DicomAnnotationsUtilities Dim ds As DicomDataSet Dim annObject As AnnObject Dim graphicAnnSqItem As DicomElement instance.FromAnnObjectToDataSet(ds, annObject, graphicAnnSqItem)
public void FromAnnObjectToDataSet( DicomDataSet ds, AnnObject annObject, DicomElement graphicAnnSqItem )
function Leadtools.Dicom.Annotations.Core.DicomAnnotationsUtilities.FromAnnObjectToDataSet( ds , annObject , graphicAnnSqItem )
public: void FromAnnObjectToDataSet( DicomDataSet^ ds, AnnObject^ annObject, DicomElement^ graphicAnnSqItem )
Private Sub DicomAnnotationsUtilities_FromAnnObjectToDataSet(ByVal fileOut As String) ' Set up the DicomAnnotationsUtilities converter Dim du As New DicomAnnotationsUtilities() du.ImageDpiX = 96.0 du.ImageDpiY = 96.0 du.DisplayWidth = 200 du.DisplayHeight = 200 du.LayerName = "Layer 0" du.CompoundGraphicInstanceId = 100 du.GraphicGroupId = 123 ' Create a protractor object Dim protractor As New AnnProtractorObject() protractor.Points.Clear() protractor.AngularUnit = AnnAngularUnit.Degree protractor.Stroke.Stroke = AnnSolidColorBrush.Create("green") protractor.Points.Add(CreateLeadPointD(100, 300)) protractor.Points.Add(CreateLeadPointD(200, 400)) protractor.Points.Add(CreateLeadPointD(300, 300)) ' Create a DicomDataSet Dim dsPS As New DicomDataSet() dsPS.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryModulesOnly Or DicomDataSetInitializeFlags.AddMandatoryElementsOnly) ' DicomElement graphicAnnSequenceItem = dsPS.FindFirstGraphicAnnSQItem(); Dim graphicAnnotationSequenceElement As DicomElement = dsPS.InsertElement(Nothing, False, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, True, 0) Dim item As DicomElement = dsPS.InsertElement(graphicAnnotationSequenceElement, True, DicomTag.Item, DicomVRType.OB, True, -1) dsPS.InsertElement(item, True, DicomTag.GraphicLayer, DicomVRType.CS, False, 0) du.FromAnnObjectToDataSet(dsPS, protractor, item) dsPS.Save(fileOut, DicomDataSetSaveFlags.None) MessageBox.Show("Presentation State Saved: " & fileOut) End Sub Private Function CreateLeadPointD(ByVal x As Double, ByVal y As Double) As LeadPointD Dim imageDpi As Double = 96.0 Return New LeadPointD(x * 720.0 / imageDpi, y * 720.0 / imageDpi) End Function
private void DicomAnnotationsUtilities_FromAnnObjectToDataSet(string fileOut) { // Set up the DicomAnnotationsUtilities converter DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); du.ImageDpiX = 96.0; du.ImageDpiY = 96.0; du.DisplayWidth = 200; du.DisplayHeight = 200; du.LayerName = "Layer 0"; du.CompoundGraphicInstanceId = 100; du.GraphicGroupId = 123; // Create a protractor object AnnProtractorObject protractor = new AnnProtractorObject(); protractor.Points.Clear(); protractor.AngularUnit = AnnAngularUnit.Degree; protractor.Stroke.Stroke = AnnSolidColorBrush.Create("green"); protractor.Points.Add(CreateLeadPointD(100, 300)); protractor.Points.Add(CreateLeadPointD(200, 400)); protractor.Points.Add(CreateLeadPointD(300, 300)); // Create a DicomDataSet DicomDataSet dsPS = new DicomDataSet(); dsPS.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryModulesOnly | DicomDataSetInitializeFlags.AddMandatoryElementsOnly); // DicomElement graphicAnnSequenceItem = dsPS.FindFirstGraphicAnnSQItem(); DicomElement graphicAnnotationSequenceElement = dsPS.InsertElement(null, false, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, true, 0); DicomElement item = dsPS.InsertElement(graphicAnnotationSequenceElement, true, DicomTag.Item, DicomVRType.OB, true, -1); dsPS.InsertElement(item, true, DicomTag.GraphicLayer, DicomVRType.CS, false, 0); du.FromAnnObjectToDataSet(dsPS, protractor, item); dsPS.Save(fileOut, DicomDataSetSaveFlags.None); MessageBox.Show("Presentation State Saved: " + fileOut); } LeadPointD CreateLeadPointD(double x, double y) { double imageDpi = 96.0; return new LeadPointD(x * 720.0 / imageDpi , y * 720.0 / imageDpi ); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2