Prathamesh:<br><br>As the error indicates, the itk::VTKImageToImageFilter&#39;s GetOutput() method returns a const image. So try :<br><br>  ImageType::ConstPointer itk_image = VTK_to_ITK_filter-&gt;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">&lt;<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@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;"><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&lt;unsigned char, 2&gt; ImageType;<br>
<br>    typedef itk::VTKImageToImageFilter&lt;ImageType&gt; VTKToITKConnector;<br>    VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br>    <br>      <br>    VTK_to_ITK_filter-&gt;SetInput(vtkImageData); //vtkImageData is unsigned char and single channel<br>




    VTK_to_ITK_filter-&gt;Update();<br><br>    ImageType::Pointer itk_image = VTK_to_ITK_filter-&gt;GetOutput(); //THIS LINE  GIVES THE ERROR SHOWN BELOW<br><br><br>    //itk::SmartPointer&lt;ImageType&gt; itk_image = VTK_to_ITK_filter-&gt;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 &#39;=&#39; : no operator found which takes a right-hand 
operand of type &#39;const itk::Image&lt;TPixel,<div dir="ltr">VImageDimension&gt; *&#39; 
(or there is no acceptable conversion)<br>
1&gt;        with<br>1&gt;        [<br>1&gt;            TPixel=unsigned 
char,<br>1&gt;            VImageDimension=2<br>1&gt;        ]<br>1&gt;       
 c:\itk\insighttoolkit-3.18.0\insighttoolkit-3.18.0\code\common\itkSmartPointer.h(112):
 could be &#39;itk::SmartPointer&lt;TObjectType&gt; 
&amp;itk::SmartPointer&lt;TObjectType&gt;::operator =(const 
itk::SmartPointer&lt;TObjectType&gt; &amp;)&#39;<br>
1&gt;        with<br>1&gt;        [<br>1&gt;            
TObjectType=itk::Image&lt;unsigned char,2&gt;<br>1&gt;        ]<br>1&gt;       
 c:\itk\insighttoolkit-3.18.0\insighttoolkit-3.18.0\code\common\itkSmartPointer.h(116):
 or       &#39;itk::SmartPointer&lt;TObjectType&gt; 
&amp;itk::SmartPointer&lt;TObjectType&gt;::operator 
=(itk::Image&lt;TPixel,VImageDimension&gt; *)&#39;<br>
1&gt;        with<br>1&gt;        [<br>1&gt;            
TObjectType=itk::Image&lt;unsigned char,2&gt;,<br>1&gt;            
TPixel=unsigned char,<br>1&gt;            VImageDimension=2<br>1&gt;       
 ]<br>1&gt;        while trying to match the argument list 
&#39;(itk::SmartPointer&lt;TObjectType&gt;, const itk::Image&lt;TPixel,VImageDimension&gt;
 *)&#39;<br>
1&gt;        with<br>1&gt;        [<br>1&gt;            
TObjectType=itk::Image&lt;unsigned char,2&gt;<br>1&gt;        ]<br>1&gt;       
 and<br>1&gt;        [<br>1&gt;            TPixel=unsigned char,<br>1&gt;           
 VImageDimension=2<br>
1&gt;        ]</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>