Hello,
I am trying to resolve the error I am getting when loading a 12-bit DICOM image using the function “getUncompressedFrame().” Specifically, when "findAndGetUint16(DCM_BitsAllocated, DcmktBits)" returns 12 in DcmktBits (as opposed to 16). I have no problem loading 8- and 16-bit DICOM images.
I have problems with all my 12-bit-image DICOM files but they can viewed in DICOM viewers just fine (such as RadiAnt). Two such DICOM files can be found at:
https://drive.google.com/file/d/1WqeM_G ... sp=sharing
Thanks,
-Sean
Unable to load 12-bit image from DICOM files
Moderator: Moderator Team
-
- Posts: 4
- Joined: Mon, 2024-10-14, 09:06
-
- Posts: 4
- Joined: Mon, 2024-10-14, 09:06
Re: Unable to load 12-bit image from DICOM files
I just did more analysis, and the "getUncompressedFrameSize()" returns the frame's size in terms of x_dim*y_dim*1.5 (i.e., 12-bit, or 1.5 bytes) instead of x_dim*y_dim*2. Could it be that DCMTK does not support pixel data saved in this compacted format? Or perhaps I need to use another function to load such a format? Again, they can viewed in DICOM viewers just fine (such as RadiAnt).
Thanks.
Thanks.
-
- OFFIS DICOM Team
- Posts: 1512
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Unable to load 12-bit image from DICOM files
There are several problems here:
That said, getUncompressedFrameSize() should not return an incorrect value even in this case. I need to think about how to handle this properly in DCMTK.
- The JPEG decoder will decode a 12-bit JPEG bitstream into an image with BitsAllocated=16. However, the getUncompressedFrameSize() method does not know this and returns a calculation based on BitsAllocated=12.
- BitsAllocated=12 is not permitted in DICOM. This value must be either 1 or a multiple of 8.
- The sample images use JPEGBaseline transfer syntax, but contain a 12-bit JPEG bitstream, which is not allowed in JPEG Baseline
That said, getUncompressedFrameSize() should not return an incorrect value even in this case. I need to think about how to handle this properly in DCMTK.
-
- OFFIS DICOM Team
- Posts: 1512
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Unable to load 12-bit image from DICOM files
For your information, I have created an issue in our issue tracker: https://support.dcmtk.org/redmine/issues/1140
-
- Posts: 4
- Joined: Mon, 2024-10-14, 09:06
Re: Unable to load 12-bit image from DICOM files
Hello Dr. Eichelberg.
Thanks for the speedy reply. Our customers do give us DICOM images with explicit setting of 12-bit (in the last 20 years or so), but it is good to know this is not valid per DICOM Standard. Nonetheless, we mainly use LeadTools utility and have no problem reading them and have no problem viewing them either using RadiAnt viewer. However, we are now trying to switch to using DCMTK 100%.
Thanks for opening Bug #1140. Nonetheless, getUncompressedFrame() returns error regardless of how big the buffer I give it.
Thanks for the speedy reply. Our customers do give us DICOM images with explicit setting of 12-bit (in the last 20 years or so), but it is good to know this is not valid per DICOM Standard. Nonetheless, we mainly use LeadTools utility and have no problem reading them and have no problem viewing them either using RadiAnt viewer. However, we are now trying to switch to using DCMTK 100%.
Thanks for opening Bug #1140. Nonetheless, getUncompressedFrame() returns error regardless of how big the buffer I give it.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest