Hi all,<br><br>Sorry been bugging this list with questions today but just started out with ITK and am having some troubles...<br><br>I have a class which has a member of itk::ProcessObject::Pointer type (m_extractImageFilter).<br>
<br>Now, at some point it gets set to an itk::ExtractImageFilterType as follows:<br><br>typedef typename itk::ExtractImageFilter<InputImageType, OutputImageType> ExtractImageFilterType;<br>typedef typename ExtractImageFilterType::Pointer ExtractImageFilterTypePointer;<br>
ExtractImageFilterTypePointer extractImageFilter = ExtractImageFilterType::New(); <br>m_extractImageFilter = extractImageFilter;<br><br>Now again, at some point in the code, I want to cast it back and I try to do the following:<br>
<br>typedef typename itk::ExtractImageFilter<InputImageType, OutputImageType> ExtractImageFilterType;<br>typedef typename ExtractImageFilterType::Pointer ExtractImageFilterTypePointer;<br>ExtractImageFilterTypePointer extractImageFilter = dynamic_cast<ExtractImageFilterTypePointer>(m_extractImageFilter);<br>
<br>The last line however fails with the following error:<br><br>error: cannot dynamic_cast '((ITK2VTK*)this)->ITK2VTK::m_extractImageFilter' (of type 'class itk::SmartPointer<itk::ProcessObject>') to type 'class itk::SmartPointer<itk::ExtractImageFilter<itk::Image<double, 4u>, itk::Image<double, 3u> > >' (target is not pointer or reference)<br clear="all">
<br>Any ideas how I might safely do this?<br><br>Cheers,<br><br>Anja