<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<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="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 '=' : 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="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>