-
Notifications
You must be signed in to change notification settings - Fork 823
fix: handle XA modality multi-frame grayscale dicom redaction #1735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: handle XA modality multi-frame grayscale dicom redaction #1735
Conversation
Hi @omri374 @joelbyler 👋 I’ve submitted a fix for issue #1731 (handling XA modality multi-frame grayscale DICOMs). |
presidio-image-redactor/presidio_image_redactor/dicom_image_redactor_engine.py
Show resolved
Hide resolved
Hi @MRADULTRIPATHI thanks for the PR! Please add unit tests. |
Hi @omri374 Please let me know if you’d like any further changes. |
I'll test this out today, one thing that does come to mind, and its probably outside the scope of this change, but presidio dicom processing should really support multiframe image redaction. Its definately possible that if there is one frame with potential PHI included, there will likely be multiple frames with that same PHI included. perhaps it will always be in the same place in all or most frames, but possibly not. I'm thinking this is a separate issue though. |
Thanks @joelbyler |
I have run my tests locally using some test files and this does resolve the exception that I was seeing, and I can confirm that presidio is stlil not processing multliple frames for redaction, but that's not a regression at this point. I'll log a separate issue to provide image redaction support for multiframe dicom instances. The files I have include synthetic PHI and computer generated pixeldata, glad to share those if its of interest. |
Actually I'll share them here for reference, but also add them to the new issue. |
Hi @joelbyler Thanks a lot for reviewing and confirming that the exception is resolved 🙏 |
I'm not a maintainer on this project but I think these changes work for my use case |
Thanks a lot @joelbyler for confirming that the fix works for your use case 🙏 Hi @omri374 👋 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @omri374 👋 |
@joelbyler can you help me with that?? |
Hi @microsoft/presidio-administrators 👋 This PR fixes the XA modality multi-frame grayscale DICOM redaction issue (#1731). Since this PR now mainly waits for code owner review, could you please take a look and approve when you get a chance? 🙏 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @omri374 👋 |
This PR now has 93 files. It seems to incorporate the anonymizer into the analyzer. Is there a reason for such big PR? |
Hi @MRADULTRIPATHI, are you interesting in continuing to work on this PR? is there anything we can assist with? |
Change Description
Fixed handling of XA modality (X-Ray Angiography) DICOM images that were previously failing with
ValueError: Too many dimensions: 3 > 2
when passed toImage.fromarray
._dicom_np_to_pil
helper to robustly handle conversion of multi-frame grayscale and RGB images._get_most_common_pixel_value
to correctly handle multi-frame grayscale by taking the first frame._set_bbox_color
to use_dicom_np_to_pil
for consistency across grayscale and RGB images.test_dicom_redactor.py
) → all tests passed.Issue reference
Fixes #1731
Checklist