Error chooseRepresentation JPEG with RGB Icon Image Sequence

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Rogfitz
Posts: 1
Joined: Fri, 2014-09-12, 08:21

Error chooseRepresentation JPEG with RGB Icon Image Sequence

#1 Post by Rogfitz » Fri, 2014-09-12, 11:25

Using DCMTK 3.6.0 with JP2K extension.

We use Icon Image Sequence tag to store a thumbnail of the image stored in Pixeldata tag. If the Image is an RGB the Icon image Sequence contains RGB Palette Color Image. If the image is MONOCHROME the Icon Image Sequence contains a MONOCHROME image.

This we have done for many years using DeflatedLitteEndian as TransferSyntax.

But, now whe are implementing JPEG and JP2K and get an error "Pixel representation cannot be changed" when doing chooseRepresentation using EXS_JPEG2000LosslessOnly,EXS_JPEGProcess14SV1TransferSyntax or EXS_JPEG2000 AND the Icon Image Sequence tag contains an RGB Palette color image.

It works if we convert the Icon Image Sequence image to MONOCHROME.

We insert the Palette Color image in Icon Image Sequence like this: (scaled contains the scaled version of PixelData image)
res = DcmQuant::createPaletteColorImage(*scaled, *ditem, OFFalse, OFFalse, OFFalse, 256, description );

And the monochrome like this:
DicomImage *mono = scaled->createMonochromeImage();
worked = mono->writeImageToDataset(*ditem);

I found the following commenct in dcpixel.cc:
/* determine if the pixel data is captured in native (uncompressed) or encapsulated
* (compressed) format. We only derive this information from the length field
* which is set to undefined length for encapsulated data because even in
* compressed transfer syntaxes the Icon Image Sequence may contain an
* uncompressed image.
*/

I know that all the DcmPixelData Tags in a DcmDataset has to be the same transfer syntax, but isnät that the meaning with chochooseRepresentation to do that?

Any workaround?

Post Reply

Who is online

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