sjoerdk / idiscore

Deidentification of DICOM images using Attribute Confidentiality Profiles
GNU General Public License v3.0
11 stars 2 forks source link

Missing tags for Basic Application Level Confidentiality Profile #135

Closed sls19050 closed 4 hours ago

sls19050 commented 2 days ago

Description

What I Did

import pydicom

from idiscore.core import Core, Profile
from idiscore.defaults import get_dicom_rule_sets

sets = get_dicom_rule_sets()

profile = Profile(
    rule_sets=[sets.basic_profile]
)
core = Core(profile)

ds = pydicom.Dataset()
ds.AcquisitionDate = "20200101"
ds.AcquisitionTime = "123456"
ds.InstanceCreationDate = "19000101"
ds.InstanceCreationTime = "123456"

print("before")
print(ds)

deidentified_dataset = core.deidentify(ds)

print("after")
print(deidentified_dataset)

output:

before
(0008, 0012) Instance Creation Date              DA: '19000101'
(0008, 0013) Instance Creation Time              TM: '123456'
(0008, 0022) Acquisition Date                    DA: '20200101'
(0008, 0032) Acquisition Time                    TM: '123456'
after
(0008, 0012) Instance Creation Date              DA: '19000101'
(0008, 0013) Instance Creation Time              TM: '123456'
sjoerdk commented 23 hours ago

Thank you for the clear and concise bug report. This seems to be an actual bug. I will investigate

sjoerdk commented 21 hours ago

The code in _public_dicom.py is generated based on webscraping of http://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_E.html

I assumed table E.1-1 on this webpage was static but this assumption seems to be false. But I have noticed before that it is actually updated from time to time and you have found another update.

I need to update the scraping tool and re-generate _public_dicom.py This will probably be early next week

sls19050 commented 21 hours ago

Thank you so much! Really appreciate your quick response! :-D

sjoerdk commented 4 hours ago

Fixed now for idiscore 1.2.0. All tags in your example are now removed. pip install idiscore==1.2.0 should fix the issue for you.

The underlying problem was that idiscore was out of date with dicom.nema.org table E.1-1. This is being picked up in #138 Hope this helps!