←Select platform

DicomCompoundGraphic Class

Summary
The DicomCompoundGraphic class describes the attributes of a "Compound Graphic Sequence" (0070,0209).
Syntax
C#
Objective-C
C++/CLI
public class DicomCompoundGraphic : DicomAnnotationObject, IDisposable 
@interface LTDicomCompoundGraphic : LTDicomAnnotationObject 
public ref class DicomCompoundGraphic : public DicomAnnotationObject, System.IDisposable   
Remarks

The properties of this class are based on the attributes of the "Compound Graphic Sequence". Please see "Graphic Annotation Module Attributes" in the DICOM standard for more details.

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
/// 
// Creates a RULER compound graphic 
private DicomCompoundGraphic CreateCompoundGraphicRuler(string layerName) 
{ 
   // Create a compound graphic  
   DicomCompoundGraphic 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; 
 
   // TextStyle 
   compoundGraphic.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 };         // Red 
 
   compoundGraphic.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; 
 
   // LineStyle 
   compoundGraphic.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 Sequence 
   int nTickCount = 4; 
   float fTickIncrement = (float)(1.0 / (float)nTickCount); 
   compoundGraphic.MajorTicks.Clear(); 
   for (int i = 0; i < nTickCount; i++) 
   { 
      DicomMajorTick majorTickItem = new DicomMajorTick(i * fTickIncrement, "Label " + i.ToString()); 
      compoundGraphic.MajorTicks.Add(majorTickItem); 
   } 
 
   return compoundGraphic; 
} 
 
// Creates a RECTANGLE compound graphic (rotated, filled) 
private DicomCompoundGraphic CreateCompoundGraphicRectangle(string layerName) 
{ 
   // Create a compound graphic  
   DicomCompoundGraphic 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; 
 
   // 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; 
 
   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 rectangle 
   DicomElement 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 2 
   int nCount = ds.GetCompoundGraphicCount(firstGraphicAnnSQItem); 
   Debug.Assert(nCount == 2); 
 
   // Get the number of points of the first item (ruler) -- this should be 2 
   nCount = ds.GetCompoundGraphicPointCount(firstGraphicAnnSQItem, 0); 
   Debug.Assert(nCount == 2); 
 
   // Get the number of major ticks in the ruler -- this should be 4 
   nCount = 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 rectangle 
   DicomCompoundGraphic compoundGraphic = ds.GetCompoundGraphicInformation(firstGraphicAnnSQItem, 0); 
   Debug.Assert(compoundGraphic.Type == DicomAnnotationCompoundGraphicType.Rectangle); 
 
   // Change the rectangle from filled, to non-filled 
   compoundGraphic.Filled = false; 
   ds.SetCompoundGraphicInformation(firstGraphicAnnSQItem, 0, compoundGraphic); 
 
   // Verify that the rectangle is non-filled 
   compoundGraphic = ds.GetCompoundGraphicInformation(firstGraphicAnnSQItem, 0); 
   Debug.Assert(compoundGraphic.Filled == false); 
 
   // Remove ALL compund graphics 
   ds.RemoveAllCompoundGraphics(firstGraphicAnnSQItem); 
 
   // Get the compound graphic count -- it should now be zero 
   nCount = ds.GetCompoundGraphicCount(firstGraphicAnnSQItem); 
   Debug.Assert(nCount == 0); 
 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.