When trying to pass a template parameter to another template, I am getting an 'invalid template parameter' error. I even tried to force it with 'typename' with no success. Can anyone see what's wrong with this?
#include <itkImage.h>
#include <itkImageFileWriter.h>
#include <itkRescaleIntensityImageFilter.h>
template <class T>
void WriteImage(typename T::Pointer image, std::string filename);
int main(int, char *[])
{
itk::Image<unsigned char, 2>::Pointer image = itk::Image<unsigned char, 2>::New();
WriteImage<itk::Image<unsigned char, 2> > (image, "test.jpg");
return EXIT_SUCCESS;
}
template <class T>
void WriteImage(typename T::Pointer image, std::string filename)
{
typedef itk::RescaleIntensityImageFilter<typename T, typename T> RescaleFilterType; //template argument 1 is invalid
//typedef itk::RescaleIntensityImageFilter<T, T> RescaleFilterType; // expected ';' before rescaleFilter
RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();
}
Thanks,
David