Module that provides tools to anonymize DICOM files.
-
pydcmio.dcmanonymizer.utils.
add_dataelement
(dataset, tag, value, VR=None)[source]¶ Update or add a new tag.
Parameters: dataset: Dataset (mandatory)
a pydicom DICOM dataset.
tag: 2-uplet (mandatory)
a DICOM tag.
value: str or number (mandatory)
the actual value.
VR: str (optional, default None)
the DICOM value representation: expected if the tag does not exist in the current dataset.
-
pydcmio.dcmanonymizer.utils.
replace_by
(value, VR, action, default_name='John Doe', default_date='18000101', default_datetime='180001010000.000000', default_time='0000.000000', default_text='anon', default_code='ANON', default_age='000M', default_decimal='0.0', default_integer='0', default_uid='000.000.0')[source]¶ Replace a ‘value’ depending of the input ‘action’ and the value representation ‘VR’.
The following action codes are:
- D - replace with a non zero length value that may be a dummy value and consistent with the VR
- Z - replace with a zero length value, or a non-zero length value that may be a dummy value and consistent with the VR
- X - remove
- K - keep (unchanged for non-sequence attributes, cleaned for sequences)
- C - clean, that is replace with values of similar meaning known not to contain identifying information and consistent with the VR
- U - replace with a non-zero length UID that is internally consistent within a set of Instances
- Z/D - Z unless D is required to maintain IOD conformance (Type 2 versus Type 1)
- X/Z - X unless Z is required to maintain IOD conformance (Type 3 versus Type 2)
- X/D - X unless D is required to maintain IOD conformance (Type 3 versus Type 1)
- X/Z/D - X unless Z or D is required to maintain IOD conformance (Type 3 versus Type 2 versus Type 1)
- 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)
We use here the PS 3.6 convention.