UCLH-Foundry / PIXL

PIXL Image eXtraction Laboratory
Apache License 2.0
8 stars 0 forks source link

Ensure studies with nested VR OB data are redacted #415

Open stefpiatek opened 3 weeks ago

stefpiatek commented 3 weeks ago

Definition of Done / Acceptance Criteria

VR OB data types within nested DICOM tags currently cause an exception from our anonymisation library. We want to ensure that if these tags are not in the allowlist, that these are processed (removed) without an exception being thrown (and thus discarding the instance)

Testing

Documentation

No response

Dependencies

No response

Details and Comments

Seen fairly rarely but still exists

pixl_prod-orthanc-anon-1  | E0625 08:49:04.099092          DICOM-3 PluginsManager.cpp:153] Failed to anonymize instance due to
pixl_prod-orthanc-anon-1  | Traceback (most recent call last):
pixl_prod-orthanc-anon-1  |   File "/etc/orthanc/pixl.py", line 229, in ReceivedInstanceCallback
pixl_prod-orthanc-anon-1  |     return _process_dicom_instance(receivedDicom)
pixl_prod-orthanc-anon-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pixl_prod-orthanc-anon-1  |   File "/etc/orthanc/pixl.py", line 247, in _process_dicom_instance
pixl_prod-orthanc-anon-1  |     anonymise_dicom(dataset)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/pixl_dcmd/main.py", line 99, in anonymise_dicom
pixl_prod-orthanc-anon-1  |     _anonymise_dicom_from_scheme(dataset, project_slug, tag_scheme)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/pixl_dcmd/main.py", line 114, in _anonymise_dicom_from_scheme
pixl_prod-orthanc-anon-1  |     _anonymise_recursively(dataset, tag_actions)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/pixl_dcmd/main.py", line 128, in _anonymise_recursively
pixl_prod-orthanc-anon-1  |     anonymize_dataset(dataset, tag_actions, delete_private_tags=False)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/dicomanonymizer/simpledicomanonymizer.py", line 448, in anonymize_dataset
pixl_prod-orthanc-anon-1  |     action(dataset, tag)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/dicomanonymizer/simpledicomanonymizer.py", line 256, in delete_or_empty_or_replace
pixl_prod-orthanc-anon-1  |     replace(dataset, tag)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/dicomanonymizer/simpledicomanonymizer.py", line 142, in replace
pixl_prod-orthanc-anon-1  |     replace_element(element)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/dicomanonymizer/simpledicomanonymizer.py", line 130, in replace_element
pixl_prod-orthanc-anon-1  |     replace_element(sub_element)
pixl_prod-orthanc-anon-1  |   File "/.venv/lib64/python3.11/site-packages/dicomanonymizer/simpledicomanonymizer.py", line 132, in replace_element
pixl_prod-orthanc-anon-1  |     raise NotImplementedError('Not anonymized. VR {} not yet implemented.'.format(element.VR))
pixl_prod-orthanc-anon-1  | NotImplementedError: Not anonymized. VR OB not yet implemented.

The dicom-anonymizer library points to this dicom anonymisation conformance statement which suggests that redacting this tag doesn't have a good value. But in our configuration I don't think we are redacting the nested tag. I'm not sure if we apply the whitelist before anonymisation that would stop this from happening?