[Insight-users] casting from void* to itk::Image
Karthik Krishnan
karthik.krishnan at kitware.com
Fri Jan 7 12:44:54 EST 2011
Navneeth:
You can't cast to a smart pointer like that. Use a raw pointer for casting
and then assign it to a smart pointer ...
void myFunction(void* userData)
{
ImageType *image = reinterpret_cast< ImageType* >(userData);
ImageType::Pointer myImage = image;
}
...
int main(int argc, char *argv[])
{
ImageType::Pointer image = reader->GetOutput();
myFunction( image.GetPointer() );
}
On Fri, Jan 7, 2011 at 8:50 PM, David Doria <daviddoria at gmail.com> wrote:
> On Fri, Jan 7, 2011 at 10:11 AM, Navneeth Subramanian
> <navneeth.s at gmail.com> wrote:
> > Hi,
> >
> > I am trying to cast some user data (void*) into an itk image as in the
> code
> > below:
>
> I think you need to use the ImportImageFilter:
> http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter
>
> David
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110107/12a2feed/attachment.htm>
More information about the Insight-users
mailing list