[vtkusers] How to get the pixels of a volume rendered image?

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Mon Mar 20 16:47:20 EDT 2017


Hello Wilf,

If you use the vtkGPUVolumeRayCastMapper, you can enable the RenderToImage
mode that basically renders the volume to an OpenGL FrameBufferObject. It
then has API like GetColorImage() and GetDepthImage() to get the color and
depth data of the rendered result.

Hope this helps.

Thanks,
Sankhesh
​

On Mon, Mar 20, 2017 at 11:36 AM Wilf Rosenbaum <wilf.rosenbaum at gmail.com>
wrote:

> Hi Guys,
>   VTK noob here. Ignorant, but (hopefully) not stoopid.
>
>   I am interested in creating a volume rendering (VR) of a volumetric
> medical (CT) dataset, and then getting access to the pixel values of that
> volume rendering image. I can follow along with the SmartVolumeMapper
> example from the VTK examples website, which creates the VR for my dataset
> but displays the result in a vtkRenderWindow. Right now I don't want to
> display the VR image, I just want to get the pixel values and do something
> with them - pass them to a 3rd party program for instance. I understand
> that I could use a vtkWindowToImageFilter to convert the data in my
> RenderWindow to an image, but intuitively this seems like a rather
> circuitous route to get what I want. I suspect that there is a more direct
> standard vtk workflow.
>
>   I know that if I was interested in an orthogonal or an oblique slab
> through my volume I can create a pipeline like
>
>      vtkDicomImageReader -> vtkImageReslice -> vtkImageMapToColors
>
> and then call GetOutput() -> GetScalarPointer() on the vtkImageMapToColors
> object to get the pixels of the slab - no RenderWindow is required. Is
> there something analogous for volume rendering?
>
> If the real answer to my question is "create a hidden render window,
> render the volume into that hidden render window and then use a Window to
> Image Filter to get the image" then I am fine with that but I feel like I
> don't know enough about VTK yet to know for sure.
>
> Finally, please free to suggest some terms to google. I am happy to do
> more research, but I feel like I need to be pointed in the right direction.
> I am already looking into "vtk render to frame buffer" , "vtk render to
> image", "vtk offscreen rendering", ...
>
> Thanks very much!
> Cheers,
> Wilf
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-- 
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170320/e1ce31d3/attachment.html>


More information about the vtkusers mailing list