LEADTOOLS Medical
LEAD Technologies, Inc

FromAnnObjectToDataSet Method

Example 





The DicomDataSet where the annotation objects will be added
The LEAD annotation object that is being converted
Pointer to an item element under the "Graphic Annotation Sequence" (0070,0001) in the "Graphic Annotation Module". If this parameter is not null then the resulting DICOM annotation objects will be added to the dataset under the item pointed to by this parameter. Pass null if you dont want the resulting objects to be added to the dataset.
Converts a LEAD Annotation object into one or more DICOM annotation objects, and (optionally) adds the new DICOM annotation objects into the dataset. .NET support Silverlight support
Syntax
public void FromAnnObjectToDataSet( 
   DicomDataSet ds,
   object annObject,
   DicomElement graphicAnnSqItem
)
'Declaration
 
Public Sub FromAnnObjectToDataSet( _
   ByVal ds As DicomDataSet, _
   ByVal annObject As Object, _
   ByVal graphicAnnSqItem As DicomElement _
) 
'Usage
 
Dim instance As DicomAnnotationsUtilities
Dim ds As DicomDataSet
Dim annObject As Object
Dim graphicAnnSqItem As DicomElement
 
instance.FromAnnObjectToDataSet(ds, annObject, graphicAnnSqItem)
public void FromAnnObjectToDataSet( 
   DicomDataSet ds,
   object annObject,
   DicomElement graphicAnnSqItem
)
 function Leadtools.Dicom.Annotations.DicomAnnotationsUtilities.FromAnnObjectToDataSet( 
   ds ,
   annObject ,
   graphicAnnSqItem 
)
public:
void FromAnnObjectToDataSet( 
   DicomDataSet^ ds,
   Object^ annObject,
   DicomElement^ graphicAnnSqItem
) 

Parameters

ds
The 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". If this parameter is not null then the resulting DICOM annotation objects will be added to the dataset under the item pointed to by this parameter. Pass null if you dont want the resulting objects to be added to the dataset.
Remarks
The paramater annObject is of type AnnObject This function will convert a LEAD Annotation object into one or more DICOM annotation objects (text and graphic). If the parameter graphicAnnSqItem is not null, then the function will automatically add the resulting DICOM annotation objects into the ds. 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. Note: for Silverlight users, the System.Object is of type Leadtools.Windows.Annotations.AnnObject
Example
 
Public Sub DicomAnnotationsUtilities_FromAnnObject()
   ' Create an AnnRectangleObject
   Dim annObject As New AnnRectangleObject()
   annObject.Pen = New AnnPen(Color.Purple, New AnnLength(5, AnnUnit.Pixel))
   annObject.Brush = New AnnSolidBrush(Color.White)
   annObject.Bounds = New AnnRectangle(400, 100, 500, 200)
   ' Create an instance of the converter, and set some properties
   Dim du As New DicomAnnotationsUtilities()
   du.LayerName = "Test Layer Name"

   Dim defaultAnnObject As New AnnTextObject()
   defaultAnnObject.Pen = annObject.Pen
   defaultAnnObject.Brush = annObject.Brush
   du.DefaultObject = defaultAnnObject

   ' Convert to a DicomAnnotationObject
   ' Note that there is no DicomAnnotationObject rectangle type, so it is converted to a polyline
   Dim dicomAnnotationObject As DicomAnnotationObject = du.FromAnnObject(annObject)

   ' Convert back to a LEAD AnnObject
   ' Now the LEAD object will be a polyline, even though the original object was a rectangle
   Dim annObjectNew As AnnObject = TryCast(du.ToAnnObject(dicomAnnotationObject), AnnObject)

   If annObjectNew IsNot Nothing Then
      Dim msg As String = String.Format("Original type [{0}]     New type [{1}]", annObject.GetType(), annObjectNew.GetType())
      MessageBox.Show(msg)
   End If
End Sub
public void DicomAnnotationsUtilities_FromAnnObject()
{
   // Create an AnnRectangleObject
   AnnRectangleObject annObject = new AnnRectangleObject();
   annObject.Pen = new AnnPen(Color.Purple, new AnnLength(5, AnnUnit.Pixel));
   annObject.Brush = new AnnSolidBrush(Color.White);
   annObject.Bounds = new AnnRectangle(400, 100, 500, 200);
   // Create an instance of the converter, and set some properties
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities();
   du.LayerName = "Test Layer Name";

   AnnTextObject defaultAnnObject = new AnnTextObject();
   defaultAnnObject.Pen = annObject.Pen;
   defaultAnnObject.Brush = annObject.Brush;
   du.DefaultObject = defaultAnnObject;

   // Convert to a DicomAnnotationObject
   // Note that there is no DicomAnnotationObject rectangle type, so it is converted to a polyline
   DicomAnnotationObject dicomAnnotationObject = du.FromAnnObject(annObject);

   // Convert back to a LEAD AnnObject
   // Now the LEAD object will be a polyline, even though the original object was a rectangle
   AnnObject annObjectNew = du.ToAnnObject(dicomAnnotationObject) as AnnObject;

   if (annObjectNew != null)
   {
      string msg = string.Format("Original type [{0}]     New type [{1}]", annObject.GetType(), annObjectNew.GetType());
      MessageBox.Show(msg);
   }
}
public void DicomAnnotationsUtilities_FromAnnObject()
{
   // Create an AnnRectangleObject
   AnnRectangleObject annObject = new AnnRectangleObject();
   annObject.Stroke = Color.FromArgb(0xFF, 0x80, 0x00, 0x80); // purple
   annObject.StrokeThickness = 5;
   annObject.Fill = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); // white
   annObject.Rect = new Rect(400, 100, 500, 200);

   // Create an instance of the converter, and set some properties
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities();
   AnnTextObject defaultAnnObject = new AnnTextObject();
   defaultAnnObject.Stroke = annObject.Stroke;
   defaultAnnObject.StrokeThickness = annObject.StrokeThickness;
   defaultAnnObject.Fill = annObject.Fill;

   du.DefaultObject = defaultAnnObject;
   du.LayerName = "Test Layer Name";

   // Convert to a DicomAnnotationObject
   DicomAnnotationObject dicomAnnotationObject = du.FromAnnObject(annObject);

   // Convert back to a LEAD AnnObject
   AnnObject annObjectNew = du.ToAnnObject(dicomAnnotationObject) as AnnObject;

   string msg = string.Format("Original type [{0}]     New type [{1}]", annObject.GetType(), annObjectNew.GetType());
   Console.WriteLine(msg);
}
Public Sub DicomAnnotationsUtilities_FromAnnObject()
   ' Create an AnnRectangleObject
   Dim annObject As AnnRectangleObject = New AnnRectangleObject()
   annObject.Stroke = Color.FromArgb(&HFF, &H80, &H00, &H80) ' purple
   annObject.StrokeThickness = 5
   annObject.Fill = Color.FromArgb(&HFF, &HFF, &HFF, &HFF) ' white
   annObject.Rect = New Rect(400, 100, 500, 200)

   ' Create an instance of the converter, and set some properties
   Dim du As DicomAnnotationsUtilities = New DicomAnnotationsUtilities()
   Dim defaultAnnObject As AnnTextObject = New AnnTextObject()
   defaultAnnObject.Stroke = annObject.Stroke
   defaultAnnObject.StrokeThickness = annObject.StrokeThickness
   defaultAnnObject.Fill = annObject.Fill

   du.DefaultObject = defaultAnnObject
   du.LayerName = "Test Layer Name"

   ' Convert to a DicomAnnotationObject
   Dim dicomAnnotationObject As DicomAnnotationObject = du.FromAnnObject(annObject)

   ' Convert back to a LEAD AnnObject
   Dim annObjectNew As AnnObject = TryCast(du.ToAnnObject(dicomAnnotationObject), AnnObject)

   Dim msg As String = String.Format("Original type [{0}]     New type [{1}]", annObject.GetType(), annObjectNew.GetType())
   Console.WriteLine(msg)
End Sub
Requirements

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

See Also

Reference

DicomAnnotationsUtilities Class
DicomAnnotationsUtilities Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Annotations requires a Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features