You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m encountering an issue when using the DICOM Image Redactor with multi-frame DICOM images (where the value in DICOM tag [0x0028, 0x0008] is more than one). The de-identification process works fine for DICOMs with a single frame (pixel_array.shape ≤ 3), but for multi-frame images (where pixel_array.shape > 3), the redaction seems to fail or not function as expected.
Specifically, the issue occurs in the _save_pixel_array_as_png() method of DicomImageRedactorEngine. The code attempts to flatten the pixel array for multi-frame images and save them as PNG files, leading to errors:
ifis_greyscale:
withopen(f"{output_dir}/{output_file_name}.png", "wb") aspng_file:
w=png.Writer(shape[1], shape[0], greyscale=True)
w.write(png_file, pixel_arrayelse:
withopen(f"{output_dir}/{output_file_name}.png", "wb") aspng_file:
w=png.Writer(shape[1], shape[0], greyscale=False)
# Semi-flatten the pixel array to RGB representation in 2Dpixel_array=np.reshape(pixel_array, (shape[0], shape[1] *3))
w.write(png_file, pixel_array)
For multi-frame images, such as with a pixel array shape of (135, 600, 800, 3), the code throws the following error: ValueError: cannot reshape array of size 194400000 into shape (135,1800)
The root cause seems to be the redact_and_return_bbox() method not handling multi-frame DICOMs correctly, especially when working with pixel arrays that contain more than one frame.
To Reproduce
To reproduce the issue, simply use DicomImageRedactorEngine with a multi-frame DICOM image. The de-identification process fails for images with pixel arrays of shape (N, M, P, Q) where N > 1.
Expected Behavior
The DicomImageRedactorEngine should handle multi-frame DICOM images by processing each frame independently or appropriately handling the reshaping of the pixel array.
Question
Is there a solution to handle multi-frame DICOMs in the current implementation? Alternatively, I would be happy to contribute to resolving this issue.
Thank you!
The text was updated successfully, but these errors were encountered:
Hello,
I’m encountering an issue when using the DICOM Image Redactor with multi-frame DICOM images (where the value in DICOM tag
[0x0028, 0x0008]
is more than one). The de-identification process works fine for DICOMs with a single frame (pixel_array.shape ≤ 3
), but for multi-frame images (wherepixel_array.shape > 3
), the redaction seems to fail or not function as expected.Specifically, the issue occurs in the
_save_pixel_array_as_png()
method ofDicomImageRedactorEngine
. The code attempts to flatten the pixel array for multi-frame images and save them as PNG files, leading to errors:For multi-frame images, such as with a pixel array shape of (135, 600, 800, 3), the code throws the following error:
ValueError: cannot reshape array of size 194400000 into shape (135,1800)
The root cause seems to be the
redact_and_return_bbox()
method not handling multi-frame DICOMs correctly, especially when working with pixel arrays that contain more than one frame.To Reproduce
To reproduce the issue, simply use DicomImageRedactorEngine with a multi-frame DICOM image. The de-identification process fails for images with pixel arrays of shape (N, M, P, Q) where N > 1.
Expected Behavior
The DicomImageRedactorEngine should handle multi-frame DICOM images by processing each frame independently or appropriately handling the reshaping of the pixel array.
Question
Is there a solution to handle multi-frame DICOMs in the current implementation? Alternatively, I would be happy to contribute to resolving this issue.
Thank you!
The text was updated successfully, but these errors were encountered: