Progress Event

Summary
Anonymization progress notification event.
Syntax
C#
VB
C++
public event EventHandler<ProgressEventArgs> Progress 
Public Event Progress As EventHandler(Of ProgressEventArgs) 
public: 
event EventHandler<ProgressEventArgs^>^ Progress 
Event Data

The event handler receives an argument of type ProgressEventArgs containing data related to this event. The following ProgressEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs)Gets or sets a value indicating whether the event should be canceled.
Progress Gets or sets the current progress.
Example

This example anonymize a dataset using the DICOM Anonymization basic profile.

C#
VB
using Leadtools.Dicom.Common.Anonymization; 
using Leadtools.Dicom; 
 
 
public void AnonymizationSample() 
{ 
   Anonymizer anonymizer = new Anonymizer(); 
   string dicomFileNameIn = Path.Combine(LEAD_VARS.ImagesDir,"DICOM", "image3.dcm"); 
 
   anonymizer.Progress += new EventHandler<ProgressEventArgs>(anonymizer_Progress); 
   anonymizer.BeforeTagAnonymization += new EventHandler<BeforeTagAnonymizationEventArgs>(anonymizer_BeforeTagAnonymization); 
   DicomEngine.Startup(); 
   using (DicomDataSet source = new DicomDataSet()) 
   { 
      string oldPatientId = string.Empty; 
 
      source.Load(dicomFileNameIn, DicomDataSetLoadFlags.None); 
      oldPatientId = source.GetValue<string>(DicomTag.PatientID, string.Empty); 
      anonymizer.Anonymize(source); 
 
      // 
      // The values should not be equal because the anonymizer has provided another patient ID using the DICOM Anonymization basic profile. 
      // By default the following macro is provided for patient id: ${random_string} 
      // 
             
      Assert.IsTrue(oldPatientId != source.GetValue<string>(DicomTag.PatientID, string.Empty), "The values should not be equal because the anonymizer has provided another patient ID using the DICOM Anonymization basic profile."); 
   } 
 
   DicomEngine.Shutdown(); 
} 
 
void anonymizer_BeforeTagAnonymization(object sender, BeforeTagAnonymizationEventArgs e) 
{ 
   Console.WriteLine(string.Format("Tag: {0}, Current Value: {1}, New Value: {0} ", e.Element.Tag, e.CurrentValue, e.NewValue)); 
} 
 
void anonymizer_Progress(object sender, ProgressEventArgs e) 
{ 
   Console.WriteLine("Progress: " + e.Progress.ToString()); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools.Dicom.Common.Anonymization 
Imports Leadtools.Dicom 
 
Public Sub AnonymizationSample() 
   Dim anonymizer As New Anonymizer() 
   Dim dicomFileNameIn As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm") 
 
   AddHandler anonymizer.Progress, AddressOf anonymizer_Progress 
   AddHandler anonymizer.BeforeTagAnonymization, AddressOf anonymizer_BeforeTagAnonymization 
   Using source As New DicomDataSet() 
      Dim oldPatientId As String = String.Empty 
 
      source.Load(dicomFileNameIn, DicomDataSetLoadFlags.None) 
      oldPatientId = source.GetValue(Of String)(DicomTag.PatientID, String.Empty) 
      anonymizer.Anonymize(source) 
 
      ' 
      ' The values should not be equal because the anonymizer has provided another patient ID using the DICOM Anonymization basic profile. 
      ' By default the following macro is provided for patient id: ${random_string} 
      ' 
      Debug.Assert(oldPatientId <> source.GetValue(Of String)(DicomTag.PatientID, String.Empty)) 
   End Using 
End Sub 
 
Private Sub anonymizer_BeforeTagAnonymization(ByVal sender As Object, ByVal e As BeforeTagAnonymizationEventArgs) 
   Console.WriteLine(String.Format("Tag: {0}, Current Value: {1}, New Value: {0} ", e.Element.Tag, e.CurrentValue, e.NewValue)) 
End Sub 
 
Private Sub anonymizer_Progress(ByVal sender As Object, ByVal e As ProgressEventArgs) 
   Console.WriteLine("Progress: " + e.Progress.ToString()) 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.