
De-identify / Anonymize a DICOM File (HIPAA & DICOM PS3.15 Profile)
Source:R/anonymize.R
dicom_anonymize.RdRemoves or replaces Protected Health Information (PHI) tags according to HIPAA Safe Harbor and the DICOM PS3.15 Basic Application Level Confidentiality Profile. Supports date shifting, private tag removal, UID regeneration, and custom tag overrides.
Arguments
- path
Path to input DICOM file.
- out_path
Output path for anonymized DICOM file. If
NULL(default), writes to a temporary.dcmfile.- patient_name
Replacement string for
PatientName (0010,0010). Default is"ANONYMOUS".- patient_id
Replacement string for
PatientID (0010,0020). Default is"ANON001".- shift_days
Optional integer number of days to shift all date (
DA) tags (e.g.,-365shifts dates back by 1 year). IfNULL(default), date tags are replaced with"19000101".- erase_private
Logical. Remove all odd-group private tags. Default is
TRUE.- regenerate_uids
Logical. Regenerate
SOPInstanceUID,StudyInstanceUID, andSeriesInstanceUID. Default isTRUE.Optional character vector of additional tags or keywords to remove.
Named list of additional tag/value replacements.
Examples
dcm_file <- system.file("extdata", "example.dcm", package = "dicomtk")
anon_file <- dicom_anonymize(dcm_file, patient_name = "STUDY^SUBJECT01")
dicom_tag_value(anon_file, c("PatientName", "PatientIdentityRemoved"))
#> PatientName PatientIdentityRemoved
#> "STUDY^SUBJECT01" "YES"