[Insight-developers] Adding PPM (and PBM/PGM)

Karthik Krishnan karthik.krishnan at kitware.com
Mon Aug 11 13:36:33 EDT 2008



kent williams wrote:
> We are in the process of converting an existing application suite to use ITK
> instead of the library of home-made functions it currently uses.  One of the
> tasks Hans has asked me to work on is to create an itk::ImageIO class that
> reads and writes PPM files to contribute to ITK.
>
> I have a couple of questions.
>
> 1. There is an existing library for reading/writing PPM files -- netpbm.
> This is one of those old-school, sprawling packages with dozens of programs,
> covered by a confusing variety of licenses.  Luckily it appears that the
> library code needed to read and write PPM files is fairly compact and in the
> public domain.
>
> Would it be OK to include this library source in order to support the
> PPMImageIO class?  I would of course first submit this as an Insight Journal
> article.  The library itself is public domain, compact, portable, and
> stable.
>
> 2. PPM is 2D only, and RGB only. I know there is pixel conversion code in
> ITK, but how should an ImageIO class behave if it is asked to write a 3D
> image when the image format only supports 2D?
>   
Throwing an exception is what they do now.

The ImageIO class has access to the ioregion (whose dimensionality can 
be checked), to the PixelType and the Number of components in the pixel. 
So enforcing 2D RGB should be possible.

There's also variants PGM and PBM. And the PNM which is collectively 
used to refer to the three PGM/PPM/PBM.

So there's the option of creating either a seperate IO for the three one 
called itkPNMImageIO which encompasses all three.

Also the core library of the netpbm package: libp*m, I think is BSD 
like. Several utilities aren't. Please check.

> The one example of a similar reader is itk::JPEGImageIO.h but it seems to be
> pretty incomplete -- it looks like it doesn't pay any attention to the
> requested pixel type in the Read method, and just assumes it will be 8 bit
> pixels.
>
>
>
>
> Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.o


More information about the Insight-developers mailing list