Question about Lossless JPEG encoding

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
razvanux
Posts: 28
Joined: Thu, 2005-02-10, 08:04
Location: Cluj-Napoca, Romania
Contact:

Question about Lossless JPEG encoding

#1 Post by razvanux »

Hello,

When changing the represenation of an CT IOD from ELE to Jpeg Lossless Process 14 (1.2.840.10008.1.2.4.70) the Modality LUT transformations (Rescale + Window/Level) are being applied on the original image before being converted to JPEG.

By following these transformation steps, the original data cannot be reconstructed when applying the reverse transformation (Jpeg decoding), as original values are lost in the modality LUT transformations.

Am I missing something?

Can you help clear the waters on this a bit?

The toolkit used was Offis 3.5.3.


Thank you,
Razvan

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

#2 Post by Michael Onken »

Hi,

Modality LUT, Window Level/Center etc. are adapted to the compression scheme in order to fit bit depths etc. So no image quality is lost, but the multiplications and offsets from LUTs and so on are just shifted into the pixel data and/or lead to adapted LUT settings.

If you decompress the data to uncompressed transfer syntax again, the former original values may be lost; however, the image quality is the same and no actual pixel information was lost.

By the way, in 3.5.4 we re-implemented parts of the lossless encoding since the in 3.5.3 and older color model changes and some other stuff may happen that lead to a minimal loss of quality for each compression/decompression cycle (i.e. doing that a hundred times will bring significant loss of quality). That's why in 3.5.4 the standard for lossless compression is a "real lossless mode" which only starts operation if it can do so without any lossy colorspace conversions or other issues. So I recommend switching to 3.5.4 or later, anyway.

Best regards,
Michael

ruslik
Posts: 2
Joined: Fri, 2010-08-13, 16:52

#3 Post by ruslik »

AFAIK, some SOP classes (MR that is not expected to have Modality LUT, or PET that could apply the VOI LUT before the Modality LUT because of small range that would result after the Modality LUT) could be damaged by changing the Modality LUT.

Doesn't that mean that changing of the transfer syntax should avoid alteration of any other tags from the dataset?

razvanux
Posts: 28
Joined: Thu, 2005-02-10, 08:04
Location: Cluj-Napoca, Romania
Contact:

#4 Post by razvanux »

Michael Onken wrote:Hi,

Modality LUT, Window Level/Center etc. are adapted to the compression scheme in order to fit bit depths etc. So no image quality is lost, but the multiplications and offsets from LUTs and so on are just shifted into the pixel data and/or lead to adapted LUT settings.

If you decompress the data to uncompressed transfer syntax again, the former original values may be lost; however, the image quality is the same and no actual pixel information was lost.

By the way, in 3.5.4 we re-implemented parts of the lossless encoding since the in 3.5.3 and older color model changes and some other stuff may happen that lead to a minimal loss of quality for each compression/decompression cycle (i.e. doing that a hundred times will bring significant loss of quality). That's why in 3.5.4 the standard for lossless compression is a "real lossless mode" which only starts operation if it can do so without any lossy colorspace conversions or other issues. So I recommend switching to 3.5.4 or later, anyway.

Best regards,
Michael
Forgive me if I miss something here...
Once you applied VOI lut to an image and then compressed it using JPEG and losing the original values in that image, how will you apply once again VOI lut on the image after it was compressed?

This is something that's unclear to me right now and some pointers will be appreciated.

Thank you.

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

#5 Post by Michael Onken »

Hi,

you will not apply any unchagned VOI LUT to the image if the pixel values were shifted or somehow changed by using modified Rescale Slope/Intercept from Modality LUT to shift values back after decompression. Otherwise the VOI LUTs may be removed. Optionally, it is also possible to specify a specific windows to be applied before compressing.

If I am wrong or not exact in some points, Jörg being the author of DicomImage (used for lossy and old JPEG lossless compression) may correct me. The new JPEG lossless mode (called "true lossless" in dcmcjepg) does not use DicomImage at all and therefore will never do that shifting/adaption tricks that the other (old lossless mode and lossy mode) does. However, the value range adoptions are _not_ the reasons for chajnigng the lossless behaviour but more the color space conversions that were possible in the old lossless mode.

Best regards,
Michael

Post Reply

Who is online

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