public DicomElement GetCompoundGraphicElement(DicomElement graphicAnnSQItem,int objectIndex)
public:DicomElement^ GetCompoundGraphicElement(DicomElement^ graphicAnnSQItem,int objectIndex)
graphicAnnSQItem
Graphic annotation object item
objectIndex
The zero-based index of the compound graphic annotation whose item element is required.
The item element of the specified compound graphic annotation.
This method returns the item element under the "Compound Graphic Sequence" (0070,0209) of the specified graphic annotation object. If the element could not be found it returns null.
using Leadtools;using Leadtools.Dicom;///// Creates a RULER compound graphicprivate DicomCompoundGraphic CreateCompoundGraphicRuler(string layerName){// Create a compound graphicDicomCompoundGraphic compoundGraphic = new DicomCompoundGraphic();compoundGraphic.LayerName = layerName;compoundGraphic.Units = DicomAnnotationUnitsRelativityType.Pixel;compoundGraphic.Type = DicomAnnotationCompoundGraphicType.Ruler;DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2];pts[0] = new DicomAnnotationPoint(300, 100);pts[1] = new DicomAnnotationPoint(450, 100);compoundGraphic.SetAnnotationPoints(pts, pts.Length);compoundGraphic.CompoundGraphicInstanceId = 100;compoundGraphic.GraphicGroupId = 0;compoundGraphic.RotationAngle = 0.0;compoundGraphic.RotationPoint = new DicomAnnotationPoint(0, 0);compoundGraphic.GapLength = 0.0f;compoundGraphic.DiameterOfVisibility = 0;compoundGraphic.TickAlignment = DicomAnnotationTickAlignmentType.Center;compoundGraphic.TickLabelAlignment = DicomAnnotationTickLabelAlignmentType.Bottom;compoundGraphic.ShowTickLabel = true;compoundGraphic.Filled = false;compoundGraphic.Options = DicomAnnotationOptions.Line | DicomAnnotationOptions.Text | DicomAnnotationOptions.CompoundGraphicInstanceId;Debug.Assert(compoundGraphic.AnnotationPointCount == pts.Length);// TextStylecompoundGraphic.TextStyle = new DicomTextStyle();compoundGraphic.TextStyle.TextOptions = DicomAnnotationTextOptions.FontName;compoundGraphic.TextStyle.FontName = "Arial";compoundGraphic.TextStyle.CssFontName = "serif";compoundGraphic.TextStyle.TextColorCieLabValue = new ushort[3] { 34866, 53484, 50171 }; // RedcompoundGraphic.TextStyle.HorizontalAlign = DicomAnnotationHorizontalAlignmentType.Center;compoundGraphic.TextStyle.VerticalAlign = DicomAnnotationVerticalAlignmentType.Center;compoundGraphic.TextStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off;compoundGraphic.TextStyle.Shadow.ShadowOffsetX = 0;compoundGraphic.TextStyle.Shadow.ShadowOffsetY = 0;compoundGraphic.TextStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 0, 0, 0 };compoundGraphic.TextStyle.Shadow.ShadowOpacity = 0.0f;compoundGraphic.TextStyle.Underlined = false;compoundGraphic.TextStyle.Italic = false;compoundGraphic.TextStyle.Bold = false;// LineStylecompoundGraphic.LineStyle = new DicomLineStyle();compoundGraphic.LineStyle.LineOptions = DicomAnnotationLineOptions.None;compoundGraphic.LineStyle.LineOptions = DicomAnnotationLineOptions.PatternOffColorCielabValue | DicomAnnotationLineOptions.PatternOffOpacity;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] { 0, 0, 0 };compoundGraphic.LineStyle.PatternOnColorCieLabValue = new ushort[3] { 21169, 53249, 5175 }; // This is 'blue'compoundGraphic.LineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };compoundGraphic.LineStyle.LineThickness = 1.0f;compoundGraphic.LineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid;compoundGraphic.LineStyle.LinePattern = 0xFFFF;compoundGraphic.LineStyle.PatternOnOpacity = 1.0f;compoundGraphic.LineStyle.PatternOffOpacity = 0.0f;// RULER does not have a fill style// Major Ticks Sequenceint nTickCount = 4;float fTickIncrement = (float)(1.0 / (float)nTickCount);compoundGraphic.MajorTicks.Clear();for (int i = 0; i < nTickCount; i++){// i * fTickIncrement represents DicomMajorTick.TickPositionDicomMajorTick majorTickItem = new DicomMajorTick(i * fTickIncrement, "Label " + i.ToString());compoundGraphic.MajorTicks.Add(majorTickItem);}Debug.Assert(compoundGraphic.MajorTickCount == 4);return compoundGraphic;}// Creates a RECTANGLE compound graphic (rotated, filled)private DicomCompoundGraphic CreateCompoundGraphicRectangle(string layerName){// Create a compound graphicDicomCompoundGraphic compoundGraphic = new DicomCompoundGraphic();compoundGraphic.LayerName = layerName;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;Debug.Assert(compoundGraphic.AnnotationPointCount == pts.Length);// LineStylecompoundGraphic.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 }; // redcompoundGraphic.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;// FillStylecompoundGraphic.FillStyle = new DicomFillStyle();compoundGraphic.FillStyle.FillOptions = DicomAnnotationFillOptions.None;compoundGraphic.FillStyle.PatternOnColorCieLabValue = new ushort[3] { 21169, 53249, 5175 }; // bluecompoundGraphic.FillStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };compoundGraphic.FillStyle.PatternOnOpacity = 1.0f;compoundGraphic.FillStyle.PatternOffOpacity = 0.0f;compoundGraphic.FillStyle.FillMode = DicomAnnotationFillModeType.Solid;// To set a stippeled texture of the RECTANGLE compound graphic using DicomFillStyle.FillPattern, use this code:// compoundGraphic.FillStyle.FillMode = DicomAnnotationFillModeType.Stippeled;// compoundGraphic.FillStyle.FillPattern = new byte[128];// .// .// .return compoundGraphic;}private void DicomCompoundGraphicTest(string layerName, string outFile){DicomDataSet ds = new DicomDataSet();ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryModulesOnly | DicomDataSetInitializeFlags.AddMandatoryElementsOnly);ds.CreateGraphicAnnSQItem(0, layerName);DicomElement firstGraphicAnnSQItem = ds.FindFirstGraphicAnnSQItem();DicomCompoundGraphic ruler = CreateCompoundGraphicRuler(layerName);ds.CreateCompoundGraphic(firstGraphicAnnSQItem, ruler, false);DicomCompoundGraphic rotatedFilledRectangle = CreateCompoundGraphicRectangle(layerName);ds.CreateCompoundGraphic(firstGraphicAnnSQItem, rotatedFilledRectangle, false);// Save the presentation state (with annotations)ds.Save(outFile, DicomDataSetSaveFlags.None);Console.WriteLine("Presentation State Saved: " + outFile);// Find the second CompoundGraphicElement item -- this should be the rectangleDicomElement element = ds.GetCompoundGraphicElement(firstGraphicAnnSQItem, 0);string type = ds.GetValue<string>(element, false, DicomTag.CompoundGraphicType, string.Empty);Debug.Assert(type == "RULER");// Now we have two compound graphic items: ruler, rectangle// Count should be 2int nCount = ds.GetCompoundGraphicCount(firstGraphicAnnSQItem);Debug.Assert(nCount == 2);// Get the number of points of the first item (ruler) -- this should be 2nCount = ds.GetCompoundGraphicPointCount(firstGraphicAnnSQItem, 0);Debug.Assert(nCount == 2);// Get the number of major ticks in the ruler -- this should be 4nCount = ds.GetCompoundGraphicMajorTickCount(firstGraphicAnnSQItem, 0);Debug.Assert(nCount == 4);// Remove the first compound graphic (the ruler)ds.RemoveCompoundGraphic(firstGraphicAnnSQItem, 0);// Read the first compound graphic -- this should now be the rectangleDicomCompoundGraphic compoundGraphic = ds.GetCompoundGraphicInformation(firstGraphicAnnSQItem, 0);Debug.Assert(compoundGraphic.Type == DicomAnnotationCompoundGraphicType.Rectangle);// Change the rectangle from filled, to non-filledcompoundGraphic.Filled = false;ds.SetCompoundGraphicInformation(firstGraphicAnnSQItem, 0, compoundGraphic);// Verify that the rectangle is non-filledcompoundGraphic = ds.GetCompoundGraphicInformation(firstGraphicAnnSQItem, 0);Debug.Assert(compoundGraphic.Filled == false);// Remove ALL compund graphicsds.RemoveAllCompoundGraphics(firstGraphicAnnSQItem);// Get the compound graphic count -- it should now be zeronCount = ds.GetCompoundGraphicCount(firstGraphicAnnSQItem);Debug.Assert(nCount == 0);}
FindFirstGraphicAnnSQItem Method
GetCompoundGraphicInformation Method
SetCompoundGraphicInformation Method
GetCompoundGraphicCount Method
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
