Feature #1054
openAdd option to dcmdjpeg and dcmdjp2k that disables the automatic adjustment of Bits Stored and High Bit
0%
Description
The JPEG decoder in DCMTK automatically adjusts the values of BitsStored and HighBit when it notices an inconsistency between the number of bits per sample indicated in the DICOM header and the number of bits per sample indicated in the JPEG bitstream. This follows DICOM Part 5, section 8.2.1, which states that "When decompressing, should the characteristics explicitly specified in the compressed data stream (e.g., spatial subsampling or number of components or planar configuration) be inconsistent with those specified in the DICOM Data Elements, those explicitly specified in the compressed data stream should be used to control the decompression."
In the forum posting https://forum.dcmtk.org/viewtopic.php?f=1&t=5226, a sample image was provided where this happens, as BitsStored is indicated as 16 in the DICOM header and as 12 in the JPEG bitstream. However, decoding the JPEG bitstream produces 16-bit values and the adjustment of the DICOM header leads to an undisplayable image. Resetting the values of BitsStored and HighBit fix the image. This is possibly caused by an incorrect JPEG Start of Frame (SOF) marker.
A command line option should be added to dcmjpeg and dcmjp2k that disables the automatic adjustment of Bits Stored and High Bit for special cases like this one.
Files
No data to display