Lossless JPEG compression not lossless for 14 bit images?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Roelant
Posts: 12
Joined: Thu, 2005-04-21, 14:42
Location: Nijmegen, the Netherlands

Lossless JPEG compression not lossless for 14 bit images?

#1 Post by Roelant »

One of my colleagues recently discovered that the 14 bpp images we have been compressing using dcmcjpeg, are not compressed completely lossless. The images are in fact being scaled to 16 bpp prior to compression (using a gain and an offset), hereby changing the pixel values irreversibly.

While checking earlier questions on this forum I read that only the compression of specific bit depths is supported. I assume these are 8, 12 and 16 bpp.

I was able to do actual lossless compression and decompression of our 14 bpp data by changing the values for BitsStored and HighBit in the DICOM header (to fake a 16 bpp image) prior to the compression, and using the '+sr' option.

I was wondering if there is a way to use dcmcjpeg that does not require me to change tags and is still 100% lossless. Additionally I would prefer getting decompressed images with ImageType 'ORIGINAL' i.s.o. 'DERIVED'.

Regards,

Roelant.

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

#2 Post by Marco Eichelberg »

You are right, the current lossless JPEG implementation in dcmcjpeg leaves a lot to be deserved. Basically the dcmjpeg module was developed with lossy JPEG compression in mind, so the code performs certain preprocessing operations that are visually (but not mathematically) lossless prior to applying the compression algorithm itself. This is certainly misleading for the case of lossless JPEG compression where people would expect a true lossless compression. Such a thing would be possible, but requires major modifications in the dcmcjpeg codec module, and so far nobody in our team has found the time to do that. Any major donation would certainly help accelerating the development of a solution significantly :wink:

Carmelo
Posts: 13
Joined: Fri, 2005-04-29, 11:32
Location: Catalunya

JPEG Lossless compression on DCMTK

#3 Post by Carmelo »

Hello,
Basically the dcmjpeg module was developed with lossy JPEG compression in mind, so the code performs certain preprocessing operations that are visually (but not mathematically) lossless prior to applying the compression algorithm itself
That's really a pitty. I need to use lossless JPEG compression and I was thinking in do that with dcmcjpeg tool but, as I see, it would be better for me not to do that. Anyway, I encourage you to improve the lossless side of JPEG compression (not in a "visual sense" but "mathematically" spoken) on the Toolkit, because in exception of few things it's a really complete tool.
Said that, I'll like to know if you have on mind some date for releasing a new verion of DCMTK with that "issue" solved?.

regards,
Carmelo
I used to have an interest in writing viral code and lost interest quickly when Win95 came out. Hell how could any of us in the scene write a more invasive program than Win95. It made us all obsolete.

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

#4 Post by Marco Eichelberg »

The shortcomings of the current lossless JPEG encoder are certainly one of the most complained about features of the current DCMTK release, and we will address this either in the next release (3.5.4, scheduled for 3Q2005) or the release after. Any financial contribution would certainly speed up the development of the new codec :wink:

Post Reply

Who is online

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