[Insight-developers] Downcasting smartpointers

Matthew McCormick (thewtex) matt at mmmccormick.com
Mon Aug 30 13:45:19 EDT 2010


Hey Antonin

On Mon, Aug 30, 2010 at 12:33 PM, Antonin Perrot-Audet <
antonin07130 at gmail.com> wrote:

>  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...
>
>
How about this:
 ( dynamic_cast<itkFilterPointerType>(m_filter.GetPointer())
)->SetInput(..etc...etc...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100830/fdc0ebc8/attachment.htm>


More information about the Insight-developers mailing list