[Insight-developers] Downcasting smartpointers

Antonin Perrot-Audet antonin07130 at gmail.com
Mon Aug 30 13:33:08 EDT 2010


  Hello,
I am trying to cast a processObject to an itkfilter, and couldn't manage 
to, here is the type of conversion I try to perform :

typedef itk::ImageToVTKImageFilter<InputImageType>::Pointer  
itkFilterPointerType;
typedef itk::ProcessObject::Pointer itkProcessObjectPointerType;

itkProcessObjectPointerType m_filter = itkFilterPointerType::New();

( dynamic_cast<itkFilterPointerType>(itkFilterPointerType) 
)->SetInput(..etc...etc...



I get this error :
error: cannot dynamic_cast 
'((QGoSynchronizedView2D*)this)->QGoSynchronizedView2D::m_itkvtkConnector' 
(of type 'class itk::SmartPointer<itk::ProcessObject>') to type 'class 
itk::SmartPointer<itk::ImageToVTKImageFilter<itk::Image<double, 2u> > >' 
(target is not pointer or reference)

I also tried with a static cast, and got this error :
invalid conversion from 'itk::ProcessObject*' to 
'itk::ImageToVTKImageFilter<itk::Image<double, 2u> >*'

I even tried with a (bad) good old C cast, and got :
invalid conversion from 'itk::ProcessObject*' to 
'itk::ImageToVTKImageFilter<itk::Image<double, 2u> >*'

How can I downcast such filter ?
Thanks a lot !


Anto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100830/20c9b5cd/attachment.htm>


More information about the Insight-developers mailing list