Quantcast

How to get the pixels of a volume rendered image?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to get the pixels of a volume rendered image?

Wilf Rosenbaum
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the pixels of a volume rendered image?

Sankhesh Jhaveri-2

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 <[hidden email]> 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 | (518) 881-4417

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the pixels of a volume rendered image?

Wilf Rosenbaum
Hi Sankhesh, 
  Thanks so much! I tried your suggestion and it worked just fine. I really appreciate you taking the time to answer my question. 
Cheers, 
Wilf. 

On Mon, Mar 20, 2017 at 1:47 PM, Sankhesh Jhaveri <[hidden email]> wrote:

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 <[hidden email]> 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 | <a href="tel:(518)%20881-4417" value="+15188814417" target="_blank">(518) 881-4417


_______________________________________________
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
Loading...