Aspose.Medical DICOM Anonymizer for .NET
Aspose.Medical DICOM Anonymizer for .NET is a powerful API focused on protecting patient privacy in medical imaging files. It removes or modifies personally identifiable information (PII) from DICOM files while maintaining the integrity of medical images, ensuring compliance with privacy regulations such as HIPAA and GDPR. Built for healthcare applications and research workflows, it provides standards-compliant anonymization with customizable profiles.
Installation and Setup
- Install the NuGet package
Aspose.Medical(core API powering anonymization). - Apply metered licensing at startup to avoid evaluation limits: see Metered Licensing .
- Review framework requirements in the Installation Guide .
Supported Platforms
- OS: Windows, Linux, macOS
- Frameworks: .NET 8.0+
- Architectures: x64, ARM64 (macOS)
Quick Start
1) Basic Anonymization
using Aspose.Medical.Dicom;
using Aspose.Medical.Dicom.Anonymization;
// Load and anonymize a DICOM file
DicomFile dcm = DicomFile.Open("patient_scan.dcm");
Anonymizer anonymizer = new();
DicomFile anonymized = anonymizer.Anonymize(dcm);
anonymized.Save("anonymized_scan.dcm");2) Anonymization with Predefined Profile
using Aspose.Medical.Dicom;
using Aspose.Medical.Dicom.Anonymization;
// Create a confidentiality profile with specific options
ConfidentialityProfile profile = ConfidentialityProfile.CreateDefault(
ConfidentialityProfileOptions.CleanGraph);
// Create anonymizer with the profile
Anonymizer anonymizer = new(profile);
// Load and anonymize
DicomFile dcm = DicomFile.Open("input.dcm");
DicomFile anonymized = anonymizer.Anonymize(dcm);
anonymized.Save("anonymized_output.dcm");3) Custom Patient Information Replacement
using Aspose.Medical.Dicom;
using Aspose.Medical.Dicom.Anonymization;
// Create profile with custom replacement values
ConfidentialityProfile profile = new()
{
PatientName = "ANONYMOUS PATIENT",
PatientId = "00000000"
};
Anonymizer anonymizer = new(profile);
DicomFile dcm = DicomFile.Open("input.dcm");
DicomFile anonymized = anonymizer.Anonymize(dcm);
anonymized.Save("custom_anonymized.dcm");4) In-Place Anonymization
using Aspose.Medical.Dicom;
using Aspose.Medical.Dicom.Anonymization;
// Modify file directly without creating a new instance
DicomFile dcm = DicomFile.Open("input.dcm");
Anonymizer anonymizer = new();
anonymizer.AnonymizeInPlace(dcm);
dcm.Save("inplace_anonymized.dcm");5) Load Custom Profile from File
using Aspose.Medical.Dicom;
using Aspose.Medical.Dicom.Anonymization;
// Load custom profile from JSON file
ConfidentialityProfile profile = ConfidentialityProfile.LoadFromJsonFile(
"custom_profile.json",
ConfidentialityProfileOptions.All);
Anonymizer anonymizer = new(profile);
DicomFile dcm = DicomFile.Open("input.dcm");
DicomFile anonymized = anonymizer.Anonymize(dcm);Features and Functionality
Privacy Compliance
Supported Regulations:
- HIPAA - Health Insurance Portability and Accountability Act
- GDPR - General Data Protection Regulation
- DICOM PS3.15 - Security and System Management Profiles
The anonymizer removes or modifies sensitive patient information while preserving the medical diagnostic value of images.
Predefined Confidentiality Profiles
Built-in profiles based on DICOM PS3.15 standards:
| Profile | Description |
|---|---|
BasicProfile | Basic anonymization removing core patient identifiers |
RetainSafePrivate | Retain Safe Private Option Profile |
RetainUIDs | Retain UIDs Option Profile |
RetainDeviceIdent | Retain Device Identification Option |
RetainInstitutionIdent | Retain Institution Identification Option |
RetainPatientChars | Retain Patient Characteristics Option |
RetainLongFullDates | Retain Long Full Dates Option |
RetainLongModifDates | Retain Long Modification Dates Option |
CleanDesc | Clean Descriptions Option |
CleanStructdCont | Clean Structured Content Option |
CleanGraph | Clean Graphics Option |
All | Union of all listed options |
Confidentiality Actions
Actions that determine how sensitive data is processed:
| Action | Description |
|---|---|
D | Remove the data completely |
Z | Replace value with zero-length string |
X | Replace value with dummy data |
K | Keep the value unchanged |
C | Replace with a coded phrase |
U | Replace with universally unique identifier (UID) |
Custom Anonymization Profiles
Load custom profiles from various formats for full control over anonymization rules.
CSV Format:
TagPattern;Action
0010,0010;Z // Anonymize PatientName
0010,0020;D // Remove PatientID
0020,000D;U // Replace StudyInstanceUIDConfidentialityProfile profile = ConfidentialityProfile.LoadFromCsvFile(
"profile.csv",
ConfidentialityProfileOptions.All);JSON Format:
[
{ "Tag": "0010,0010", "Action": "Z" },
{ "Tag": "0010,0020", "Action": "D" },
{ "Tag": "0020,000D", "Action": "U" }
]ConfidentialityProfile profile = ConfidentialityProfile.LoadFromJsonFile(
"profile.json",
ConfidentialityProfileOptions.All);XML Format:
<root>
<item>
<tag>0010,0010</tag>
<action>Z</action>
</item>
<item>
<tag>0010,0020</tag>
<action>D</action>
</item>
</root>ConfidentialityProfile profile = ConfidentialityProfile.LoadFromXmlFile(
"profile.xml",
ConfidentialityProfileOptions.All);Common Use Cases
- Clinical Research: Anonymize patient scans before sharing with research institutions.
- Multi-Site Studies: Prepare DICOM files for collaborative research across healthcare facilities.
- Teaching and Training: Create anonymized datasets for medical education purposes.
- Cloud Storage: Remove PII before uploading medical images to cloud platforms.
- Data Exchange: Safely share imaging data between organizations while maintaining compliance.
Best Practices
- License first: Initialize metered licensing before any anonymization to avoid evaluation watermarks.
- Validate results: Review anonymized files to ensure all required identifiers were removed.
- Backup originals: Keep secure backups of original files before anonymization.
- Custom profiles: Use custom profiles when standard profiles don’t meet specific compliance requirements.
- Audit trail: Maintain logs of anonymization operations for regulatory compliance.
- Test thoroughly: Verify anonymization with sample files before processing production data.
FAQ
Does it require Microsoft Office or third-party DICOM viewers? No. It is a standalone API that works independently.
Can I anonymize files without creating new copies?
Yes. Use AnonymizeInPlace method to modify files directly.
Which tags are anonymized by default? The default Basic Profile removes patient name, ID, birth date, and other core identifiers as defined in DICOM PS3.15.
Can I customize which fields are anonymized?
Yes. Create custom profiles using CSV, JSON, or XML files, or programmatically configure the ConfidentialityProfile.
Are multi-frame DICOM files supported? Yes. Anonymization works with single and multi-frame DICOM files.
What happens to embedded images and overlays?
The CleanGraph option can remove or sanitize graphical elements that may contain patient information.