LEADTOOLS Medical
LEAD Technologies, Inc

ToAnnObject(DicomAnnotationObject) Method

Example 





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

Parameters

dicomAnnotationObject
The DICOM annotation object that is being converted

Return Value

An AnnObject representation of the DICOM annotation if successful; null if the Leadtools.Dicom.DicomAnnotationObject cannot be converted.
Remarks
Note that if the Leadtools.Dicom.DicomAnnotationObject is a Leadtools.Dicom.DicomCompoundGraphic, and the objects are 'grouped', then the conversion might not return the original Leadtools.Annotations.Core.AnnObject. For example, if the original Leadtools.Annotations.Core.AnnObject is a Leadtools.Annotations.Core.AnnPolyRulerObject, it will be converted to two Leadtools.Dicom.DicomCompoundGraphic rulers, with the same Leadtools.Dicom.DicomCompoundGraphic.GraphicGroupId. Using this method to convert back to an Leadtools.Annotations.Core.AnnObject, the method will be called twice two return two rulers. So in this case, it is better to use Leadtools.Annotations.Core.AnnObject, as this will convert to the original Leadtools.Annotations.Core.AnnPolyRulerObject.
Example
 
Private Function DicomAnnotationsUtilities_ToAnnObject() As AnnObject
   ' Create a compound graphic -- Rectangle
   Dim compoundGraphic As New DicomCompoundGraphic()
   compoundGraphic.LayerName = "Layer 0"

   compoundGraphic.Units = DicomAnnotationUnitsRelativityType.Pixel
   compoundGraphic.Type = DicomAnnotationCompoundGraphicType.Rectangle

   Dim pts(1) As DicomAnnotationPoint

   pts(0) = New DicomAnnotationPoint(100, 100)
   pts(1) = New DicomAnnotationPoint(200, 200)

   compoundGraphic.SetAnnotationPoints(pts, pts.Length)
   compoundGraphic.CompoundGraphicInstanceId = 200
   compoundGraphic.GraphicGroupId = 0
   compoundGraphic.RotationAngle = 45.0
   compoundGraphic.RotationPoint = New DicomAnnotationPoint(150, 150)
   compoundGraphic.Filled = True
   compoundGraphic.Options = DicomAnnotationOptions.Fill Or DicomAnnotationOptions.Line Or DicomAnnotationOptions.CompoundGraphicInstanceId

   ' LineStyle
   compoundGraphic.LineStyle = New DicomLineStyle()
   compoundGraphic.LineStyle.LineOptions = DicomAnnotationLineOptions.None
   compoundGraphic.LineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off
   compoundGraphic.LineStyle.Shadow.ShadowOpacity = 0.0F
   compoundGraphic.LineStyle.Shadow.ShadowOffsetX = 0.0F
   compoundGraphic.LineStyle.Shadow.ShadowOffsetY = 0.0F
   compoundGraphic.LineStyle.Shadow.ShadowColorCieLabValue = New UShort(2) {1, 2, 3}

   compoundGraphic.LineStyle.PatternOnColorCieLabValue = New UShort(2) {24886, 53484, 50171} ' red
   compoundGraphic.LineStyle.PatternOffColorCieLabValue = New UShort(2) {0, 0, 0}
   compoundGraphic.LineStyle.LineThickness = 2.0F
   compoundGraphic.LineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid
   compoundGraphic.LineStyle.LinePattern = &HFFFF
   compoundGraphic.LineStyle.PatternOnOpacity = 1.0F
   compoundGraphic.LineStyle.PatternOffOpacity = 0.0F

   ' FillStyle
   compoundGraphic.FillStyle = New DicomFillStyle()
   compoundGraphic.FillStyle.FillOptions = DicomAnnotationFillOptions.None
   compoundGraphic.FillStyle.PatternOnColorCieLabValue = New UShort(2) {21169, 53249, 5175} ' blue
   compoundGraphic.FillStyle.PatternOffColorCieLabValue = New UShort(2) {0, 0, 0}
   compoundGraphic.FillStyle.PatternOnOpacity = 1.0F
   compoundGraphic.FillStyle.PatternOffOpacity = 0.0F
   compoundGraphic.FillStyle.FillMode = DicomAnnotationFillModeType.Solid

   ' 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"

   ' Convert the DICOM Annotation to a LEAD annotation
   Dim annObjectResult As AnnObject = du.ToAnnObject(compoundGraphic)
   Return annObjectResult

End Function
private AnnObject DicomAnnotationsUtilities_ToAnnObject()
{
   // Create a compound graphic -- Rectangle
   DicomCompoundGraphic compoundGraphic = new DicomCompoundGraphic();
   compoundGraphic.LayerName = "Layer 0";

   compoundGraphic.Units = DicomAnnotationUnitsRelativityType.Pixel;
   compoundGraphic.Type = DicomAnnotationCompoundGraphicType.Rectangle;

   DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2];

   pts[0] = new DicomAnnotationPoint(100, 100);
   pts[1] = new DicomAnnotationPoint(200, 200);

   compoundGraphic.SetAnnotationPoints(pts, pts.Length);
   compoundGraphic.CompoundGraphicInstanceId = 200;
   compoundGraphic.GraphicGroupId = 0;
   compoundGraphic.RotationAngle = 45.0;
   compoundGraphic.RotationPoint = new DicomAnnotationPoint(150, 150);
   compoundGraphic.Filled = true;
   compoundGraphic.Options = DicomAnnotationOptions.Fill | DicomAnnotationOptions.Line | DicomAnnotationOptions.CompoundGraphicInstanceId;

   // LineStyle
   compoundGraphic.LineStyle = new DicomLineStyle();
   compoundGraphic.LineStyle.LineOptions = DicomAnnotationLineOptions.None;
   compoundGraphic.LineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off;
   compoundGraphic.LineStyle.Shadow.ShadowOpacity = 0.0f;
   compoundGraphic.LineStyle.Shadow.ShadowOffsetX = 0.0f;
   compoundGraphic.LineStyle.Shadow.ShadowOffsetY = 0.0f;
   compoundGraphic.LineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 };

   compoundGraphic.LineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 };   // red
   compoundGraphic.LineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };
   compoundGraphic.LineStyle.LineThickness = 2.0f;
   compoundGraphic.LineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid;
   compoundGraphic.LineStyle.LinePattern = 0xFFFF;
   compoundGraphic.LineStyle.PatternOnOpacity = 1.0f;
   compoundGraphic.LineStyle.PatternOffOpacity = 0.0f;

   // FillStyle
   compoundGraphic.FillStyle = new DicomFillStyle();
   compoundGraphic.FillStyle.FillOptions = DicomAnnotationFillOptions.None;
   compoundGraphic.FillStyle.PatternOnColorCieLabValue = new ushort[3] { 21169, 53249, 5175 };  // blue
   compoundGraphic.FillStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };
   compoundGraphic.FillStyle.PatternOnOpacity = 1.0f;
   compoundGraphic.FillStyle.PatternOffOpacity = 0.0f;
   compoundGraphic.FillStyle.FillMode = DicomAnnotationFillModeType.Solid;

   // 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";

   // Convert the DICOM Annotation to a LEAD annotation
   AnnObject annObjectResult = du.ToAnnObject(compoundGraphic);
   return annObjectResult;

}
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
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

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

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