[Insight-users] pointer to image data

David Doria daviddoria at gmail.com
Mon Jul 18 16:48:19 EDT 2011


On Mon, Jul 18, 2011 at 4:44 PM, barbababa <tonimuusimaki at gmail.com> wrote:

>
> Hello all,
>
> i can assign a pointer to my image data as follows:
>
> float *img_data     = reinterpret_cast<float *>(
> img.get_image_data().get_data() );
>
> Now how could i define an ITK image, which points to this same data?
> This works at build time but not on runtime:
>
> typedef itk::Image&lt;float, 2&gt; ImageType;
> ImageType *image =  reinterpret_cast&lt;ImageType*&gt;(
> img.get_image_data().get_data() );
> ImageType::Pointer myImage = image;
>
> I think the problem is in the &lt;ImageType*&gt; but i don't know how to
> get
> past it!
>
> Any Ideas?
>
> Thanks!
>

I think you are supposed to use this:
http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110718/d4794e7d/attachment.htm>


More information about the Insight-users mailing list