<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="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr"><div><div> <br></div></div></div>
</blockquote></div><br></div></div></div>
</div><br></div>