Retrieving Image Data from a compressed dicom image

Questions regarding the DCMJP2K library, a DCMTK add-on that implements support for JPEG 2000 compression (lossy and lossless) in DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jaredf
Posts: 2
Joined: Wed, 2007-09-12, 19:33

Retrieving Image Data from a compressed dicom image

#1 Post by jaredf » Thu, 2007-10-04, 17:10

I am having trouble getting the image data when the dicom image is compressed.

Sadly, I am trying to update some old code and I am new to dcmtk. So, it is the old code that doesn't appear to work.

Also, the pixel data is compressed using JPEG2000, and we have our own toolset we wish to use to decompress it.

here is the code that is currently being used to extract the image data:

Code: Select all

DcmStack stack;
E_Condition ret = m_dataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse);

DcmOtherByteOtherWord *pixdata = (DcmOtherByteOtherWord*)stack.top();

Uint16 *pixels2;
pixdata->getUint16Array( pixels2);
m_dataset is a DcmDataset object and was loaded successfully.

The problem is the last line of code, getUint16Array, returns a NULL pointer. I could use help on figuring out why this doesn't return any data.

Thanks,

Jared

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier » Fri, 2007-10-05, 09:31

In order to extract JPEG2000 compressed pixel data, you need to register the codecs from module DCMJP2K. This module is not available as part of the DCMTK but has to be licensed separately. See web site for further details.

jaredf
Posts: 2
Joined: Wed, 2007-09-12, 19:33

#3 Post by jaredf » Fri, 2007-10-05, 18:55

In post:viewtopic.php?t=1332&sid=efe7783e4cfdc8 ... 9308f48a60 Michael Onken stated that it is possible to get the pixel data of a compressed dicom image without using the DCMJP2K library and then use another JPG2K library to decompress the data.

Is that not possible and Michael is mistaken? I just want to get at the compressed data and use my own libraries to decompress it.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier » Fri, 2007-10-05, 20:57

In this case, you should probably have a look at the dcmjpeg module in order to learn how to integrate your JPEG2000 implementation with the DCMTK.

hayhv
Posts: 7
Joined: Tue, 2009-04-14, 03:09
Contact:

#5 Post by hayhv » Sun, 2009-04-19, 18:13

I want create new class "DJDecoderJpeg200Lossy" like DJDecoderLossless to decode JPEG2000 compressed pixel data. But i don't get Pixel Data by function findAndGetUint16Array. Help me.
Jörg Riesmeier wrote:In this case, you should probably have a look at the dcmjpeg module in order to learn how to integrate your JPEG2000 implementation with the DCMTK.
hayhv

hayhv
Posts: 7
Joined: Tue, 2009-04-14, 03:09
Contact:

#6 Post by hayhv » Sun, 2009-04-19, 18:13

I want create new class "DJDecoderJpeg200Lossy" like DJDecoderLossless to decode JPEG2000 compressed pixel data. But i don't get Pixel Data by function findAndGetUint16Array. Help me.
Jörg Riesmeier wrote:In this case, you should probably have a look at the dcmjpeg module in order to learn how to integrate your JPEG2000 implementation with the DCMTK.
hayhv

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

#7 Post by Marco Eichelberg » Tue, 2009-04-28, 12:36

findAndGetUint16Array() does not work on compressed pixel data because the structure of compressed pixel data is quite different in DICOM - it uses a sequence-like structure with multiple fragments containing compressed bitstream information. There are other API methods to access these fragments, which you can then feed into your own JPEG 2000 decode, and as my collegue suggests, you should look at the implementation of the dcmjpeg library in the toolkit on how to use these API methods - that's exactly what the JPEG decoder does, it just feeds the bitstream data to a JPEG decoder instead of a JPEG 2000 decoder.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests