[Insight-users] Re: Problem with lossless JPEG compression in
GDCMImageIO
Mathieu Malaterre
mathieu.malaterre at gmail.com
Tue Sep 25 13:13:31 EDT 2007
On 9/25/07, Steve M. Robbins <steve at sumost.ca> wrote:
> I interpret that to mean there was a bug in GDCM's use of JPEG -- is
> that correct? If so, could you explain the bug? [To prevent others,
> e.g. me, from making the same mistake]
Patch is here.
http://www.itk.org/cgi-bin/viewcvs.cgi/Utilities/gdcm/src/gdcmJpeg.cxx?root=Insight&sortby=date&r2=1.12&r1=1.11
Long story short. There is a 'well known' lossless patch for IJG.
According to the author tests were done to be truely lossless.
Unfortunately there was no documentation on how to use the patch. The
author assumed -maybe- at the time that other people would do it.
All I could find was a post in imagemagick mailing list:
http://studio.imagemagick.org/pipermail/magick-users/2002-September/004685.html
even today -rereading the post- I believe the comment is wrong. You
*should not* set any value for the point transform. You can only play
with the 7 predictors, but not the point transform.
> I'd be interested in such advice.
Thankfully I write everything down in the gdcm wiki to remember for later:
http://gdcm.sourceforge.net/wiki/index.php/Libs/jpeg#Choosing_predictor
this page shows the slightly different result you get when choosing
different predictor.
On this page:
http://pkgsrc.se/graphics/ljpeg
You can see that the ljpeg from cornell support automatic PSV selection.
<quote>
Our lossless JPEG encoding program has an automatic prediction
selection value (PSV) selector which selects the best PSV among a
user provided or default set of PSVs. This selector guarantees the
best compression ratio for lossless JPEG.
</quote>
This page describes why you *should not* use ljpeg.
http://gdcm.sourceforge.net/wiki/index.php/IJG
So finally all you have to do is extract the code from ljpeg that is
doing the PSV selection.
Hopefully this is enough information,
--
Mathieu
More information about the Insight-users
mailing list