Returns the number of Digital Signatures in the main Data Set or in an item of a
sequence of items.
Syntax
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.
Example
This example will enumerate all digital signatures in a DICOM dataset.
Visual Basic | Copy Code |
---|
Public Sub EnumerateSignatures()
Dim dicomFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Signed.dcm"
DicomEngine.Startup()
Dim dataset As DicomDataSet = New DicomDataSet()
Using (dataset)
dataset.Load(dicomFileName, DicomDataSetLoadFlags.None)
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
Dim i As Integer = 0
Do While i < signaturesCount
ExamineSignature(dataset, dataset.GetSignature(Nothing, i))
i += 1
Loop
End Using
DicomEngine.Shutdown()
End Sub |
C# | Copy Code |
---|
public void EnumerateSignatures() { string dicomFileName = LeadtoolsExamples.Common.ImagesPath.Path + "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(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also