[Insight-users] How t oextract a pointer to ITK image data

Prename Surname bsd.diverse at gmail.com
Sun Oct 29 07:53:49 EST 2006


Thank you Luis.
The image->GetBufferPointer(); was just what i needed...it seems to be
working quite alright now.

Regards


2006/10/28, Luis Ibanez <luis.ibanez at kitware.com>:
>
>
> Hi Prename Surname,
>
>
>
>        Yes, We have done this before.
>
>
>
> You should look at the examples of the VolView Plugins.
>
>
> They are in the directory:
>
>
>     InsightApplications/VolviewPlugins
>
>
> The plugins are built in DLLs and VolView invoke them
> to perform processing in the images.
>
>
>
> What you must respect is:
>
>
>    A) Memory allocated in your program
>       *MUST NOT* be released by the DLL.
>
>
>    B) Memory allocated in the DLL
>       *MUST NOT* be released by the program
>
>
>
> If you are doing the rendering in your DLL, one easy
> thing to do is to pass to it the pointer of the pixel
> data
>
>            image->GetBufferPointer();
>
>
> and the metadata of
>
>      a) number of pixels
>      b) pixel spacing
>      c) image origin
>
> With this information you can in your DLL use the
> vtkImageImport filter in order to create a vtkImageData
> that you can pass to your rendering pipeline.
>
>
>
>         Please read the Tutorials.
>
>
>
> The describe things that you have to
> do in this case anyways.
>
> In particular, they describe how to prevent
> the VTK import filter from releasing the memory
> that you passed to it.
>
>
>
>     Regards,
>
>
>        Luis
>
>
>
> ------------------------
> Prename Surname wrote:
> > But the problem is that my rendering is in a dll.
> > I mean i can convert an ITK image to a vtk image no problem, but the
> > problem is that the vtkimage is to be used in a dll.
> > So i am trying to do the following
> >
> > ITK -> convert and transfer to DLL -> VTK
> >
> > Theoretically it should not pose a problem, but did anyone do this
> before?
> > Regards
> >
> >
> > 2006/10/28, Luis Ibanez <luis.ibanez at kitware.com
> > <mailto:luis.ibanez at kitware.com>>:
> >
> >
> >     Hi Prename Surname,
> >
> >     Please read the Tutorials:
> >
> >        http://www.itk.org/HTML/Tutorials.htm
> >
> >     In particular:
> >
> >        "Getting Started II: Using ITK with VTK"
> >     http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf
> >     <http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf>
> >
> >     and
> >
> >        "Getting Started V: Integrating ITK in your Application."
> >     http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf
> >     <http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf>
> >
> >
> >     The first one describes how to convert ITK images into VTK images.
> >
> >     You will find examples in the directory:
> >
> >           InsightApplications/Auxiliary/vtk/
> >
> >     itkReadITKImage3DSegmentShowVTK.cxx
> >     itkReadITKImageSegmentShowVTK.cxx
> >     itkReadITKImageShowSplineVTK.cxx
> >     itkReadITKImageShowVTK.cxx
> >
> >
> >     The second one describes multiple options for passing ITK image
> >     data to and from applications that use pointers to the pixel
> >     buffer.
> >
> >
> >     Please not that you must make sure that the memory is relased
> >     correctly once you are done with the image.
> >
> >
> >        Regards,
> >
> >
> >          Luis
> >
> >
> >     ----------------------------
> >     Prename Surname wrote:
> >      > Hello. I have an itk::Image objekt where i want to be able to get
> a
> >      > pointer to the data, so that i can send this pointer as a
> >     parameter to
> >      > my dll function, which
> >      > implements rendering using VTK.
> >      >
> >      > The only problem is how i can transport the data, and it seems
> that a
> >      > raw datapointer is the best solution.
> >      >
> >      > How can i retrieve that?
> >      > Many regards
> >      >
> >      >
> >      >
> >
> ------------------------------------------------------------------------
> >
> >      >
> >      > _______________________________________________
> >      > Insight-users mailing list
> >      > Insight-users at itk.org <mailto:Insight-users at itk.org>
> >      > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061029/5097dac2/attachment.htm


More information about the Insight-users mailing list