This Python-based package uses Grand-Challenge De-Identification Procedure to de-identify DICOM files.
It follows the procedure's prescribed actions of keeping, replacing, rejecting, or replacing elements in the files.
Install via:
$ pip install grand-challenge-dicom-de-identifier
In your Python script then initiate the deidentifier and use either the deidentify_file or deidentify_file methods to process data:
from grand_challenge_dicom_de_identifier.deidentifier import DicomDeidentifier
deidentifier = DicomDeidentifier()
# Deidentify a single file
deidentifier.deidentify_file(
"input.dcm",
output="anom/output.dcm"
)Or by providing a pydicom.Dataset directly:
from grand_challenge_dicom_de_identifier.deidentifier import DicomDeidentifier
import pydicom
deidentifier = DicomDeidentifier()
dataset = pydicom.Dataset()
# Deidentify a pydicom Dataset
deidentifier.deidentify_dataset(
dataset
)The following arguments can be provided to the deidentifier:
A collection of element keywords (e.g. ["PatientName"]) that ensures input files all have the same value for these elements. If a file has a different value for any of these elements compared to previous files, a RejectedDICOMFileError is raised. By default no such check is performed.
A specific suffix to overwrite the respective
StudyInstanceUIDandSeriesInstanceUIDwith. These will be prefixed with the ROOT uid of Grand Challenge:"1.2.826.0.1.3680043.10.1666.".