←Select platform

DicomAnnotationTickAlignmentType Enumeration

Summary
Represents the value of the "Tick Alignment" element (0070,0274) in a "Compound Graphic Sequence" item.
Syntax
C#
Objective-C
C++/CLI
public enum DicomAnnotationTickAlignmentType   
typedef NS_ENUM(NSInteger, LTDicomAnnotationTickAlignmentType) { 
	LTDicomAnnotationTickAlignmentTypeNone = 0,  
	LTDicomAnnotationTickAlignmentTypeTop = 1,  
	LTDicomAnnotationTickAlignmentTypeCenter = 2,  
	LTDicomAnnotationTickAlignmentTypeBottom = 3,  
}; 
public enum class DicomAnnotationTickAlignmentType   
Members
ValueMemberDescription
0None The "Tick Alignment" element (0070,0274) is not present, or should not be written
1Top The "Tick Alignment" element (0070,0274) has the value "TOP".
2Center The "Tick Alignment" element (0070,0274) has the value "CENTER".
3Bottom The "Tick Alignment" element (0070,0274) has the value "BOTTOM".
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; 
   Debug.Assert(compoundGraphic.AnnotationPointCount == pts.Length); 
 
   // 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++) 
   { 
      // i * fTickIncrement represents DicomMajorTick.TickPosition 
      DicomMajorTick 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 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; 
   Debug.Assert(compoundGraphic.AnnotationPointCount == pts.Length); 
 
   // 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; 
 
   // 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 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

See Also

Reference

Leadtools.Dicom Namespace

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

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