Error processing SSI file
LEADTOOLS Medical

Show in webframe

ToAnnObject Method






The DICOM annotation object that is being converted.
Converts a Leadtools.Dicom.DicomAnnotationObject to an object that is of type Leadtools.Annotations.AnnObject.
Syntax
public object ToAnnObject( 
   DicomAnnotationObject dicomAnnotationObject
)
'Declaration
 
Public Function ToAnnObject( _
   ByVal dicomAnnotationObject As DicomAnnotationObject _
) As Object
'Usage
 
Dim instance As DicomAnnotationsUtilities
Dim dicomAnnotationObject As DicomAnnotationObject
Dim value As Object
 
value = instance.ToAnnObject(dicomAnnotationObject)

            

            

Parameters

dicomAnnotationObject
The DICOM annotation object that is being converted.

Return Value

An AnnObject System.Object representation of the DICOM annotation if successful; null if the Leadtools.Dicom.DicomAnnotationObject cannot be converted.
Remarks
The returned System.Object is of type Leadtools.Annotations.AnnObject. An Leadtools.Annotations.AnnObjecthas properties (i.e. color, font) that a Leadtools.Dicom.DicomAnnotationObject does not. Set the Leadtools.Annotations.AnnObject defaults prior to calling this method by setting the DefaultObject Note: for Silverlight users, the object is of type Leadtools.Windows.Annotations.AnnObject
Example

This sample does the following:

  1. Creates a Leadtools.Dicom.DicomTextObject text object with an anchor
  2. Creates a converter
  3. Converts to a LEAD annotation
Copy Code  
Imports Leadtools
Imports Leadtools.Annotations
Imports Leadtools.Dicom
Imports Leadtools.Dicom.Annotations

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 customize the defaults for the annotations by
   ' creating a default object and assigning it to the DefaultObject property
   Dim du As New DicomAnnotationsUtilities()

   Dim defaultAnnObject As New AnnTextObject()

   ' Pen
   defaultAnnObject.Pen = New AnnPen(Color.Blue, New AnnLength(3))
   defaultAnnObject.Brush = New AnnSolidBrush(Color.Purple)

   ' Font
   defaultAnnObject.Font = New AnnFont("Courier", New AnnLength(16), FontStyle.Bold)

   ' Text
   defaultAnnObject.Alignment = StringAlignment.Far
   defaultAnnObject.TextColor = Color.Green

   du.DefaultObject = defaultAnnObject


   ' Convert to a LEAD AnnObject
   Dim annObject As AnnObject = TryCast(du.ToAnnObject(dicomAnnotationObject), AnnObject)
   Return annObject
End Function
using Leadtools;
using Leadtools.Annotations;
using Leadtools.Dicom;
using Leadtools.Dicom.Annotations;

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 customize the defaults for the annotations by
   // creating a default object and assigning it to the DefaultObject property
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities();

   AnnTextObject defaultAnnObject = new AnnTextObject();

   // Pen
   defaultAnnObject.Pen = new AnnPen(Color.Blue, new AnnLength(3));
   defaultAnnObject.Brush = new AnnSolidBrush(Color.Purple);

   // Font
   defaultAnnObject.Font = new AnnFont("Courier", new AnnLength(16), FontStyle.Bold);

   // Text
   defaultAnnObject.Alignment = StringAlignment.Far;
   defaultAnnObject.TextColor = Color.Green;

   du.DefaultObject = defaultAnnObject;


   // Convert to a LEAD AnnObject
   AnnObject annObject = du.ToAnnObject(dicomAnnotationObject) as AnnObject;
   return annObject;
}
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Dicom.Annotations;
using Leadtools.Windows.Annotations;
using Leadtools.Examples;

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 customize the defaults for the annotations by
   // creating a default object and assigning it to the DefaultObject property
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities();

   AnnTextObject defaultAnnObject = new AnnTextObject();

   // Pen
   defaultAnnObject.Stroke = Color.FromArgb(255, 0, 0, 255);
   defaultAnnObject.StrokeThickness = 3;
   defaultAnnObject.Fill = Color.FromArgb(128, 0, 255, 255);

   // Font
   defaultAnnObject.FontFamilyName = "Courier";
   defaultAnnObject.FontSize = 16;
   defaultAnnObject.FontStretch = AnnFontStretches.Normal;
   defaultAnnObject.FontStyle = AnnFontStyle.Italic;
   defaultAnnObject.FontWeight = AnnFontWeight.Bold;

   // Text
   defaultAnnObject.TextHorizontalAlignment = AnnTextAlignment.Far;
   defaultAnnObject.Foreground = Color.FromArgb(255, 255, 0, 255);

   du.DefaultObject = defaultAnnObject;

   // Convert to a LEAD AnnObject
   AnnObject annObject = du.ToAnnObject(dicomAnnotationObject) as AnnObject;
   return annObject;
}
Imports Leadtools
Imports Leadtools.Dicom
Imports Leadtools.Dicom.Annotations
Imports Leadtools.Windows.Annotations

Public Function DicomAnnotationsUtilities_ToAnnObject() As AnnObject
   ' Create a DicomTextAnnotation object -- text object with an anchor
   Dim dicomAnnotationObject As DicomTextObject = New 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 customize the defaults for the annotations by
   ' creating a default object and assigning it to the DefaultObject property
   Dim du As DicomAnnotationsUtilities = New DicomAnnotationsUtilities()

   Dim defaultAnnObject As AnnTextObject = New AnnTextObject()

   ' Pen
   defaultAnnObject.Stroke = Color.FromArgb(255, 0, 0, 255)
   defaultAnnObject.StrokeThickness = 3
   defaultAnnObject.Fill = Color.FromArgb(128, 0, 255, 255)

   ' Font
   defaultAnnObject.FontFamilyName = "Courier"
   defaultAnnObject.FontSize = 16
   defaultAnnObject.FontStretch = AnnFontStretches.Normal
   defaultAnnObject.FontStyle = AnnFontStyle.Italic
   defaultAnnObject.FontWeight = AnnFontWeight.Bold

   ' Text
   defaultAnnObject.TextHorizontalAlignment = AnnTextAlignment.Far
   defaultAnnObject.Foreground = Color.FromArgb(255, 255, 0, 255)

   du.DefaultObject = defaultAnnObject

   ' Convert to a LEAD AnnObject
   Dim annObject As AnnObject = TryCast(du.ToAnnObject(dicomAnnotationObject), AnnObject)
   Return annObject
End Function
Requirements

Target Platforms

See Also

Reference

DicomAnnotationsUtilities Class
DicomAnnotationsUtilities Members

Error processing SSI file
Leadtools.Dicom.Annotations requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features