I am trying to cast a RescaleIntensityImageFilter to an ImageToImageFilter:<br><br> static const unsigned int Dimension = 2;<br> typedef float PixelType;<br> typedef itk::Image< PixelType, Dimension > FixedImageType;<br>
typedef itk::Image< PixelType, Dimension > MovingImageType;<br> typedef unsigned char OutputPixelType;<br>
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br> typedef itk::ImageToImageFilter<MovingImageType, FixedImageType> ImageToImageFilterType;<br>
typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType > RescalerType;<br><br> RescalerType::Pointer pp0 = compare.getIntensityRescaler();<br> ImageToImageFilterType::Pointer pp1 = static_cast<ImageToImageFilterType::Pointer>(pp0);<br>
<br>where the function 'comare.getIntensityRescaler()' returns a RescalerType::Pointer. But the line:<br><br> ImageToImageFilterType::Pointer pp1 = static_cast<ImageToImageFilterType::Pointer>(pp0);<br><br>
gives the error:<br><br>cannot convert from 'itk::SmartPointer<TObjectType>' to 'itk::SmartPointer<TObjectType>' <br><br>But as I understand ImageToImageFilter is a base class for RescaleIntensityImageFilter so I don't see why I get this error, but maybe my C++ skills are a bit rusty.<br>