Thanks guys!<br><br><div><span class="gmail_quote">On 25/02/2008, <b class="gmail_sendername">Tomáš Kazmar</b> <<a href="mailto:Tomash.Kazmar@seznam.cz">Tomash.Kazmar@seznam.cz</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br> <br> try to cast the actual pointer (not the smart pointer), like this:<br> <br> ExtractImageFilterTypePointer extractImageFilter<br> <br> = dynamic_cast<ExtractImageFilterType *>(m_extractImageFilter.GetPointer());<br>
<br> <br>Tomas<br> <br> # Hi all,<br> <br>#<br> # Sorry been bugging this list with questions today but just started out with<br> # ITK and am having some troubles...<br> #<br> # I have a class which has a member of itk::ProcessObject::Pointer type<br>
# (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><br> # ExtractImageFilterType;<br>
# typedef typename ExtractImageFilterType::Pointer<br> # ExtractImageFilterTypePointer;<br> # ExtractImageFilterTypePointer extractImageFilter =<br> # 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<br> # the following:<br> #<br> # typedef typename itk::ExtractImageFilter<InputImageType, OutputImageType><br> # ExtractImageFilterType;<br>
# typedef typename ExtractImageFilterType::Pointer<br> # ExtractImageFilterTypePointer;<br> # ExtractImageFilterTypePointer extractImageFilter =<br> # 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'<br> # (of type 'class itk::SmartPointer<itk::ProcessObject>') to type 'class<br>
# itk::SmartPointer<itk::ExtractImageFilter<itk::Image<double, 4u>,<br> # itk::Image<double, 3u> > >' (target is not pointer or reference)<br> #<br> # Any ideas how I might safely do this?<br>
#<br> # Cheers,<br> #<br> # Anja<br> <br>#<br> #<br> #<br> </blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br><br>Anja