pydicom / deid

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

Tags within sequences (nested fields) are not affected by header actions #243

Closed wetzelj closed 1 year ago

wetzelj commented 1 year ago

While working on pull request #242 it was uncovered that when the BLANK operation was being used to act on a field nested within a sequence (example: Action: BLANK 00080050 Nested Tag: (0040, 0275)__0__(0008, 0050)), the index between the parent and child tag causes the get_nested_field function to return the tag incorrectly and therefore the tag within the sequence is not blanked. This error is also currently impacting the REMOVE action.

The get_nested_field function is only utilized in the BLANK and REMOVE actions, but I suspect that there are also issues with the other alter-type actions (JITTER and REPLACE) when acting on nested fields. When working this issue, the full functionality of header actions on nested fields should be reviewed and additional test cases written to validate that actions on nested fields have the intended effect.

The initial discussion where this came up can be seen in this comment of #242.

vsoch commented 1 year ago

I thought this might be related to what we were returning (e.g., parent vs the value indexed).

vsoch commented 1 year ago

Closed with https://github.com/pydicom/deid/pull/242