[Insight-users] Can't cast RescaleIntensityImageFilter to ImageToImageFilter ?

motes motes mort.motes at gmail.com
Sat Jun 20 20:38:48 EDT 2009


I am trying to cast a RescaleIntensityImageFilter to an ImageToImageFilter:

    static const unsigned int Dimension = 2;
    typedef float PixelType;
    typedef itk::Image< PixelType, Dimension >
                                                    FixedImageType;
    typedef itk::Image< PixelType, Dimension >
                                                    MovingImageType;
    typedef unsigned char

OutputPixelType;
    typedef itk::Image< OutputPixelType, Dimension >
                                            OutputImageType;
    typedef itk::ImageToImageFilter<MovingImageType, FixedImageType>
                          ImageToImageFilterType;
    typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType
>                RescalerType;

    RescalerType::Pointer pp0 = compare.getIntensityRescaler();
    ImageToImageFilterType::Pointer pp1 =
static_cast<ImageToImageFilterType::Pointer>(pp0);

where the function 'comare.getIntensityRescaler()' returns a
RescalerType::Pointer. But the line:

    ImageToImageFilterType::Pointer pp1 =
static_cast<ImageToImageFilterType::Pointer>(pp0);

gives the error:

cannot convert from 'itk::SmartPointer<TObjectType>' to
'itk::SmartPointer<TObjectType>'

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090621/07f3e797/attachment.htm>


More information about the Insight-users mailing list