Prathamesh:<br><br>As the error indicates, the itk::VTKImageToImageFilter's GetOutput() method returns a const image. So try :<br><br> ImageType::ConstPointer itk_image = VTK_to_ITK_filter->GetOutput();<br><br>instead.<br>
<div dir="ltr"></div><br><br>--<br>karthik<br><br><div class="gmail_quote">On Fri, Jul 30, 2010 at 11:16 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@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;"><div dir="ltr"><br>Hello ITK users, <br><br>I am have started to use ITK a few days ago! <br>
<br>I am having trouble with converting vtkImageData to itkImage. The previous posts on the list did not help me. Following is my code for converting vtkImage to itkImage:<br>
<div class="gmail_quote"><div dir="ltr"><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">
<br> typedef itk::Image<unsigned char, 2> ImageType;<br>
<br> typedef itk::VTKImageToImageFilter<ImageType> VTKToITKConnector;<br> VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br> <br> <br> VTK_to_ITK_filter->SetInput(vtkImageData); //vtkImageData is unsigned char and single channel<br>
VTK_to_ITK_filter->Update();<br><br> ImageType::Pointer itk_image = VTK_to_ITK_filter->GetOutput(); //THIS LINE GIVES THE ERROR SHOWN BELOW<br><br><br> //itk::SmartPointer<ImageType> itk_image = VTK_to_ITK_filter->GetOutput();<br>
<br></div></blockquote><div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br>
Could you please point me out to what I am doing wrong? I could so a speckle noise simulation from an image read from the disk, but I am not able to do the same on a vtkImageData.<br><br>Any help will be highly appreciated.<br>
<br>
Thanks,<br><font color="#888888">Prathamesh</font></div></blockquote><div><br>ERROR: <br></div><div>error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'const itk::Image<TPixel,<div dir="ltr">VImageDimension> *'
(or there is no acceptable conversion)<br>
1> with<br>1> [<br>1> TPixel=unsigned
char,<br>1> VImageDimension=2<br>1> ]<br>1>
c:\itk\insighttoolkit-3.18.0\insighttoolkit-3.18.0\code\common\itkSmartPointer.h(112):
could be 'itk::SmartPointer<TObjectType>
&itk::SmartPointer<TObjectType>::operator =(const
itk::SmartPointer<TObjectType> &)'<br>
1> with<br>1> [<br>1>
TObjectType=itk::Image<unsigned char,2><br>1> ]<br>1>
c:\itk\insighttoolkit-3.18.0\insighttoolkit-3.18.0\code\common\itkSmartPointer.h(116):
or 'itk::SmartPointer<TObjectType>
&itk::SmartPointer<TObjectType>::operator
=(itk::Image<TPixel,VImageDimension> *)'<br>
1> with<br>1> [<br>1>
TObjectType=itk::Image<unsigned char,2>,<br>1>
TPixel=unsigned char,<br>1> VImageDimension=2<br>1>
]<br>1> while trying to match the argument list
'(itk::SmartPointer<TObjectType>, const itk::Image<TPixel,VImageDimension>
*)'<br>
1> with<br>1> [<br>1>
TObjectType=itk::Image<unsigned char,2><br>1> ]<br>1>
and<br>1> [<br>1> TPixel=unsigned char,<br>1>
VImageDimension=2<br>
1> ]</div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><div><div> <br></div></div></div>
</blockquote></div><br></div></div></div>
</div><br></div>
<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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<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>