Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.3.25
|
Leadtools.Dicom Namespace > DicomDataSet Class : FindSignature Method |
public DicomElement FindSignature( string signatureUID )
'Declaration
Public Function FindSignature( _ ByVal signatureUID As String _ ) As DicomElement
'Usage
Dim instance As DicomDataSet Dim signatureUID As String Dim value As DicomElement value = instance.FindSignature(signatureUID)
public DicomElement FindSignature( string signatureUID )
function Leadtools.Dicom.DicomDataSet.FindSignature( signatureUID )
public: DicomElement^ FindSignature( String^ signatureUID )
Once the Digital Signatures Sequence Item is obtained, the following methods can be used to verify, delete, or get information about the Digital Signature:
Call the GetSignaturesCount and GetSignature methods to enumerate the Digital Signatures in the main Data Set or in an item of a Sequence of Items.
This example will locate (find) a digital signature inside a DICOM dataset by searching for its UID.
Imports Leadtools Imports Leadtools.Dicom <TestMethod()> _ Public Sub FindSignature() Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm") 'Make sure to initialize the DICOM engine, this needs to be done only once 'In the whole application DicomEngine.Startup() Dim ds As DicomDataSet = New DicomDataSet() Using (ds) 'Load DICOM File ds.Load(dicomFileName, DicomDataSetLoadFlags.None) Dim signatureUID As String = "1.2.840.114257.0.130573664" ' Search the whole Data Set for the Digital Signature with the ' specified Digital Signature UID Dim signatureItem As DicomElement = ds.FindSignature(signatureUID) If Not signatureItem Is Nothing Then ds.DeleteSignature(signatureItem) MessageBox.Show("The Digital Signature was found and got deleted.", "Sample") Else MessageBox.Show("The Digital Signature could not be found.", "Sample") End If 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; [TestMethod] public void FindSignature() { string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"); //Make sure to initialize the DICOM engine, this needs to be done only once //In the whole application DicomEngine.Startup(); using (DicomDataSet ds = new DicomDataSet()) { //Load DICOM File ds.Load(dicomFileName, DicomDataSetLoadFlags.None); string signatureUID = "1.2.840.114257.0.130573664"; // Search the whole Data Set for the Digital Signature with the // specified Digital Signature UID DicomElement signatureItem = ds.FindSignature(signatureUID); if (signatureItem != null) { ds.DeleteSignature(signatureItem); MessageBox.Show("The Digital Signature was found and got deleted.", "Sample"); } else { MessageBox.Show("The Digital Signature could not be found.", "Sample"); } } DicomEngine.Shutdown(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
using Leadtools.Dicom.Constants; using Leadtools; using Leadtools.Dicom; [TestMethod] public async Task FindSignature() { //Make sure to initialize the DICOM engine, this needs to be done only once //In the whole application DicomEngine.Startup(); using (DicomDataSet ds = new DicomDataSet()) { //Load DICOM File string filePath = @"Assets\Dicom_digitallysigned.dcm"; StorageFile file = await Tools.AppInstallFolder.GetFileAsync(filePath); ILeadStream stream = LeadStreamFactory.Create(file); bool success = await ds.LoadAsync(stream, DicomDataSetLoadFlags.None); Debug.Assert(success); string signatureUID = "1.2.840.114257.0.13002946704035050457818467253101580800041"; // Search the whole Data Set for the Digital Signature with the // specified Digital Signature UID DicomElement signatureItem = ds.FindSignature(signatureUID); if (signatureItem != null) { ds.DeleteSignature(signatureItem); Debug.WriteLine("FindSignature: The Digital Signature was found and got deleted."); } else { Debug.WriteLine("FindSignature: The Digital Signature could not be found."); } } DicomEngine.Shutdown(); }
DicomDataSet Class
DicomDataSet Members
GetSignaturesCount Method
GetSignature Method
VerifySignature Method
DeleteSignature Method
GetSignatureUID Method
GetSignatureDateTime Method
GetSignedElementsCount Method
GetSignedElement Method
GetMacTransferSyntax Method
GetMacAlgorithm Method
SaveCertificate Method
CreateSignature Method