KitwareMedical / dicom-anonymizer

Tool to anonymize DICOM files according to the DICOM standard
BSD 3-Clause "New" or "Revised" License
104 stars 47 forks source link

Extra rules to support private tags by range. #82

Closed smasuda closed 6 months ago

smasuda commented 6 months ago

The first two digits of the element number of a private tag indicates an offset by "Private Creator". Thus if you want to handle certain private tags, you need to specify it with masks as done in the safe private attributes in the dicom specification.

The current implementation doesn't support masks for private tags, and this PR enable it, with a test to illustrate the behavior.

At the same time, try-catch usage to get an element here seems overkill, since the element could well be removed as a normal course of action. I'd rather use if statement to check the existance of the element as done in the PR.

smasuda commented 6 months ago

had a second thought - to handle safe private tags, maybe it's better to check Private Creator text as well.