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 trying to read a DICOM file from a byte stream (context: I'm downloading just enough data from large remote DICOM files of several gigabytes to read metadata only), something like:
but faced a few errors. As it's not a common use case, it could be that some code paths are not fully up-to-date.
I've done some investigations and found at least two issues in the ImageFileReader class (io.py). I'm just using highdicom to read metadata, so I can't speak for the whole library, there might be more issues lurking elsewehere:
On line 69, tag = TupleTag(fp.read_tag()), the read_tag function does not exist in released pydicom versions (2.4 at the time of this writing) but appears in 3.0.0.dev0. Replacing it with the equivalent function read_be_tag from pydicom 2.4 seems to work.
After reading the metadata with pydicom in _read_metadata(), the code checks whether the next tag is a well-known Pixel Data tag by comparing it to hard-coded values (link)
In my case, the Pixel Data tag is (0xE07F, 0x1000), an endianness away from the hard-coded value. Manually adding 0xE07F1000 as a candidate in _UINT_PIXEL_DATA_TAGS solves the issue.
I don't know how much effort is required, but it would be great to improve the support of DicomFileLike objects!
PS: thanks for the amazing library btw :)
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue. I may be wrong here, but I think the issue here is not so much the support for DicomFileLike as the support from reading Big Endian transfer syntaxes in general. Since Big Endian transfer syntaxes have been retired from the standard for a while, and working with them is in general really a pain, we took the decision a while ago not to put the effort into support them. See this comment in the release notes.
Could you please confirm what the transfer syntax of your file is? And also whether the issue is resolved by converting it to a little endian transfer syntax (e.g. like this post).
I'm not totally opposed to small changes that would allow things to work with big endian files, but trying to understand the scope of the problem first. Thanks
Hey there,
I'm trying to read a DICOM file from a byte stream (context: I'm downloading just enough data from large remote DICOM files of several gigabytes to read metadata only), something like:
but faced a few errors. As it's not a common use case, it could be that some code paths are not fully up-to-date.
I've done some investigations and found at least two issues in the
ImageFileReader
class (io.py). I'm just using highdicom to read metadata, so I can't speak for the whole library, there might be more issues lurking elsewehere:On line 69,
tag = TupleTag(fp.read_tag())
, theread_tag
function does not exist in released pydicom versions (2.4 at the time of this writing) but appears in 3.0.0.dev0. Replacing it with the equivalent functionread_be_tag
from pydicom 2.4 seems to work.After reading the metadata with pydicom in
_read_metadata()
, the code checks whether the next tag is a well-known Pixel Data tag by comparing it to hard-coded values (link)In my case, the Pixel Data tag is
(0xE07F, 0x1000)
, an endianness away from the hard-coded value. Manually adding0xE07F1000
as a candidate in_UINT_PIXEL_DATA_TAGS
solves the issue.I don't know how much effort is required, but it would be great to improve the support of DicomFileLike objects!
PS: thanks for the amazing library btw :)
The text was updated successfully, but these errors were encountered: