public event EventHandler<BeforeTagAnonymizationEventArgs> BeforeTagAnonymization
public:
event EventHandler<BeforeTagAnonymizationEventArgs^>^ BeforeTagAnonymization
The event handler receives an argument of type BeforeTagAnonymizationEventArgs containing data related to this event. The following BeforeTagAnonymizationEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | Gets or sets a value indicating whether the event should be canceled. |
CurrentValue | Gets the current value of the DICOM element. |
Element | Gets the element in the DICOM dataset that is being anonymized. |
NewValue | Gets or sets the new value of the DICOM element. |
This event will occur after the tag has been processed with the MacroProcessor.
This example anonymizes a dataset using the DICOM Anonymization basic profile.
using Leadtools.Dicom.Common.Anonymization;
using Leadtools.Dicom;
public void AnonymizationSample()
{
Anonymizer anonymizer = new Anonymizer(true);
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:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document