←Select platform

PresentationStateIdentificationModule Class

Summary

A class that encapsulates the Presentation State Identification Module of a DICOM Grayscale Softcopy Presentation State.

Syntax
C#
C++/CLI
public class PresentationStateIdentificationModule 
public: 
   ref class PresentationStateIdentificationModule 
Remarks

The PresentationStateIdentificationModule consists of the following DICOM Elements from the Presentation State Module:

  • (0020,0013) Instance Number
  • (0070,0080) Presentation Label
  • (0070,0081) Presentation Description
  • (0070,0082) Presentation Creation Date
  • (0070,0083) Presentation Creation Time
  • (0070,0084) Presentation Creator's Name

It is used with the following methods to set the Presentation State Module of a DICOM Grayscale Softcopy Presentation State :

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Annotations; 
using Leadtools.Annotations; 
using Leadtools.Annotations.Engine; 
 
// This example stores DICOM annotations for two different DICOM instances in the same DICOM presentation file 
// The DICOM annotations are then loaded separately for each DICOM instance 
// When running this sample, you must pass two different DICOM instances for the same PatientID 
// The following DICOM files can be used: 
//    1. C:\LEADTOOLSxx\Examples\DotNet\PACSFramework\CS\PACSDatabaseConfigurationDemo\Resources\cr1.dcm 
//    2. C:\LEADTOOLSxx\Examples\DotNet\PACSFramework\CS\PACSDatabaseConfigurationDemo\Resources\cr1.dcm 
private void DicomAnnotationsUtilities_FromAnnContainerToDataSet2(DicomDataSet dsImage1, DicomDataSet dsImage2, string outfilePresentationState) 
{ 
   // Create an AnnRectangleObject (rotated, filled) 
   AnnRectangleObject rectangleObject = new AnnRectangleObject(); 
   rectangleObject.Stroke.Stroke = AnnSolidColorBrush.Create("red"); 
   rectangleObject.Fill = AnnSolidColorBrush.Create("blue"); 
   rectangleObject.Points.Add(ConvertLeadPointD(100, 100)); 
   rectangleObject.Points.Add(ConvertLeadPointD(200, 100)); 
   rectangleObject.Points.Add(ConvertLeadPointD(200, 200)); 
   rectangleObject.Points.Add(ConvertLeadPointD(100, 200)); 
   rectangleObject.Rotate(45.0, ConvertLeadPointD(150, 150)); 
 
   // Create a polyline object 
   AnnPolylineObject polylineObject = new AnnPolylineObject(); 
   polylineObject.Stroke.Stroke = AnnSolidColorBrush.Create("red"); 
   polylineObject.Points.Clear(); 
   polylineObject.Points.Add(ConvertLeadPointD(300, 100)); 
   polylineObject.Points.Add(ConvertLeadPointD(400, 200)); 
 
   // Add them to the AnnContainer 
   AnnContainer annContainer = new AnnContainer(); 
   annContainer.Mapper = new AnnContainerMapper(96, 96, 96, 96); 
   annContainer.Children.Add(rectangleObject); 
   annContainer.Children.Add(polylineObject); 
 
   // Create a DicomDataSet 
   using (DicomDataSet dsPS = new DicomDataSet()) 
   { 
      dsPS.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryModulesOnly | DicomDataSetInitializeFlags.AddMandatoryElementsOnly); 
 
      // Delete the empty referenced Series Sequence 
      DicomElement referencedSeriesSequence = dsPS.FindFirstElement(null, DicomTag.ReferencedSeriesSequence, true); 
      if (referencedSeriesSequence != null) 
      { 
         dsPS.DeleteElement(referencedSeriesSequence); 
      } 
 
      // Add a new Referenced Series Sequence 
      dsPS.AddPresentationStateImageReference(dsImage1, null, 0); 
 
      // Set up the DicomAnnotationsUtilities converter 
      DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
 
      // Change the DICOM Unique Identifier Organization Root 
      // The SOPInstanceUID of the presentation state will start with this prefix 
      du.DicomUidOrgRoot = "1.2.840.1111.2222.3333"; 
 
      // Set defaults 
      du.UseMapper = true; 
      du.ContainerMapper = annContainer.Mapper; 
      du.DefaultObject = new DicomTextObject(); 
      du.ImageDpiX = 96.0; 
      du.ImageDpiY = 96.0; 
      du.DisplayWidth = 200; 
      du.DisplayHeight = 200; 
      du.LayerName = "Layer 0"; 
 
      // Set up the presentation state module 
      PresentationStateIdentificationModule ps = new PresentationStateIdentificationModule(); 
      ps.ContentCreatorName = "My Content Creator Name"; 
      ps.ContentDescription = "My Content Description"; 
      ps.ContentLabel = "My Content Label"; 
      DateTime now = DateTime.Now; 
      ps.CreationDate = new DicomDateValue(now); 
      ps.CreationTime = new DicomTimeValue(now); 
      ps.InstanceNumber = 123; 
 
      du.PresentationStateIdentification = ps; 
 
      // Convert LEAD annotations to DICOM annotations 
 
      // Note that dsImage1 and dsImage2 must have the same PatientID 
      // The images can be from different studies and series 
 
      // 1. Add annotations for dsImage1 
      du.FromAnnContainerToDataSet(dsPS, annContainer, dsImage1, string.Empty, string.Empty, FromAnnContainerToDataSetOptions.Create); 
 
 
      // 2. Add annotations for dsImage2 
      annContainer.Children.Clear(); 
 
      // Create an AnnEllipseObject (rotated, filled) 
      AnnEllipseObject ellipseObject = new AnnEllipseObject(); 
      ellipseObject.Stroke.Stroke = AnnSolidColorBrush.Create("red"); 
      ellipseObject.Fill = AnnSolidColorBrush.Create("yellow"); 
      ellipseObject.Points.Add(ConvertLeadPointD(100, 100)); 
      ellipseObject.Points.Add(ConvertLeadPointD(200, 100)); 
      ellipseObject.Points.Add(ConvertLeadPointD(200, 200)); 
      ellipseObject.Points.Add(ConvertLeadPointD(100, 200)); 
      annContainer.Children.Add(ellipseObject); 
 
 
      du.FromAnnContainerToDataSet(dsPS, annContainer, dsImage2, string.Empty, string.Empty, FromAnnContainerToDataSetOptions.Append); 
 
      // Save the presentation state 
      dsPS.Save(outfilePresentationState, DicomDataSetSaveFlags.None); 
 
      // Read the annotations for dsImage1 -- there should be two objects 
      AnnContainer annContainer1 = du.FromDataSetToAnnContainer(dsPS, null, dsImage1); 
      Debug.Assert(annContainer1.Children.Count == 2); 
 
      // Read the annotations for dsImage2 -- there should be one object 
      AnnContainer annContainer2 = du.FromDataSetToAnnContainer(dsPS, null, dsImage2); 
      Debug.Assert(annContainer2.Children.Count == 1); 
 
      MessageBox.Show("Presentation State Saved: " + outfilePresentationState); 
   } 
} 
 
LeadPointD ConvertLeadPointD(double x, double y) 
{ 
   double imageDpi = 96.0; 
   return new LeadPointD(x * 720.0 / imageDpi, y * 720.0 / imageDpi); 
} 
Requirements

Target Platforms

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

Leadtools.Dicom.Annotations Assembly

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