[Insight-users] how to read a lossless jpeg file?

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Nov 24 08:57:57 EST 2004


bear wrote:
> hi,
>     I download some lossless jpegs from a mammography database,but have some
> troubles reading it. Can Itk read it and how to? Thanks!
>                                                              bear,

Bear,

	Are you using ITK from CVS ? If so then yes the jpeg library shipped 
with ITK can read lossless jpeg. But right now I don't believe you will 
be able to read it using itkJPEGImageIO, as my guess is that your image 
is using 16bits per pixel. Is this correct ?

	If this is correct, then all you have to do is edit: itkJPEGImageIO.cxx 
and change the line from:

#include <itkjpeg/8/jpeglib.h>

into

#include <itkjpeg/16/jpeglib.h>

Then recompile ITK. On the other hand you'll lose the ability to read 
lossy 8bits jpeg (which are the most common one).

------------------------

	As a side note, I am very surprise you have access to pure JPEG 
lossless image and note encapsulated in DICOM images ? Could you tell us 
more where you find them ? If this is usual ?

HTH
Mathieu




More information about the Insight-users mailing list