-
Notifications
You must be signed in to change notification settings - Fork 824
Description
Describe the bug
A clear and concise description of what the bug is.
Attempting to run image redaction on an XA modality image (X Ray Angiography) appears to be misinterpreting XA modality images as grayscale in some cases.
To Reproduce
Steps to reproduce the behavior:
You can obtain a test dicom file from [Aliza DICOM Conformance Tests] if you scroll down to "Enhanced XA Image Storage" and download the Siemens, non-uniform, rotation sample file.
When attempting to redact_and_return_bbox
as described the presdio getting started guide using that file.
When attempting the above with the test file (and others that we've encountered in production) you will see an error similar to the following.
File ".../.venv/lib/python3.13/site-packages/presidio_image_redactor/dicom_image_redactor_engine.py", line 74, in redact_and_return_bbox
image_pil = Image.fromarray(image_np, mode="L")
File ".../.venv/lib/python3.13/site-packages/PIL/Image.py", line 3324, in fromarray
raise ValueError(msg)
ValueError: Too many dimensions: 3 > 2.
Expected behavior
A clear and concise description of what you expected to happen.
Image redaction should work as expected and described in the guide
Screenshots
If applicable, add screenshots to help explain your problem.
See above error example
Additional context
Add any other context about the problem here.
Glad to offer more examples or more detail as needed.