dicom_pseudonymizer.utils.simple_dicomanonymizer

Functions

anonymize_dataset(dataset[, …])

Anonymize a pydicom Dataset by using anonymization rules which links an action to a tag

anonymize_dicom_file(in_file, out_file[, …])

Anonymize a DICOM file by modifying personal tags

clean(dataset, tag)

C - clean, that is replace with values of similar meaning known not to contain identifying information and consistent with the VR

delete(dataset, tag)

X - remove

delete_element(dataset, element)

Delete the element from the dataset.

delete_or_empty(dataset, tag)

X/Z - X unless Z is required to maintain IOD conformance (Type 3 versus Type 2)

delete_or_empty_or_replace(dataset, tag)

X/Z/D - X unless Z or D is required to maintain IOD conformance (Type 3 versus Type 2 versus Type 1)

delete_or_empty_or_replace_UID(dataset, tag)

X/Z/U* - X unless Z or replacement of contained instance UIDs (U) is required to maintain IOD conformance (Type 3 versus Type 2 versus Type 1 sequences containing UID references)

delete_or_replace(dataset, tag)

X/D - X unless D is required to maintain IOD conformance (Type 3 versus Type 1)

empty(dataset, tag)

Z - replace with a zero length value, or a non-zero length value that may be a dummy value and consistent with the VR

empty_element(element)

Clean element according to the element’s VR: - SH, PN, UI, LO, CS: value will be set to ‘’ - DA: value will be replaced by ‘00010101’ - TM: value will be replaced by ‘000000.00’ - UL: value will be replaced by 0 - SQ: all subelement will be called with “empty_element”

empty_or_replace(dataset, tag)

Z/D - Z unless D is required to maintain IOD conformance (Type 2 versus Type 1)

generate_actions(tag_list, action[, options])

Generate a dictionary using list values as tag and assign the same value to all

get_private_tag(dataset, tag)

Get the creator and element from tag

get_private_tags(anonymization_actions, dataset)

Extract private tag as a list of object with creator and element

initialize_actions()

Initialize anonymization actions with DICOM standard values

keep(dataset, tag)

K - keep (unchanged for non-sequence attributes, cleaned for sequences)

regexp(options)

Apply a regexp method to the dataset

replace(dataset, tag)

D - replace with a non-zero length value that may be a dummy value and consistent with the VR

replace_UID(dataset, tag)

U - replace with a non-zero length UID that is internally consistent within a set of Instances Lazy solution : Replace with empty string

replace_and_keep_correspondence(dataset, tag)

P - addition to pseudonimize the code and keep a lookup table.

replace_element(element)

Replace element’s value according to it’s VR: - DA: cf replace_element_date - TM: replace with ‘000000.00’ - LO, SH, PN, CS: replace with ‘Anonymized’ - UI: cf replace_element_UID - IS: replace with ‘0’ - FD, FL, SS, US: replace with 0 - ST: replace with ‘’ - SQ: call replace_element for all sub elements - DT: cf replace_element_date_time

replace_element_UID(element)

Keep char value but replace char number with random number The replaced value is kept in a dictionary link to the initial element.value in order to automatically apply the same replaced value if we have an other UID with the same value

replace_element_date(element)

Replace date element’s value with ‘00010101’

replace_element_date_time(element)

Replace date time element’s value with ‘00010101010101.000000+0000’