[Insight-users] Generic Image Reader

Sumit Kumar dost_4_ever at yahoo.com
Tue Jan 1 22:04:35 EST 2008


Hello
I have a question regarding Image File reading. For
simplicity I would like to read a 2D image (grayscale
or color), but it can very well extend to
multi-dimensional images.

Is there a way in itk to template this operation,
rather that writing two specific instances ?

For example,

typedef float PixelType;
typedef itk::RGBPixel<PixelType> RGBPixelType;
typedef itk::Image< RGBPixelType, 2 >                 
CImageType2D; 
typedef itk::ImageFileReader<CImageType2D> readerC;

would be one such example for reading a 2D RGB image.
Similarly, I can write something for a grayscale
image;

For example,
typedef itk::Image< PixelType, 2 >GImageType2D;
typedef itk::ImageFileReader<GImageType2D> readerG;

Now, is there a way to "generalize" this process via
templates ? Or is there a way in itk to automatically
determine what type of image is being read ? Or are we
resigned to using a default RGBPixel for reading the
image, no matter what type of input is being read
(something similar to QImage in Qt).

Your inputs will be greatly appreciated.
Sincerely
Sumit


      Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/



More information about the Insight-users mailing list