Leadtools.Dicom.Annotations Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
ToAnnObject Method
See Also  Example
Leadtools.Dicom.Annotations Namespace > DicomAnnotationsUtilities Class : ToAnnObject Method




dicomAnnotationObject
The DICOM annotation object that is being converted.
Converts a DicomAnnotationObject to an AnnObject.

Syntax

Visual Basic (Declaration) 
Public Function ToAnnObject( _
   ByVal dicomAnnotationObject As DicomAnnotationObject _
) As AnnObject
Visual Basic (Usage)Copy Code
Dim instance As DicomAnnotationsUtilities
Dim dicomAnnotationObject As DicomAnnotationObject
Dim value As AnnObject
 
value = instance.ToAnnObject(dicomAnnotationObject)
C# 
public AnnObject ToAnnObject( 
   DicomAnnotationObject dicomAnnotationObject
)
Managed Extensions for C++ 
public: AnnObject ToAnnObject( 
   DicomAnnotationObject dicomAnnotationObject
) 
C++/CLI 
public:
AnnObject ToAnnObject( 
   DicomAnnotationObject dicomAnnotationObject
) 

Parameters

dicomAnnotationObject
The DICOM annotation object that is being converted.

Return Value

A AnnObject representation of the DICOM annotation if successful; null if the DicomAnnotationObject cannot be converted.

Example

This sample does the following: <list type="number"> <item><description>Creates a DicomTextObject text object with an anchor</description></item> <item><description>Creates a converter</description></item> <item><description>Converts to a LEAD annotation</description></item> <item><description>Displays the LEAD annotation</description></item> </list>

Visual BasicCopy Code
Public Function DicomAnnotationsUtilities_ToAnnObject() As AnnObject
  ' Create a DicomTextAnnotation object -- text object with an anchor
  Dim dicomAnnotationObject As DicomTextObject = New Leadtools.Dicom.DicomTextObject()
  dicomAnnotationObject.TLHCorner = New DicomAnnotationPoint(100, 250)
  dicomAnnotationObject.BRHCorner = New DicomAnnotationPoint(200, 350)
  dicomAnnotationObject.AnchorPointVisible = True
  dicomAnnotationObject.AnchorPointUnits = DicomAnnotationUnitsRelativityType.Pixel
  dicomAnnotationObject.AnchorPoint = New DicomAnnotationPoint(300, 300)
  dicomAnnotationObject.AnchorPointVisible = True
  dicomAnnotationObject.BoundingBoxUnits = DicomAnnotationUnitsRelativityType.Pixel
  dicomAnnotationObject.TextJustification = TextAnnotationJustificationType.Right
  dicomAnnotationObject.TextValue = "Right justified with blue border"
  ' Create an instance of the converter, and set some properties
  Dim du As DicomAnnotationsUtilities = New DicomAnnotationsUtilities()
  du.Pen = New AnnPen(Color.Blue, New AnnLength(3, AnnUnit.Pixel))
  du.Brush = New AnnSolidBrush(Color.Yellow)
  du.TextColor = Color.Brown

  ' Convert to a LEAD AnnObject
  Dim annObject As AnnObject = du.ToAnnObject(dicomAnnotationObject)
  Return annObject
 End Function
C#Copy Code
public AnnObject DicomAnnotationsUtilities_ToAnnObject() 

   // Create a DicomTextAnnotation object -- text object with an anchor 
   DicomTextObject dicomAnnotationObject = new Leadtools.Dicom.DicomTextObject(); 
   dicomAnnotationObject.TLHCorner = new DicomAnnotationPoint(100, 250); 
   dicomAnnotationObject.BRHCorner = new DicomAnnotationPoint(200, 350); 
   dicomAnnotationObject.AnchorPointVisible = true; 
   dicomAnnotationObject.AnchorPointUnits = DicomAnnotationUnitsRelativityType.Pixel; 
   dicomAnnotationObject.AnchorPoint = new DicomAnnotationPoint(300, 300); 
   dicomAnnotationObject.AnchorPointVisible = true; 
   dicomAnnotationObject.BoundingBoxUnits = DicomAnnotationUnitsRelativityType.Pixel; 
   dicomAnnotationObject.TextJustification = TextAnnotationJustificationType.Right; 
   dicomAnnotationObject.TextValue = "Right justified with blue border"; 
   // Create an instance of the converter, and set some properties 
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
   du.Pen = new AnnPen(Color.Blue, new AnnLength(3, AnnUnit.Pixel)); 
   du.Brush = new AnnSolidBrush(Color.Yellow); 
   du.TextColor = Color.Brown; 
 
   // Convert to a LEAD AnnObject 
   AnnObject annObject = du.ToAnnObject(dicomAnnotationObject); 
   return annObject; 
}

Remarks

An AnnObjecthas properties (i.e. color, font) that a DicomAnnotationObject does not. Set the AnnObject defaults prior to calling this method by setting the Brush, Pen, and Font.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

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