Problem with anonymization -- tag label mismatch

38 views
Skip to first unread message

jihane hajj

unread,
Apr 30, 2023, 2:25:17 AM4/30/23
to pydicom
Hello, I am trying to anonymize dicom files, and the process fails on 3 tags whose labels don't match exactly what pydicom expects.
Specifically, my dicom file contains the following labels:
PatientTelephoneNumber
PhysicianOfRecord
OperatorName

instead of the expected labels:
PatientTelephoneNumbers
PhysiciansOfRecord
OperatorsName

How could I go around this problem?
Thank you very much for your help,
Jihane

Marcel Daamen

unread,
Apr 30, 2023, 10:07:42 AM4/30/23
to pydicom
Hi Jihane,

instead of addressing the tags via label name, I would simply modify them by their hex value.

Depending on whether you want to delete them, only zero out or replace with a dummy string, this would look like in these examples.

del Image[0x0010, 0x2154]                   # delete tag Patient's Telephone Number
Image[0x0008, 0x1048].value=''"          # zero out Physician of Record
Image[0x0008, 0x1070].value = 'XXXX^XXXX'     # replace Operator's Name with non-zero string

Best wishes,

Marcel

jihane hajj

unread,
Apr 30, 2023, 11:12:35 PM4/30/23
to pyd...@googlegroups.com
Thank you very much, Marcel.
This is very helpful.
Best,
Jihane

--
You received this message because you are subscribed to a topic in the Google Groups "pydicom" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pydicom/YpmCCXRaLIA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pydicom+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pydicom/2bec987d-9037-4d82-bacf-94f94eb49da4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages