How to load "Lossy Image Compression" data?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
seo
Posts: 1
Joined: Fri, 2022-03-18, 09:13

How to load "Lossy Image Compression" data?

#1 Post by seo »

Hello, I am developing a "CT Viewer" using DCMTK.

I have been trying to load "Lossy Image Compression" DCM data.
However, since the data is not decompressed, the data is not loaded.

How to load "Lossy Image Compression" data?

Note. TAG Information
(0028, 2110) Lossy Image Compression : 1
(0028, 2112) Lossy Image Compression Ratio : 0
(0028, 2114) Lossy Image Compression Method : ISO_10918_1

thanks.

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

Re: How to load "Lossy Image Compression" data?

#2 Post by Marco Eichelberg »

This question is not related to the DCMJP2K module, which is about JPEG 2000 compression. Will move it to the General discussion forum.

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

Re: How to load "Lossy Image Compression" data?

#3 Post by Marco Eichelberg »

I would suggest that you look at the source code of dcm2pnm.cc, an application that renders DICOM images and does support lossy compression.

The most important aspect is that you need to register the JPEG decoder in the DICOM parser before loading a dataset:

Code: Select all

    DJDecoderRegistration::registerCodecs();
You can then either use the DicomImage class to render the image

Code: Select all

    DicomImage *di = new DicomImage(dfile, xfer);
or, if you prefer to implement you own display pipeline, you can just call the decoder and convert the compressed dataset into an uncompressed one:

Code: Select all

    DcmDataset *dataset = dfile.getDataset();
    error = dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL);

Post Reply

Who is online

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