←Select platform

GetPresentationStateImageReferenceSOPInstance Method

Summary
Retrieves the SOP Instance UID for a referenced image (SOP Instance) under the "Referenced Image Sequence" in the "Presentation State Module".
Syntax
C#
C++/CLI
Java
public string GetPresentationStateImageReferenceSOPInstance( 
   DicomElement refSeriesSQItem, 
   int imageIndex 
) 
public String getPresentationStateImageReferenceSOPInstance(DicomElement refSeriesSQItem, int imageIndex) 
public: 
String^ GetPresentationStateImageReferenceSOPInstance(  
   DicomElement^ refSeriesSQItem, 
   int imageIndex 
)  

Parameters

refSeriesSQItem
An item element under the "Referenced Series Sequence" (0008,1115) in the "Presentation State Module".

imageIndex
The zero-based index of the required SOP Instance UID.

Return Value

The SOP Instance UID of the specified referenced image (SOP Instance).

Remarks

This method will return the "SOP Instance UID" for a referenced image (SOP Instance) under the "Referenced Image Sequence" (0008,1115) in one of the items under "Referenced Series Sequence" (0008,1115) in the "Presentation State Module". Call this method along with GetPresentationStateImageReferenceCount in order to enumerate all the referenced images under the specified "Referenced Image Sequence".

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
public void DicomPresStateSample() 
{ 
   //Make sure to initialize the DICOM engine, this needs to be done only once  
   //In the whole application 
   DicomEngine.Startup(); 
   using (DicomDataSet dicomDataset = new DicomDataSet()) 
   { 
      dicomDataset.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeType.ExplicitVRLittleEndian); 
      DicomPresentationStateInformation presentationStateInfo = new DicomPresentationStateInformation(); 
      presentationStateInfo.InstanceNumber = 1; 
      presentationStateInfo.PresentationLabel = "LABEL"; 
      presentationStateInfo.PresentationDescription = "Description"; 
      presentationStateInfo.PresentationCreator = "Creator"; 
      DicomDateValue presentationCreationDate = new DicomDateValue(); 
      presentationCreationDate.Year = 2004; 
      presentationCreationDate.Month = 1; 
      presentationCreationDate.Day = 8; 
      DicomTimeValue presentationCreationTime = new DicomTimeValue(); 
      presentationCreationTime.Hours = 2; 
      presentationCreationTime.Minutes = 3; 
      presentationCreationTime.Seconds = 5; 
      presentationStateInfo.PresentationCreationDate = presentationCreationDate; 
      presentationStateInfo.PresentationCreationTime = presentationCreationTime; 
      dicomDataset.SetPresentationStateInformation(presentationStateInfo); 
 
      DicomPresentationStateInformation presentationStateInfo1 = dicomDataset.GetPresentationStateInformation(); 
      Debug.Assert(presentationStateInfo1 != null); 
      Debug.Assert(presentationStateInfo1.InstanceNumber == 1); 
 
      //RemovePresStateImageRefBySOPInstance can be used to remove indivual referened images 
      dicomDataset.RemoveAllPresentationStateImageReferences(); 
      Debug.Assert(dicomDataset.GetPresentationStateImageReferenceCount(null) == 0); 
      // We can also load the dataset first and then call AddPresStateImageRefByDS 
      dicomDataset.AddPresentationStateImageReference(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "IMAGE3.dcm"), null, 0); 
 
      // We can also add the presentation state using a stream 
      using (FileStream stream = new FileStream(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "image3.dcm"), FileMode.Open)) 
      { 
         dicomDataset.AddPresentationStateImageReference(stream, null, 0); 
      } 
 
      //We can also use FindNextPresStateRefSeriesItem to iterate through all items 
      DicomElement item = dicomDataset.FindFirstPresentationStateReferencedSeriesItem(); 
 
      string imageRefSOPInstanceUID = dicomDataset.GetPresentationStateImageReferenceSOPInstance(item, 0); 
      Debug.Assert(imageRefSOPInstanceUID != null); 
      DicomElement item1 = dicomDataset.GetPresentationStateImageReference(imageRefSOPInstanceUID); 
      Debug.Assert(item1 != null); 
 
      dicomDataset.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "PresentationState.dcm"), DicomDataSetSaveFlags.None); 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

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.