←Select platform

GetSignaturesCount Method

Summary

Returns the number of Digital Signatures in the main Data Set or in an item of a sequence of items.

Syntax

C#
VB
WinRT C#
C++
public int GetSignaturesCount(  
   Leadtools.Dicom.DicomElement item 
) 
Public Function GetSignaturesCount( _ 
   ByVal item As Leadtools.Dicom.DicomElement _ 
) As Integer 
public int GetSignaturesCount(  
   Leadtools.Dicom.DicomElement item 
) 
 function Leadtools.Dicom.DicomDataSet.GetSignaturesCount(  
   item  
) 
public: 
int GetSignaturesCount(  
   Leadtools.Dicom.DicomElement^ item 
)  

Parameters

item
An item of a sequence of items in the Data Set. The method returns the number of Digital Signatures in this Item. If this parameter is set to null, the method will return the number of Digital Signatures in the main Data Set.

Return Value

The number of Digital Signatures in the specified item, or in the main Data Set if no item is specified.

Remarks

The method computes the number of Digital Signatures by counting the number of items under the Digital Signatures sequence (FFFA,FFFA) which is located under the item specified by item or on the root of the Data Set if the parameter is set to null. The method will return 0 if this sequence does not exist. One way of enumerating the Digital Signatures in the main Data Set or in an item of a sequence of items is by using this method along with the GetSignature method.

Example

This example will enumerate all digital signatures in a DICOM dataset.

C#
VB
Silverlight C#
Silverlight VB
using Leadtools; 
using Leadtools.Dicom; 
 
public void EnumerateSignatures() 
{ 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "Signed.dcm"); 
   //Make sure to initialize the DICOM engine, this needs to be done only once  
   //In the whole application 
   DicomEngine.Startup(); 
   using (DicomDataSet dataset = new DicomDataSet()) 
   { 
      //Load DICOM File 
      dataset.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      // We will enumerate the Digital Signatures in the main Data Set 
      int signaturesCount = dataset.GetSignaturesCount(null); 
      if (signaturesCount == 0) 
      { 
         MessageBox.Show("No Digital Signatures in the main Data Set."); 
         return; 
      } 
      string msg; 
      if (signaturesCount == 1) 
      { 
         msg = "There is 1 Digital Signature in the main Data Set.Do you want to examine it?"; 
      } 
      else 
      { 
         msg = String.Format("There are {0} Digital Signatures in the main Data Set. Do you want to examine them?", signaturesCount); 
      } 
      if (MessageBox.Show(msg, "Sample", MessageBoxButtons.YesNo) != DialogResult.Yes) 
      { 
         return; 
      } 
      for (int i = 0; i < signaturesCount; i++) 
      { 
         ExamineSignature(dataset, dataset.GetSignature(null, i)); 
      } 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools 
Imports Leadtools.Dicom 
 
<TestMethod> 
Public Sub EnumerateSignatures() 
   Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Signed.dcm") 
   'Make sure to initialize the DICOM engine, this needs to be done only once  
   'In the whole application 
   DicomEngine.Startup() 
   Using dataset As New DicomDataSet() 
      'Load DICOM File 
      dataset.Load(dicomFileName, DicomDataSetLoadFlags.None) 
      ' We will enumerate the Digital Signatures in the main Data Set 
      Dim signaturesCount As Integer = dataset.GetSignaturesCount(Nothing) 
      If signaturesCount = 0 Then 
         MessageBox.Show("No Digital Signatures in the main Data Set.") 
         Return 
      End If 
      Dim msg As String 
      If signaturesCount = 1 Then 
         msg = "There is 1 Digital Signature in the main Data Set.Do you want to examine it?" 
      Else 
         msg = [String].Format("There are {0} Digital Signatures in the main Data Set. Do you want to examine them?", signaturesCount) 
      End If 
      If MessageBox.Show(msg, "Sample", MessageBoxButtons.YesNo) <> DialogResult.Yes Then 
         Return 
      End If 
      For i As Integer = 0 To signaturesCount - 1 
         ExamineSignature(dataset, dataset.GetSignature(Nothing, i)) 
      Next 
   End Using 
   DicomEngine.Shutdown() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools; 
using Leadtools.Dicom; 
using Leadtools.Examples; 
 
//public void EnumerateSignatures(Stream dicomStream) 
//{ 
//   //Make sure to initialize the DICOM engine, this needs to be done only once  
//   //In the whole application 
//   DicomEngine.Startup(); 
//   using (DicomDataSet dataset = new DicomDataSet()) 
//   { 
//      //Load DICOM File 
//      dataset.Load(dicomStream, DicomDataSetLoadFlags.None); 
//      // We will enumerate the Digital Signatures in the main Data Set 
//      int signaturesCount = dataset.GetSignaturesCount(null); 
//      if (signaturesCount == 0) 
//      { 
//         Debug.WriteLine("No Digital Signatures in the main Data Set."); 
//         return; 
//      } 
//      string msg; 
//      if (signaturesCount == 1) 
//      { 
//         msg = "There is 1 Digital Signature in the main Data Set.Do you want to examine it?"; 
//      } 
//      else 
//      { 
//         msg = String.Format("There are {0} Digital Signatures in the main Data Set. Do you want to examine them?", signaturesCount); 
//      } 
//      Debug.WriteLine(msg, "Sample"); 
//      for (int i = 0; i < signaturesCount; i++) 
//      { 
//         ExamineSignature(dataset, dataset.GetSignature(null, i)); 
//      } 
//   } 
//   DicomEngine.Shutdown(); 
//} 
Imports Leadtools 
Imports Leadtools.Dicom 
 
'public void EnumerateSignatures(Stream dicomStream) 
'{ 
'   //Make sure to initialize the DICOM engine, this needs to be done only once  
'   //In the whole application 
'   DicomEngine.Startup(); 
'   using (DicomDataSet dataset = new DicomDataSet()) 
'   { 
'      //Load DICOM File 
'      dataset.Load(dicomStream, DicomDataSetLoadFlags.None); 
'      // We will enumerate the Digital Signatures in the main Data Set 
'      int signaturesCount = dataset.GetSignaturesCount(null); 
'      if (signaturesCount == 0) 
'      { 
'         Debug.WriteLine("No Digital Signatures in the main Data Set."); 
'         return; 
'      } 
'      string msg; 
'      if (signaturesCount == 1) 
'      { 
'         msg = "There is 1 Digital Signature in the main Data Set.Do you want to examine it?"; 
'      } 
'      else 
'      { 
'         msg = String.Format("There are {0} Digital Signatures in the main Data Set. Do you want to examine them?", signaturesCount); 
'      } 
'      Debug.WriteLine(msg, "Sample"); 
'      for (int i = 0; i < signaturesCount; i++) 
'      { 
'         ExamineSignature(dataset, dataset.GetSignature(null, i)); 
'      } 
'   } 
'   DicomEngine.Shutdown(); 
'} 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Dicom Assembly
Click or drag to resize