[Insight-users] How to load Color images in ITK.

Luis Ibanez luis.ibanez at kitware.com
Tue May 22 08:08:34 EDT 2007


Hi XueQuan,

In order to read a color image into ITK you should use
as pixel type the class:


                  itk::RGBPixel

http://www.itk.org/Insight/Doxygen/html/classitk_1_1RGBPixel.html



Please read the ITK Software Guide

      http://www.itk.org/ItkSoftwareGuide.pdf


In particular the following sections:

*  4.1.5  "RGB Images"                      in pdf-page 75.

*  4.2.4  "RGB as Pixel Type"               in pdf-page 88.

*  7.4    "Reading and Writing RGB Images"  in pdf-page 301.

* 12.2    "Adapting RGB Images"             in pdf-page 780.



In your case, of course, you could also use directly
the VTK reader in order to load the color image that
you want to display.


Beware however, that VTK has an opposite standard for the
direction of the Y axis. This may result in the image to
appear flipped along the vertical direction.  This is the
result of the standard used in computer graphics, where
the origin of coordinates is assumed to be located in the
upper right corner.




Regards,


     Luis





============================
qxue at jouy.inra.fr wrote:
> Dear Lius Ibanez:
>      Thank you very much for your advices recently.
>      I just begin to combine the VTK with ITK to show the segmentation result,
> for I have gotten the segmentation result by ITK successfully. But I meet with
> some questions to visualize the original color image to process and show the
> last segmentation result by overlaying.
>      I use the "CellularSegmentation" in InsightApplication-3.0.0 as an example,
> but the program does not surport the color image that is, when i read a color
> image there is just a gray image. I try to use the different file format such
> as PNG and TIF but the result is same.
>     Should I use the VTK to read the color image as input file by myself, or
> just adding and change the code in the "CellularSegmentation"?
>     Best regards,
> XueQuan
> 


More information about the Insight-users mailing list