←Select platform

ToAnnObject(DicomAnnotationObject) Method

Syntax

C#
VB
C++
  
Public Overloads Function ToAnnObject( _ 
   ByVal dicomAnnotationObject As Leadtools.Dicom.DicomAnnotationObject _ 
) As Leadtools.Annotations.Core.AnnObject 

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

This example does the following:

  1. Creates a rectangle Leadtools.Dicom.DicomCompoundGraphic
  2. Creates a converter
  3. Converts the Leadtools.Dicom.DicomCompoundGraphic to a LEAD Leadtools.Annotations.Core.AnnObject
    C#
    VB
    using Leadtools; 
    using Leadtools.Dicom; 
    using Leadtools.Dicom.Annotations.Core; 
    using Leadtools.Annotations.Core; 
     
    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; 
     
    } 
    Imports Leadtools 
    Imports Leadtools.Dicom 
    Imports Leadtools.Dicom.Annotations.Core 
    Imports Leadtools.Annotations.Core 
     
    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 
Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.