[Insight-developers] Is there any way to know Pixel type in Image class?

Luis Ibanez ibanez at cs.unc.edu
Tue Sep 5 10:50:09 EDT 2000


Hi,

To get access to the image pixel type you can take
advantage of the traits. Specifically "PixelType"

"PixelType" is a type defined on the itk::Image class.
(see itkImage.h file for details)

for example:

typedef      itk::Image<float,3>              myImageType;

typedef     typename  myImageType::PixelType   myPixelType;

Then you can use the type to declare variables of the pixel type,

myPixelType sum;  ...

or  make casting  like

    *it   = (myPixelType) *t;



Luis




More information about the Insight-developers mailing list