[Insight-users] How to get & set the dimension of an itk::image dynamically?

Michael Xanadu xanadu.michael at googlemail.com
Mon Sep 7 04:05:54 EDT 2009


Hi,

I want to get the dimension of an itk::Image and want to give it to another
image, like this:


*template <class TImage>
void MyClass<TImage>::writeImage(ImageType *image)
{
    unsigned int dimension = ImageType::GetImageDimension();
    typedef itk::Image<unsigned char, dimension> OutputImageType;

    ....
}*


ImageType is defined in the header and looks like this:


*template <class TImage >
class ITK_EXPORT MyClass
{
public:

    typedef TImage   ImageType;

    ...
}*


But I get a error message at compiling:

error C2864: 'itk::MyClass<TImage>::dimension' : only static const integral
data members can be initialized within a class

Is it possible to define the dimension in a dynamic way, like I need it?


Regards, Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090907/1f178e8c/attachment.htm>


More information about the Insight-users mailing list