ToAnnObject(IDicomAnnotationObject) Method
Summary
Converts an object implementing the Leadtools.IDicomAnnotationObject interface to an AnnObject.
Syntax
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.
Example
This example does the following:
- Creates a rectangle Leadtools.Dicom.DicomCompoundGraphic
- Creates a converter
- Converts the Leadtools.Dicom.DicomCompoundGraphic to a LEAD Leadtools.Annotations.Core.AnnObject
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