pydicom / deid

best effort anonymization for medical images using python
https://pydicom.github.io/deid/
MIT License
140 stars 43 forks source link

Error with private tags in %fields sections #147

Closed wetzelj closed 4 years ago

wetzelj commented 4 years ago

Including private tags within fields sections cause all private tags to be acted upon.

Currently, in parser.perform_action, when a fields list is encountered, expand_field_expression is called using the keyword from the contender element. In the case of private tags, the keyword of the element is an empty string. When this empty string is utilized by expand_field_expression to obtain the list of fields, it returns all private tags.

I believe that this can be corrected by passing the stripped_tag into expand_field_expression so that the unique tag number is utilized to identify the tag rather than the tag name - started.

wetzelj commented 4 years ago

@vsoch - I'm about to sign off for the week. Will it be okay if I handle both this and #146 in a single PR next week or would you prefer them split? Have a great weekend!

vsoch commented 4 years ago

Yes definitely okay to combine. Have a good weekend!

vsoch commented 4 years ago

Fixed with #148.