[Insight-users] Inheriting ITK Image

Matt Kelsey mkelsey at gmail.com
Tue Nov 28 21:51:24 EST 2006


Hello,
I am trying to inherit a fully specified ITK image and add my own
functionality.  Test code below:

>>>>>>>>>>>>>>>

#include "itkImage.h"

typedef unsigned char  PixelType;
const   unsigned int Dimension = 2;
typedef itk::Image< PixelType, Dimension >  ImageType;

class CustomImageClass : public ImageType
{
   public:
      void NewFunction() {};
};

int main()
{
   CustomImageClass::Pointer image = CustomImageClass::New();
   image->NewFunction();  // doesn't work
}

>>>>>>>>>>>>>>>
This results in not having access to NewFunction().  I'm guessing this
is because the Pointer is from ImageType and not CustomImageType.  Is
there a way to do this while keeping the functionality of the smart
pointer.

Thanks for the help,
Matt


More information about the Insight-users mailing list