Project

General

Profile

Actions

Feature #1054

open

Add option to dcmdjpeg and dcmdjp2k that disables the automatic adjustment of Bits Stored and High Bit

Added by Marco Eichelberg over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Library and Apps
Target version:
-
Start date:
2022-12-28
Due date:
% Done:

0%

Estimated time:
Module:
dcmjpeg, dcmjp2k
Operating System:
Compiler:

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

case_c_anon.dcm (1.77 MB) case_c_anon.dcm Sample image provided by DCMTK forum user "realvgm" Marco Eichelberg, 2022-12-28 17:46

No data to display

Actions

Also available in: Atom PDF