Hi,<br><br>I am trying to cast some user data (void*) into an itk image as in the code below:<br><br>~~~~~~~~~~~~~~~<br>#include "itkImage.h"<br><br>typedef itk::Image<unsigned char, 2> ImageType;<br><br>void myFunction(void* userData)<br>
{<br> ImageType::Pointer myImage = reinterpret_cast< ImageType::Pointer >(userData);<br>}<br><br>int main(int argc, char *argv[])<br>{<br> typedef itk::ImageFileReader<ImageType> ReaderType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName(argv[1]);<br><br> reader->Update();<br> ImageType::Pointer image = reader->GetOutput();<br><br> myFunction( image );<br><br> return EXIT_SUCCESS;<br>}<br><br>~~~~~~~~~~~~~~~~~~<br>However i keep running into this compile error:<br>
<br>1>d:\dev\src\ : error C2440: 'reinterpret_cast' : cannot convert from 'void *' to 'itk::SmartPointer<TObjectType>'<br>1> with<br>1> [<br>1> TObjectType=itk::Image<unsigned char,2><br>
1> ]<br>1> Conversion requires a constructor or user-defined-conversion operator, which can't be used by const_cast or reinterpret_cast<br><br>Any idea what I am doing wrong ?<br><br>many thanks,<br>
navneeth<br>