Problem while converting dicom to jpeg

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
vinayak
Posts: 5
Joined: Mon, 2013-10-21, 15:51

Problem while converting dicom to jpeg

#1 Post by vinayak »

Hi,

I am getting the following error while converting a dicom file to jpeg using dcmj2pnm tool:

E: can't change to unencapsulated representation for pixel data
D: decompressing first frame to determine the decompressed color model
E: can't decompress first frame: Tag not found
E: can't determine 'PhotometricInterpretation' of decompressed image
D: DcmPixelData::getDecompressedColorModel() returned: Tag not found
E: mandatory attribute 'PhotometricInterpretation' is missing or can't be determined
F: Missing attribute

The transfer syntax is jpeg baseline and from the dcmdump command I can see the 'PhotometricInterpretation" tag is present. I believe I don't need any special extensions for this transfer syntax. Could someone guide me what I am doing wrong?



Below is the partial output of dcmdump :
COMMAND : $ ./bin/dcmdump -v -d -M test/001032US

OUTPUT :

# Dicom-File-Format

# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
(0002,0000) UL 198 # 4, 1 FileMetaInformationGroupLength
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion
(0002,0002) UI =SecondaryCaptureImageStorage # 26, 1 MediaStorageSOPClassUID
(0002,0003) UI [1.2.840.113815.0.2.824562578907730.20120822205601.4133.1.139] # 60, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =JPEGBaseline # 22, 1 TransferSyntaxUID
(0002,0012) UI [1.2.840.113815.4.1.1] # 20, 1 ImplementationClassUID
(0002,0013) SH [Removed] # 16, 1 ImplementationVersionName

# Dicom-Data-Set
# Used TransferSyntax: JPEG Baseline
...
...
...
(0020,0011) IS [1] # 2, 1 SeriesNumber
(0020,0012) IS (no value available) # 0, 0 AcquisitionNumber
(0020,0013) IS [139] # 4, 1 InstanceNumber
(0020,0020) CS (no value available) # 0, 0 PatientOrientation
(0020,0060) CS (no value available) # 0, 0 Laterality
(0020,1002) IS (no value available) # 0, 0 ImagesInAcquisition
(0020,4000) LT [Removed] # 14, 1 ImageComments
(0028,0000) UL 124 # 4, 1 GenericGroupLength
(0028,0002) US 3 # 2, 1 SamplesPerPixel
(0028,0004) CS [RGB] # 4, 1 PhotometricInterpretation
(0028,0008) IS [1] # 2, 1 NumberOfFrames
(0028,0009) AT (0018,1063) # 4, 1 FrameIncrementPointer
(0028,0010) US 860 # 2, 1 Rows
(0028,0011) US 956 # 2, 1 Columns
(0028,0034) IS (no value available) # 0, 0 PixelAspectRatio
(0028,0100) US 8 # 2, 1 BitsAllocated
(0028,0101) US 8 # 2, 1 BitsStored
(0028,0102) US 7 # 2, 1 HighBit
(0028,0103) US 0 # 2, 1 PixelRepresentation
(0028,1040) CS [LIN] # 4, 1 PixelIntensityRelationship
(0050,0000) UL 8 # 4, 1 GenericGroupLength
(0050,0004) CS (no value available) # 0, 0 CalibrationImage
(7fe0,0010) OB (PixelSequence #=2) # u/l, 1 PixelData
(fffe,e000) pi 00\00\00\00 # 4, 1 Item
(fffe,e000) pi (not loaded) # 223738, 1 Item
(fffe,e0dd) na (SequenceDelimitationItem) # 0, 0 SequenceDelimitationItem


And below is the output of dcmj2pnm tool.

COMMAND : $ ./bin/dcmj2pnm -v -d test/001032US

OUTPUT :

D: $dcmtk: dcmj2pnm v3.6.0 2011-01-06 $
D:
I: reading DICOM file: test/001032US
D: DcmItem::checkTransferSyntax() TransferSyntax="Little Endian Explicit"
I: preparing pixel data
D: transfer syntax of DICOM dataset: JPEG Baseline (1.2.840.10008.1.2.4.50)
D: Start of Image
D: JFIF APP0 marker: version 0.00, density 0x0 0
D: Miscellaneous marker 0x00, length 0
D: Start Of Frame 0x00: width=0, height=0, components=0
D: Component 0: 0hx0v q=0
D: Component 0: 0hx0v q=0
D: Component 0: 0hx0v q=0
D: Define Quantization Table 0 precision 0
D: Define Quantization Table 0 precision 0
D: Define Huffman Table 0x00
D: Define Huffman Table 0x00
D: Define Huffman Table 0x00
D: Define Huffman Table 0x00
D: Start Of Scan: 0 components
D: Component 0: dc=0 ac=0
D: Component 0: dc=0 ac=0
D: Component 0: dc=0 ac=0
D: Ss=0, Se=0, Ah=0, Al=0
E: can't change to unencapsulated representation for pixel data
D: decompressing first frame to determine the decompressed color model
E: can't decompress first frame: Tag not found
E: can't determine 'PhotometricInterpretation' of decompressed image
D: DcmPixelData::getDecompressedColorModel() returned: Tag not found
E: mandatory attribute 'PhotometricInterpretation' is missing or can't be determined
F: Missing attribute


Any help or advice is most appreciated.

Thanks,

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem while converting dicom to jpeg

#2 Post by J. Riesmeier »

Could you send the DICOM image file by email (to "bugs/at/dcmtk/dot/org") for further analysis?

vinayak
Posts: 5
Joined: Mon, 2013-10-21, 15:51

Re: Problem while converting dicom to jpeg

#3 Post by vinayak »

Thanks for the reply. I will generate a sample dicom file (original one contains sensitive data) which gives the above issue and send it.

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem while converting dicom to jpeg

#4 Post by J. Riesmeier »

Thank you for sending us the sample file.

The missing PlanarConfiguration data element is indeed one of the issues... but the main problem seems to be that there are too few bytes in the JPEG stream, i.e. DCMTK's decoder expects that there should be another pixel item with further JPEG data -- and then fails.

Anyway, the output of the JPEG decoder is not very helpful, but this is a known issue that should be fixed for the next DCMTK release.

vinayak
Posts: 5
Joined: Mon, 2013-10-21, 15:51

Re: Problem while converting dicom to jpeg

#5 Post by vinayak »

Thank you for looking into this.

This is a very critical issue for an application we are developing with the help of DCMTK tool. Is there a source code patch(or any workaround) which we can put into the source code and build it ourselves? If not, can you please let us know when is the next DCMTK release expected? So that we can temporarily ignore the issue and move on with other things.

Also, let us know if we can support you in fixing the issue in any way.

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem while converting dicom to jpeg

#6 Post by J. Riesmeier »

Maybe, my sentence "the output of the JPEG decoder is not very helpful, but this is a known issue that should be fixed for the next DCMTK release" was not that clear. What I meant is that the log output of the JPEG decoder (in case of corrupted JPEG data) should and will be enhanced in the future. This is because you currently need to debug the source code in order to find the reason for such problems.

Did you already check whether other JPEG-aware DICOM viewers/tools can process your file?

vinayak
Posts: 5
Joined: Mon, 2013-10-21, 15:51

Re: Problem while converting dicom to jpeg

#7 Post by vinayak »

Yes, I can view the image in Osirix(on Mac) and RadiAnt DICOM Viewer(on Windows)

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem while converting dicom to jpeg

#8 Post by J. Riesmeier »

Thank you for the feedback. I've added this issue to our tracker (#571), so it doesn't get lost.

vinayak
Posts: 5
Joined: Mon, 2013-10-21, 15:51

Re: Problem while converting dicom to jpeg

#9 Post by vinayak »

I could not find the issue numbers in the earlier release notes. Is there any issue tracker page where I can view the status of this issue?

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem while converting dicom to jpeg

#10 Post by J. Riesmeier »

I could not find the issue numbers in the earlier release notes.
Of course not, this is a new issue that I have just added to our issue tracker.
Is there any issue tracker page where I can view the status of this issue?
No, unfortunately, access to the tracker is currently limited to DCMTK team members. I just mentioned the issue number in order to make it easier for my colleagues to find it.

Btw, I've set the "Target version" for this issue to "3.6.2" (which will be the version number of the next DCMTK release). Please note, however, that there is no fixed timeline yet.

If you are in hurry, you could contact me directly and ask for my professional consulting services.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest