Hi Motes,<br><br>1) Please post the declaration of the function<br><br>           compare.getIntensityRescaler();<br><br>2)  You may want to try returning a raw pointer <br>      from the function instead of a SmartPointer<br>
    unless the Filter is  being created in that function<br>    and it is not a member variable.<br><br><br>3) Just out of curiosity,..... <br>     why are you returning a filter from a function ?<br><br>     It doesn&#39;t seem to be a common use case.<br>
<br><br>    Regards,<br><br><br>          Luis<br><br><br><br>---------------------------------<br><div class="gmail_quote">On Sat, Jun 20, 2009 at 8:38 PM, motes motes <span dir="ltr">&lt;<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am trying to cast a RescaleIntensityImageFilter to an ImageToImageFilter:<br><br>    static const unsigned int Dimension = 2;<br>
    typedef float PixelType;<br>    typedef itk::Image&lt; PixelType, Dimension &gt;                                                                                FixedImageType;<br>
    typedef itk::Image&lt; PixelType, Dimension &gt;                                                                                MovingImageType;<br>    typedef unsigned char                                                                                                                            OutputPixelType;<br>

    typedef itk::Image&lt; OutputPixelType, Dimension &gt;                                                                    OutputImageType;<br>    typedef itk::ImageToImageFilter&lt;MovingImageType, FixedImageType&gt;                                  ImageToImageFilterType;<br>

    typedef itk::RescaleIntensityImageFilter&lt;FixedImageType, OutputImageType &gt;                RescalerType;<br><br>    RescalerType::Pointer pp0 = compare.getIntensityRescaler();<br>    ImageToImageFilterType::Pointer pp1 = static_cast&lt;ImageToImageFilterType::Pointer&gt;(pp0);<br>

<br>where the function &#39;comare.getIntensityRescaler()&#39; returns a RescalerType::Pointer. But the line:<br><br>    ImageToImageFilterType::Pointer pp1 = static_cast&lt;ImageToImageFilterType::Pointer&gt;(pp0);<br><br>

gives the error:<br><br>cannot convert from &#39;itk::SmartPointer&lt;TObjectType&gt;&#39; to &#39;itk::SmartPointer&lt;TObjectType&gt;&#39;   <br><br>But as I understand ImageToImageFilter is a base class for RescaleIntensityImageFilter so I don&#39;t see why I get this error, but maybe my C++ skills are a bit rusty.<br>

<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>