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'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"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></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< PixelType, Dimension > FixedImageType;<br>
typedef itk::Image< PixelType, Dimension > MovingImageType;<br> typedef unsigned char OutputPixelType;<br>
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br> typedef itk::ImageToImageFilter<MovingImageType, FixedImageType> ImageToImageFilterType;<br>
typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType > RescalerType;<br><br> RescalerType::Pointer pp0 = compare.getIntensityRescaler();<br> ImageToImageFilterType::Pointer pp1 = static_cast<ImageToImageFilterType::Pointer>(pp0);<br>
<br>where the function 'comare.getIntensityRescaler()' returns a RescalerType::Pointer. But the line:<br><br> ImageToImageFilterType::Pointer pp1 = static_cast<ImageToImageFilterType::Pointer>(pp0);<br><br>
gives the error:<br><br>cannot convert from 'itk::SmartPointer<TObjectType>' to 'itk::SmartPointer<TObjectType>' <br><br>But as I understand ImageToImageFilter is a base class for RescaleIntensityImageFilter so I don'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>