Leadtools.Dicom Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SetPresentationStateInformation Method
See Also  Example
Leadtools.Dicom Namespace > DicomDataSet Class : SetPresentationStateInformation Method



presentationStateInformation
"Presentation State Module" attributes
presentationStateInformation
"Presentation State Module" attributes
Sets the attributes of the "Presentation State Module".

Syntax

Visual Basic (Declaration) 
Public Sub SetPresentationStateInformation( _
   ByVal presentationStateInformation As DicomPresentationStateInformation _
) 
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim presentationStateInformation As DicomPresentationStateInformation
 
instance.SetPresentationStateInformation(presentationStateInformation)
C# 
public void SetPresentationStateInformation( 
   DicomPresentationStateInformation presentationStateInformation
)
C++/CLI 
public:
void SetPresentationStateInformation( 
   DicomPresentationStateInformation^ presentationStateInformation
) 

Parameters

presentationStateInformation
"Presentation State Module" attributes

Example

This example will initialize a new DICOM dataset and update its presentation state information.

Visual BasicCopy Code
Public Sub DicomPresStateSample()
   'Make sure to initialize the DICOM engine, this needs to be done only once
   'In the whole application
   DicomEngine.Startup()

   Dim dicomDataset As DicomDataSet = New DicomDataSet()
   Using (dicomDataset)
      dicomDataset.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeType.ExplicitVRLittleEndian)
      Dim presentationStateInfo As DicomPresentationStateInformation = New DicomPresentationStateInformation()
      presentationStateInfo.InstanceNumber = 1
      presentationStateInfo.PresentationLabel = "Label"
      presentationStateInfo.PresentationDescription = "Description"
      presentationStateInfo.PresentationCreator = "Creator"
      Dim presentationCreationDate As DicomDateValue = New DicomDateValue()
      presentationCreationDate.Year = 2004
      presentationCreationDate.Month = 1
      presentationCreationDate.Day = 8
      Dim presentationCreationTime As DicomTimeValue = New DicomTimeValue()
      presentationCreationTime.Hours = 2
      presentationCreationTime.Minutes = 3
      presentationCreationTime.Seconds = 5
      presentationStateInfo.PresentationCreationDate = presentationCreationDate
      presentationStateInfo.PresentationCreationTime = presentationCreationTime
      dicomDataset.SetPresentationStateInformation(presentationStateInfo)

      Dim presentationStateInfo1 As DicomPresentationStateInformation = dicomDataset.GetPresentationStateInformation()
      Debug.Assert(Not presentationStateInfo1 Is Nothing)
      Debug.Assert(presentationStateInfo1.InstanceNumber = 1)

      'RemovePresStateImageRefBySOPInstance can be used to remove indivual referened images
      dicomDataset.RemoveAllPresentationStateImageReferences()
      Debug.Assert(dicomDataset.GetPresentationStateImageReferenceCount(Nothing) = 0)
      ' We can also load the dataset first and then call AddPresStateImageRefByDS
      dicomDataset.AddPresentationStateImageReference(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE3.dic", Nothing, 0)

      'We can also use FindNextPresStateRefSeriesItem to itertate throgh all items
      Dim item As DicomElement = dicomDataset.FindFirstPresentationStateReferencedSeriesItem()

      Dim imageRefSOPInstanceUID As String = dicomDataset.GetPresentationStateImageReferenceSOPInstance(item, 0)
      Debug.Assert(Not imageRefSOPInstanceUID Is Nothing)
      Dim item1 As DicomElement = dicomDataset.GetPresentationStateImageReference(imageRefSOPInstanceUID)
      Debug.Assert(Not item1 Is Nothing)

      dicomDataset.Save(LeadtoolsExamples.Common.ImagesPath.Path + "PresentationState.dic", DicomDataSetSaveFlags.None)
   End Using

   DicomEngine.Shutdown()
End Sub
C#Copy Code
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(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE3.dic", null, 0); 
 
      //We can also use FindNextPresStateRefSeriesItem to itertate throgh 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(LeadtoolsExamples.Common.ImagesPath.Path + "PresentationState.dic", DicomDataSetSaveFlags.None); 
   } 
   DicomEngine.Shutdown(); 
}

Remarks

This method will set the attributes of the "Presentation State Module".

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Leadtools.Dicom requires a Medical toolkit server license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features