Project

General

Profile

Actions

Feature #690

open

DCMJPEG and DCMJP2K should validate image dimensions and samples per pixel

Added by Marco Eichelberg about 9 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Library and Apps
Target version:
-
Start date:
2016-08-17
Due date:
% Done:

0%

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

Description

Currently the JPEG and JPEG 2000 decoders "blindly" believe that the values for Rows, Columns, and SamplesPerPixel in the DICOM header are correct.
However, the DICOM standard states that in the case of inconsistencies the value encoded in the compressed bitstream should take preference.
Both decoders should be modified to check the consistency of Rows, Columns and SamplesPerPixel against the JPEG header, and in case of an inconsistency be configurable to
  • reject decompression with an error message (default)
  • adjust the DICOM header to be consistent with the compressed bitstream
  • keep the DICOM header unmodified (current behaviour)

Reported / suggested by Mathieu Malaterre.


Files

JPEGNote_bogus.dcm (44.9 KB) JPEGNote_bogus.dcm JPEG-compressed DICOM image where DICOM and JPEG values for Rows, Columns, SamplesPerPixel and PhotometricInterpretation are inconsistent Marco Eichelberg, 2016-08-17 09:45
Actions #1

Updated by Marco Eichelberg over 8 years ago

  • Target version changed from 3.6.2 to 3.6.3
Actions #2

Updated by Jörg Riesmeier over 8 years ago

I just received another bogus JPEG Baseline-compression DICOM image where the Photometric Interopretation says "MONOCHROME2" and Samples Per Pixel is "1" but the compressed JPEG stream contains 3 components. The result is an error:

D: Start Of Frame 0xc0: width=200, height=200, components=3
D:     Component 1: 2hx2v q=0
D:     Component 2: 1hx1v q=1
D:     Component 3: 1hx1v q=1
D: Define Huffman Table 0x00
D: Define Huffman Table 0x10
D: Define Huffman Table 0x01
D: Define Huffman Table 0x11
D: Start Of Scan: 3 components
D:     Component 1: dc=0 ac=0
D:     Component 2: dc=1 ac=1
D:     Component 3: dc=1 ac=1
D:   Ss=0, Se=63, Ah=0, Al=0
F: Buffer for decompressed image (8 bits/sample) too small: decompressing file: test.dcm

After calling ''dcmodify -m PhotometricInterpretation=YBR_FULL_422 -m SamplesPerPixel=3 test.dcm'', the image can be processed (and the rendering performed by dcmj2pnm is correct).

Actions #3

Updated by Jan Schlamelcher over 7 years ago

  • Target version changed from 3.6.3 to 3.6.6
Actions #4

Updated by Michael Onken over 5 years ago

  • Target version deleted (3.6.6)
Actions

Also available in: Atom PDF