Weird JPEG dicoms from ultrasound modalities #517
Replies: 3 comments 1 reply
-
Hopefully this link to share works, onedrive link |
Beta Was this translation helpful? Give feedback.
-
Well, that's a handful! :) I've heard before of scenarios where frame boundaries were within a fragment (despite that not being allowed), but to the point of passing the wrong number of frames, it becomes a more severe case of non-compliance. The current JPEG pixel data decoder is already prepared to read multiple frames, even when there is more than one frame in a fragment, so long as each one doesn't sit in more than one fragment. Even if it were made more robust by handling the presence of unconstrained frame boundaries, then we'd have the case of finding less frames than expected. Maybe there's a case for treating this as a mistake in the attribute rather than a hard error, but this means that we'd need to inspect the pixel data before trusting the Number of Frames attribute, which is often taken in consideration before reading the pixel data. For the time being, you may be better off building a custom tool (via Out of curiosity, the
|
Beta Was this translation helpful? Give feedback.
-
This is probably what I'll end up doing, thanks! Related question, since one of the "frames" in this image is actually just 2 images squished together, I was curious about how consistent the number of fragments per frame needs to be. I can imagine a scenario in a multiframe image where one image is larger than the others after decompression, but is it allowed for that frame to have more fragments than the other frames? A note in part 5 sect 8.2 says
I haven't found it explicitly stated that the number of fragments per frame needs to be the same for all frames but the fact that they say fragmentation can be determined by comparing total fragments to total frames makes me think that is assumed. Do you happen to know if thats stated anywhere that I'm missing, and or have you run into a dicom with that issue? |
Beta Was this translation helpful? Give feedback.
-
I've been working with quite a bit of Ultrasound data, and in that I've been running into dicoms that have very weird JPEG issues. Which seems to break all major dicom implementations that I've tried (dcmtk, gdcm, pydicom, dicom-rs, I didn't try dcm4che bc I don't use java) and I wanted to start a discussion about how to handle these since I find them fairly regularly in the Ultrasound community...
I've recreated a particular dicom that reproduces these issues since the original data had burned in PHI. The dicom has the following:
NumberOfFrames
attribute and the length of the BOT in the pixel data point to there being 4 frames, but there are actually only 3 framesI created this dicom with a pydicom script (attaching jupyter notebook). But this seems to replicate the issues I've been seeing:
dicom-toimage
has these failures when doing each frame➜ ~/Downloads $ dcmdjpeg test.dcm out.dcm F: Not a JPEG file: starts with 0xa2 0x8a: decompressing file: test.dcm
So my question is what to do about these files? Is there any interest in trying to support them/fix them?
Beta Was this translation helpful? Give feedback.
All reactions