Module that provides tools to anonymize DICOM files.
-
pydcmio.dcmanonymizer.anonymize.
anonymize_dataset
(dataset, level=1)[source]¶ Anonymize a pydicom dataset.
Parameters: dataset: dicom.dataset.Dataset (mandatory)
a dataset to anonymize.
-
pydcmio.dcmanonymizer.anonymize.
anonymize_dicomdir
(inputdir, outdir, write_logs=True)[source]¶ Anonymize all DICOM files of the input directory.
Parameters: inputdir: str (mandatory)
A folder that contains only DICOM files to be anonymized.
outdir: str (mandatory)
The anonimized DICOM files folder.
write_logs: bool (optional, default True)
If True write the anonimization logs.
Returns: dcmfiles: str
The anonimized DICOM files.
logfiles: list
The anonimization log files.
-
pydcmio.dcmanonymizer.anonymize.
anonymize_dicomfile
(input_dicom, outdir, outname=None, write_log=True)[source]¶ Anonymize DICOMs
According to PS 3.15-2008, basic application level de-indentification of a DICOM file requires replacing the values of a set of data elements and the supplement 142 on the clinical trial de-identification profiles. All the anonymized fields are replaced and may be set in future into the encrypted attributes sequence (0400,0550). In the standard it is not required that the Encrypted Attributes Dataset be created; indeed, there may be circumstances where the Dataset is expected to be archived long enough that any contemporary encryption technology may be inadequate to provide long term protection against unauthorized recovery of identification.
The applied de-identification methods are:
- 113100 - Basic Application Confidentiality Profil
- 113103 - Clean Graphics Option
- 113109 - Retain Device Identity Option
To do:
- 113102 - Clean Recognizable Visual Features Option
What does this function:
- All fields specified in the ‘anon_tags’ structure are replaced with the ‘anon_value’.
- To remove all private tags a group ‘gggg’ has to be specified in the ‘anon_tags’ structure.
- A log is save with all the anonymization operations.
Parameters: input_dicom: str (mandatory)
a dicom file path to be processed.
outdir: str (mandatory)
the directory where the anonymized DICOM file and a Json file containing a dictionary of the modified tags are generated.
outname: str (optional, default None)
the generated files base names, if None use the ‘input_dicom’ base name.
write_log: bool (optional, default True)
If True write the anonimization log.
Returns: output_dicom: str
the path to the anonimized DICOM file.
output_log: str
If ‘write_log’ is set, the path to the anonimization log.