[Insight-users] Problem with itkVectorImage, templated classes and gcc-3.3

Bryn blloyd at bwh.harvard.edu
Fri Sep 30 05:59:21 EDT 2005


Hi Karthik,  anybody



I have been having problems with the PixelType of the VectorImage.


Summary:
templated class with function argument = (pixeltype from itkVectorImage) 
does not compile with gcc-3.3 but does compile with gcc-3.4


Detailed description:
I have a templated class with several functions and typedefs. The class 
is templated over the InputImage and OutputImage. These are both 
itkVectorImages:

gcc version 3.3.5 (Debian 1:3.3.5-13) has problems compiling, if I have 
something like this:


template <class TInputImage,class TOutputImage>
class ITK_EXPORT OrderKDistanceTransformImageFilter :
    public ImageToImageFilter<TInputImage,TOutputImage>
{
public:

  itkStaticConstMacro(InputImageDimension, unsigned int,
                      TInputImage::ImageDimension);
  ...
  typedef VectorImage<int,InputImageDimension>    KIDImageType;
  typedef typename KIDImageType::PixelType KIDPixelType;
  ...
 
  KIDPixelType SortArray(const KIDPixelType& indices);
  ...
};



The error message I get is:

In file included from 
/home/blloyd/Kitware/Apps/MyClasses/itkOrderKDistanceTransformImageFilter.h:251,
                 from /home/blloyd/Kitware/Apps/KOrderDT/code/main.cxx:11:
/home/blloyd/Kitware/Apps/MyClasses/itkOrderKDistanceTransformImageFilter.txx:545: 
error: prototype
   for `typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::SortArray(typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType&)' does not match any in
   class `itk::OrderKDistanceTransformImageFilter<TInputImage, 
TOutputImage>'
/home/blloyd/Kitware/Apps/MyClasses/itkOrderKDistanceTransformImageFilter.h:205: 
error: candidate
   is: typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::SortArray(typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType&)
/home/blloyd/Kitware/Apps/MyClasses/itkOrderKDistanceTransformImageFilter.txx:545: 
error: template
   definition of non-template `typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::SortArray(typename itk::VectorImage<int,
   itk::OrderKDistanceTransformImageFilter<TInputImage,
   TOutputImage>::InputImageDimension>::PixelType&)'



Is there a way I can solve this (using gcc-3.3)?

Must I specify the PixelType as VariableLengthVector<int> instead?
I would prefer, if I did not have to do this, since the VectorImage 
seems to be changing (Array->VariableLengthVector etc).



Thanks
Bryn




More information about the Insight-users mailing list