Issue related to FAQ: cannot change to unencapsulated repres

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Issue related to FAQ: cannot change to unencapsulated repres

#1 Post by evanyftsai »

Hi,

I ran into a specific DICOM data which gives me this error: cannot change to unencapsulated representation for pixel data

I have implemented the following according to the FAQ, and it has been working fine for many other DICOM data:
- add '#include "djdecode.h"' to your source file
- call 'DJDecoderRegistration::registerCodecs();' at program init
- call 'DJDecoderRegistration::cleanup();' before program exit

Just to compare - I found another DICOM data of the same SOP Class UID and Transfer Syntax. This one works fine.

I am attaching the headers of these two DICOM below. Can you give me any recommendation on how to make the failure case work?

Many thanks!
Evan


------------------------------ SUCCESS DICOM HEADER ---------------------------------------------------

(0002,0000) Group Length VR: UL Length: 4 Value: 182
(0002,0001) File Meta Information Version VR: OB Length: 2 Value: 0
(0002,0002) Media Storage SOP Class UID VR: UI Length: 26 Value: 1.2.840.10008.5.1.4.1.1.2
(0002,0003) Media Storage SOP Instance UID VR: UI Length: 50 Value: 1.2.250.1.90.2.851457473.20171006092750.7736.34.1
(0002,0010) Transfer Syntax UID VR: UI Length: 22 Value: 1.2.840.10008.1.2.4.70
(0002,0012) Implementation Class UID VR: UI Length: 24 Value: 1.2.250.1.90.50.7.0.0.0
(0002,0013) Implementation Version Name VR: SH Length: 6 Value: KDDIS
(0008,0005) Specific Character Set VR: CS Length: 10 Value: ISO_IR 192
(0008,0008) Image Type VR: CS Length: 22 Value: ORIGINAL\PRIMARY\AXIAL
(0008,0012) Instance Creation Date VR: DA Length: 8 Value: 20171006
(0008,0013) Instance Creation Time VR: TM Length: 6 Value: 092750
(0008,0016) SOP Class UID VR: UI Length: 26 Value: 1.2.840.10008.5.1.4.1.1.2
(0008,0018) SOP Instance UID VR: UI Length: 50 Value: 1.2.250.1.90.2.851457473.20171006092750.7736.34.1
(0008,0020) Study Date VR: DA Length: 8 Value: 20171006
(0008,0021) Series Date VR: DA Length: 8 Value: 20171006
(0008,0022) Acquisition Date VR: DA Length: 8 Value: 20171006
(0008,0023) Image Date VR: DA Length: 8 Value: 20171006
(0008,0030) Study Time VR: TM Length: 6 Value: 092339
(0008,0031) Series Time VR: TM Length: 6 Value: 092750
(0008,0032) Acquisition Time VR: TM Length: 6 Value: 092720
(0008,0033) Image Time VR: TM Length: 6 Value: 092750
(0008,0050) Accession Number VR: SH Length: 0
(0008,0060) Modality VR: CS Length: 2 Value: CT
(0008,0070) Manufacturer VR: LO Length: 18 Value: Carestream Health
(0008,0080) Institution Name VR: LO Length: 0
(0008,0090) Referring Physician's Name VR: PN Length: 22 Value: Le Carboulec^Yann^^Dr
(0008,1030) Study Description VR: LO Length: 0
(0008,103E) Series Description VR: LO Length: 18 Value: 3D CBCT Image Set
(0008,1090) Manufacturer's Model Name VR: LO Length: 8 Value: CS 9300
(0008,2218) Anatomic Region Sequence VR: SQ Length: 54
(FFFE,E000)
(0008,0100) Code Value VR: SH Length: 8 Value: T-D1213
(0008,0102) Coding Scheme Designator VR: SH Length: 4 Value: SRT
(0008,0104) Code Meaning VR: LO Length: 10 Value: Jaw region
(0009,0011) VR: LO Length: 6 Value: TROPHY
(0009,11A0) VR: SQ Length: 326
(FFFE,E000)
(0009,0011) VR: LO Length: 6 Value: TROPHY
(0009,11A1) VR: LO Length: 20 Value: 3DACQ_FUNCTION_MODE
(0009,11A2) VR: UL Length: 4 Value: 6
(0009,11A3) VR: UN Length: 6 Value: Normal
(FFFE,E000)
(0009,0011) VR: LO Length: 6 Value: TROPHY
(0009,11A1) VR: LO Length: 16 Value: 3DACQ_SCAN_MODE
(0009,11A2) VR: UL Length: 4 Value: 9
(0009,11A3) VR: UN Length: 10 Value: ShortScan
(FFFE,E000)
(0009,0011) VR: LO Length: 6 Value: TROPHY
(0009,11A1) VR: LO Length: 18 Value: 3DACQ_SCAN_OBJECT
(0009,11A2) VR: UL Length: 4 Value: 7
(0009,11A3) VR: UN Length: 8 Value: Patient
(FFFE,E000)
(0009,0011) VR: LO Length: 6 Value: TROPHY
(0009,11A1) VR: LO Length: 18 Value: 3DACQ_SCAN_QUALITY
(0009,11A2) VR: UL Length: 4 Value: 14
(0009,11A3) VR: UN Length: 14 Value: HighResolution
(0010,0010) Patient's Name VR: PN Length: 14 Value: MARTINIER^Anne
(0010,0020) Patient ID VR: LO Length: 6 Value: 22406
(0010,0030) Patient's Birth Date VR: DA Length: 8 Value: 20030919
(0010,0040) Patient's Sex VR: CS Length: 2 Value: O
(0018,0015) Body Part Examined VR: CS Length: 4 Value: JAW
(0018,0050) Slice Thickness VR: DS Length: 4 Value: 0.18
(0018,0060) KVP VR: DS Length: 2 Value: 90
(0018,1000) Device Serial Number VR: LO Length: 10 Value: Undefined
(0018,1020) Software Version(s) VR: LO Length: 274 Value: (Long Size Data)
(0018,1150) Exposure Time VR: IS Length: 4 Value: 8006
(0018,1151) X-Ray Tube Current VR: IS Length: 2 Value: 4
(0018,115E) Image Area Dose Product VR: DS Length: 10 Value: 6.8431414
(0018,7004) Detector Type VR: CS Length: 12 Value: SCINTILLATOR
(0018,700A) Detector ID VR: SH Length: 12 Value: 510S04-1504
(0018,702A) VR: LO Length: 8 Value: Trophy_1
(0018,702B) VR: LO Length: 10 Value: 3D_2520-D
(0018,8151) X-Ray Tube Current in ï¾µA VR: DS Length: 4 Value: 4000
(0020,000D) Study Instance UID VR: UI Length: 40 Value: 1.2.250.1.90.1.851457473.1507274618.446
(0020,000E) Series Instance UID VR: UI Length: 48 Value: 1.2.250.1.90.3.851457473.20171006092750.7736.32
(0020,0010) Study ID VR: SH Length: 0
(0020,0011) Series Number VR: IS Length: 2 Value: 1
(0020,0012) Acquisition Number VR: IS Length: 2 Value: 1
(0020,0013) Image Number VR: IS Length: 2 Value: 1
(0020,0020) Patient Orientation VR: CS Length: 4 Value: L\P
(0020,0032) Image Position (Patient) VR: DS Length: 50 Value: -4.95000000E+001\-4.95000000E+001\-4.86000000E+001
(0020,0037) Image Orientation (Patient) VR: DS Length: 96 Value: 1.00000000E+000\0.00000000E+000\0.00000000E+000\0.00000000E+000\1.00000000E+000\0.00000000E+000
(0020,0052) Frame of Reference UID VR: UI Length: 48 Value: 1.2.250.1.90.5.851457473.20171006092750.7736.33
(0020,0060) Laterality VR: CS Length: 2 Value: U
(0020,1040) Position Reference Indicator VR: LO Length: 0
(0020,4000) Image Comments VR: LT Length: 32 Value: Acquisition Mode used: Jaw_10x10
(0028,0002) Samples per Pixel VR: US Length: 2 Value: 1
(0028,0004) Photometric Interpretation VR: CS Length: 12 Value: MONOCHROME2
(0028,0010) Rows VR: US Length: 2 Value: 551
(0028,0011) Columns VR: US Length: 2 Value: 551
(0028,0030) Pixel Spacing VR: DS Length: 32 Value: 1.80000000E-001\1.80000000E-001
(0028,0100) Bits Allocated VR: US Length: 2 Value: 16
(0028,0101) Bits Stored VR: US Length: 2 Value: 16
(0028,0102) High Bit VR: US Length: 2 Value: 15
(0028,0103) Pixel Representation VR: US Length: 2 Value: 0
(0028,1050) Window Center VR: DS Length: 16 Value: 1.04800000E+003
(0028,1051) Window Width VR: DS Length: 16 Value: 4.09600000E+003
(0028,1052) Rescale Intercept VR: DS Length: 6 Value: -1000
(0028,1053) Rescale Slope VR: DS Length: 2 Value: 1
(0028,1054) Rescale Type VR: LO Length: 2 Value: HU
(0028,9520) VR: DS Length: 256 Value: (Long Size Data)
(7FE0,0010) Frame Data VR: OB Length: FFFFFFFF
(FFFE,E000)
(FFFE,E000)


------------------------------ END OF SUCCESS DICOM HEADER ---------------------------------------------------



------------------------------ FAILURE DICOM HEADER ---------------------------------------------------

(0002,0000) Group Length VR: UL Length: 4 Value: 84
(0002,0001) File Meta Information Version VR: OB Length: 2 Value: 0
(0002,0002) Media Storage SOP Class UID VR: UI Length: 0
(0002,0003) Media Storage SOP Instance UID VR: UI Length: 0
(0002,0010) Transfer Syntax UID VR: UI Length: 22 Value: 1.2.840.10008.1.2.4.70
(0002,0012) Implementation Class UID VR: UI Length: 0
(0002,0013) Implementation Version Name VR: SH Length: 0
(0002,0016) Source Application Entity Title VR: AE Length: 0
(0008,0000) Group Length VR: UL Length: 4 Value: 354
(0008,0008) Image Type VR: CS Length: 22 Value: ORIGINAL\PRIMARY\AXIAL
(0008,0012) Instance Creation Date VR: DA Length: 8 Value: 20171205
(0008,0013) Instance Creation Time VR: TM Length: 6 Value: 105954
(0008,0014) Instance Creator UID VR: UI Length: 44 Value: 1.2.392.200036.9141.274.14801.20021001090000
(0008,0016) SOP Class UID VR: UI Length: 26 Value: 1.2.840.10008.5.1.4.1.1.2
(0008,0018) SOP Instance UID VR: UI Length: 62 Value: 1.2.392.200036.9141.274.14801.20021001090000.20171205105954001
(0008,0020) Study Date VR: DA Length: 8 Value: 20171205
(0008,0030) Study Time VR: TM Length: 6 Value: 105954
(0008,0050) Accession Number VR: SH Length: 0
(0008,0060) Modality VR: CS Length: 2 Value: CT
(0008,0070) Manufacturer VR: LO Length: 30 Value: Asahi Roentgen Ind. Co., Ltd.
(0008,0080) Institution Name VR: LO Length: 24 Value: MORI ORTHODONTIC CLINIC
(0008,0090) Referring Physician's Name VR: PN Length: 0
(0008,1090) Manufacturer's Model Name VR: LO Length: 4 Value: AUGE
(0010,0000) Group Length VR: UL Length: 4 Value: 62
(0010,0010) Patient's Name VR: PN Length: 14 Value: Hamada Kyouka
(0010,0020) Patient ID VR: LO Length: 6 Value: 17078
(0010,0030) Patient's Birth Date VR: DA Length: 8 Value: 19960225
(0010,0040) Patient's Sex VR: CS Length: 2 Value: F
(0018,0000) Group Length VR: UL Length: 4 Value: 144
(0018,0010) Contrast/Bolus Agent VR: LO Length: 4 Value: NONE
(0018,0050) Slice Thickness VR: DS Length: 8 Value: 0.20299
(0018,0060) KVP VR: DS Length: 2 Value: 85
(0018,1000) Device Serial Number VR: LO Length: 0
(0018,1030) Protocol Name VR: LO Length: 0
(0018,1100) Reconstruction Diameter VR: DS Length: 4 Value: 208
(0018,1120) Gantry/Detector Tilt VR: DS Length: 0
(0018,1130) Table Height VR: DS Length: 0
(0018,1140) Rotation Direction VR: CS Length: 2 Value: CC
(0018,1150) Exposure Time VR: IS Length: 6 Value: 17000
(0018,1151) X-Ray Tube Current VR: IS Length: 2 Value: 6
(0018,1152) Exposure VR: IS Length: 4 Value: 102
(0018,1210) Convolution Kernel VR: SH Length: 0
(0018,5100) Patient Position VR: SH Length: 0
(0020,0000) Group Length VR: UL Length: 4 Value: 380
(0020,000D) Study Instance UID VR: UI Length: 60 Value: 1.2.392.200036.9141.274.14801.20021001090000.20171205105954
(0020,000E) Series Instance UID VR: UI Length: 60 Value: 1.2.392.200036.9141.274.14801.20021001090000.20171205105954
(0020,0010) Study ID VR: SH Length: 10 Value: 712051059
(0020,0011) Series Number VR: IS Length: 0
(0020,0012) Acquisition Number VR: IS Length: 0
(0020,0013) Image Number VR: IS Length: 2 Value: 1
(0020,0020) Patient Orientation VR: CS Length: 4 Value: L\P
(0020,0032) Image Position (Patient) VR: DS Length: 30 Value: -51.96544\-117.73420\79.77507
(0020,0037) Image Orientation (Patient) VR: DS Length: 42 Value: 1.0000\0.0000\0.0000\0.0000\1.0000\0.0000
(0020,0052) Frame of Reference UID VR: UI Length: 60 Value: 1.2.392.200036.9141.274.14801.20021001090000.20171205105954
(0020,1040) Position Reference Indicator VR: LO Length: 0
(0020,1041) Slice Location VR: DS Length: 8 Value: 79.77507
(0020,4000) Image Comments VR: LT Length: 0
(0028,0000) Group Length VR: UL Length: 4 Value: 178
(0028,0002) Samples per Pixel VR: US Length: 2 Value: 1
(0028,0004) Photometric Interpretation VR: CS Length: 12 Value: MONOCHROME2
(0028,0010) Rows VR: US Length: 2 Value: 512
(0028,0011) Columns VR: US Length: 2 Value: 512
(0028,0030) Pixel Spacing VR: DS Length: 16 Value: 0.20299\0.20299
(0028,0100) Bits Allocated VR: US Length: 2 Value: 16
(0028,0101) Bits Stored VR: US Length: 2 Value: 16
(0028,0102) High Bit VR: US Length: 2 Value: 15
(0028,0103) Pixel Representation VR: US Length: 2 Value: 1
(0028,0106) Smallest Image Pixel Value VR: SS Length: 2 Value: -1024
(0028,0107) Largest Image Pixel Value VR: SS Length: 2 Value: -358
(0028,1050) Window Center VR: DS Length: 4 Value: 1024
(0028,1051) Window Width VR: DS Length: 4 Value: 4095
(0028,1052) Rescale Intercept VR: DS Length: 2 Value: 0
(0028,1053) Rescale Slope VR: DS Length: 2 Value: 1
(7FE0,0000) Group Length VR: UL Length: 4 Value: -1
(7FE0,0010) Frame Data VR: OB Length: FFFFFFFF
(FFFE,E000)
(FFFE,E000)


------------------------------ END OF FAILURE DICOM HEADER ---------------------------------------------------

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#2 Post by Michael Onken »

Hi,

first try dcmdjpeg to decode the file. Use option -d to see details of what is going on. Maybe the log output already gives a good hint.

Best,
Michael

evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Re: Issue related to FAQ: cannot change to unencapsulated re

#3 Post by evanyftsai »

Hi,

It looks like the error code is

EJCode_IJG12_Decompression

Can you shed some light on what does this mean? And what can I do with this?

Thanks a lot,
Evan

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#4 Post by Michael Onken »

What is the output of the tool when invoking it with -d?

evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Re: Issue related to FAQ: cannot change to unencapsulated re

#5 Post by evanyftsai »

It looks like this:



D: $dcmtk: dcmdjpeg v3.6.0 2011-01-06 $
D:
I: reading input file 0298.dcm
D: DcmItem::checkTransferSyntax() TransferSyntax="Little Endian Explicit"
I: decompressing file
D: Start of Image
D: JFIF APP0 marker: version 0.00, density 0x0 0
D: Start Of Frame 0x00: width=0, height=0, components=0
D: Component 0: 0hx0v q=0
D: Define Huffman Table 0x00
D: Start Of Scan: 0 components
D: Component 0: dc=0 ac=0
D: Ss=0, Se=0, Ah=0, Al=0
F: Invalid lossless parameters Ss=0 Se=0 Ah=0 Al=0: decompressing file: 0298.dcm



Thanks,
Evan

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#6 Post by Michael Onken »

For me this looks like an invalid JPEG stream,maybe with lots of zeroes at the beginning? I don't think this has to do with meta data like Bits Allocated and the like.

Best,
Michael

evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Re: Issue related to FAQ: cannot change to unencapsulated re

#7 Post by evanyftsai »

Michael,

Thank you. Although this particular DICOM data can be opened and viewed correctly on other off-the-shelf DICOM viewers.

Is there a way that I can send this data to you for a closer look? I need to be able to explain to the physician why this is deemed invalid in our system but not in others.

Thanks,
Evan

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#8 Post by Michael Onken »

Hi Evan,

sorry for the late response. Yes, please send it to bugs at dcmtk dot org. Thanks!

Best,
Michael

evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Re: Issue related to FAQ: cannot change to unencapsulated re

#9 Post by evanyftsai »

Michael,

Ok, thanks! Before I send it though - I dived into the decoding codes and found out exactly what's offending:

In this particular block of codes (dcmjpeg\libijg12\jdpred.c):


METHODDEF(void)
predict_start_pass (j_decompress_ptr cinfo)
{
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
int ci;

/* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
*
* Ss is the predictor selection value (psv). Legal values for sequential
* lossless JPEG are: 1 <= psv <= 7.
*
* Se and Ah are not used and should be zero.
*
* Al specifies the point transform (Pt). Legal values are: 0 <= Pt <= 15.
*/
if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
cinfo->Se != 0 || cinfo->Ah != 0 ||
cinfo->Al > 15) /* need not check for < 0 */
ERREXIT4(cinfo, JERR_BAD_LOSSLESS,
cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);

/* Set undifference functions to first row function */
for (ci = 0; ci < cinfo->num_components; ci++)
losslsd->predict_undifference[ci] = jpeg_undifference_first_row;
}


The value for Se is not 0. Instead, it is 63 for this DICOM data. That's why the system errors out.

Specifically, these are the 4 values involved in this logic for this data:

Ah = 0
Al = 0
Se = 63
Ss = 1

Hopefully this gives you some more information about what's wrong with this data?

Thanks,
Evan

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#10 Post by Michael Onken »

Hi Evan,

Being not a JPEG expert myself (at this level), I'll leave this question to my colleague Marco who implemented the codec in DCMTK ;)

Marco, do you have an explanation?

Best,
Michael

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Issue related to FAQ: cannot change to unencapsulated re

#11 Post by Marco Eichelberg »

To my knowledge, the "Se" parameter is used for spectral selection in progressive, lossy JPEG and should never be != 0 in a lossless JPEG bitstream.
So this really looks like an invalid JPEG bitstream. Viewers that can successfully open it might either internally use the defective codec
that has produced the image, or a codec that has a workaround.

evanyftsai
Posts: 26
Joined: Fri, 2015-10-16, 09:18

Re: Issue related to FAQ: cannot change to unencapsulated re

#12 Post by evanyftsai »

Thank you.

I found another thread with the same problem:

viewtopic.php?f=1&t=4410

Thanks,
Evan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot], Google [Bot] and 1 guest