[Insight-users] Problem with itkVectorImage, templated classes
and gcc-3.3
Karthik Krishnan
Karthik.Krishnan at kitware.com
Fri Sep 30 18:02:19 EDT 2005
Bryn:
Bryn wrote:
> 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).
>
I cannot reproduce your problem without seeing a minimal example of
your code...
The pixeltype for the VectorImage, if you write code, should be obtained
from the Image class.. This is the reason for generic programming. But
if you find it convenient, I can easily add overloaded = operators in
itk::VariableLengthVector and itk::Array, which is probably a good thing
anyway, since they should be assignable from each other...
I still do not understand what compiles in gcc34 and not in gcc33. If
any, I've seen things go the other way......
-karthik
>
>
> Thanks
> Bryn
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list