FromAnnObjectToDataSet Method

Summary
Converts a LEAD Annotation object into one or more DICOM annotation objects, and adds the new DICOM annotation objects into the dataset.
Syntax
C#
C++/CLI
public void FromAnnObjectToDataSet( 
   DicomDataSet ds, 
   AnnObject annObject, 
   DicomElement graphicAnnSqItem 
) 
public: 
void FromAnnObjectToDataSet(  
   DicomDataSet^ ds, 
   AnnObject^ annObject, 
   DicomElement^ graphicAnnSqItem 
)  

Parameters

ds
The Leadtools.Dicom.DicomDataSet where the annotation objects will be added.

annObject
The LEAD annotation object that is being converted.

graphicAnnSqItem
Pointer to an item element under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module". The resulting DICOM annotation objects will be added to the dataset under the item this parameter points to.

Remarks

This function will automatically add the resulting DICOM annotation objects into the ds.

If the resulting DICOM annotation object is a "Compound Graphic " then it will be added under the "Compound Graphic Sequence" under the item the graphicAnnSqItem points to, and for backward compatibility (as per the DICOM Specification) it will also be added under the "Graphic Object Sequence".

If the resulting DICOM annotation object is a "Text Object" then it will be added under the "Text Object Sequence" under the item pointed to by graphicAnnSqItem.

If the resulting DICOM annotation object is a "Graphic Object" then it will be added under the "Graphic Object Sequence" under the item pointed to by graphicAnnSqItem.

Example

This example does the following:

  1. Creates a LEAD Leadtools.Annotations.Engine.AnnProtractorObject
  2. Creates a converter
  3. Converts the LEAD Leadtools.Annotations.Engine.AnnProtractorObject to two grouped Leadtools.Dicom.DicomAnnotationObject, and stores in a Leadtools.Dicom.DicomDataSet
C#
using Leadtools; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Annotations; 
using Leadtools.Annotations; 
using Leadtools.Annotations.Engine; 
 
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); 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.26
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Annotations Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.