2016-11-28 4 views
0

Я использую ITK. itk::LinearInterpolateImageFunction является подклассом itk::InterpolateImageFunction.Объявление абстрактного типа C++

Почему данные ниже не действительны?

itk::InterpolateImageFunction<ImageType,double>::Pointer interpolator = itk::LinearInterpolateImageFunction<ImageType, double>::New(); 

Ошибки я получаю

error: conversion from itk::LinearInterpolateImageFunction<itk::Image<unsigned char, 3u>, double>::Pointer {aka itk::SmartPointer<itk::LinearInterpolateImageFunction<itk::Image<unsigned char, 3u>, double> >} to non-scalar type itk::InterpolateImageFunction<itk::Image<unsigned char, 3u>, double>::Pointer {aka itk::SmartPointer<itk::InterpolateImageFunction<itk::Image<unsigned char, 3u>, double> >} requested

ответ

4

InterpolateImageFunction::Pointer ЬурейеЕ является SmartPointer<InterpolateImageFunction>. В отличие от std::shared_ptr, itk::SmartPointer не поддерживает преобразования между интеллектуальными указателями связанных типов. То есть InterpolateImageFunction<X,Y>::Pointer и LinearInterpolateImageFunction<X,Y>::Pointer являются несвязанными типами.

Смежные вопросы