dicom-rs icon indicating copy to clipboard operation
dicom-rs copied to clipboard

Issue when trying to open a DICOM file.

Open NickyAlan opened this issue 1 year ago • 1 comments

I am facing an issue when trying to open a DICOM file. Interestingly, the code works for all DICOM files except one. I suspect there might be a problem when attempting to load pixel data, as using .read_until(tags::PIXEL_DATA) seems to work fine.

Err: ReadToken { source: ReadValue { len: 268374015, tag: Tag(0x0FFF, 0x0FFF), source: ReadValueData { position: 4033230, source: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }, backtrace: Backtrace(()) } } }

NickyAlan avatar Jan 02 '24 20:01 NickyAlan

It appears that the Pixel Data element length (4030980 bytes) does not align with the real size of the pixel data encoded in the file (4031972 bytes). There are more pixel data values than the ones expected by its length, making the file non-compliant. The resulting errors are merely the consequence of the parser trying to read these trailing pixel data values as more data elements.

Could you look into whichever device or software that produced that file? It clearly did not encode the data element correctly.

Enet4 avatar Jan 03 '24 10:01 Enet4

Closing as an isolated incident from external devices for which the project should not adapt to for now. If the problem can be more substantiated in the future, please file a new issue.

Enet4 avatar Jul 21 '24 11:07 Enet4