[vtkusers] Generate 2D views (store them as images) from 3D models
Aitor Aldomà
aldoma.aitor at gmail.com
Wed Jul 7 07:36:03 EDT 2010
Hi everybody,
I want to generate 2D views of a 3D model and save them as jpeg image. At
the moment, I am using vtkWindowToImageFilter to obtain the generated view
from a RenderWindow. The problem is that I dont want to display the window
on the screen, just wan the RenderWindow to render the view and store the
result with vtkWindow without showing the window.
This is part of the code i am using now, the problem is that the window will
flash for a short time and then disapper. Is there a way to render the view
without being displayed on the screen???
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
ren.SetBackground(1, 1, 1)
renWin.SetSize(128,128)
ren.Render()
winToImageFilter = vtk.vtkWindowToImageFilter()
winToImageFilter.SetInput(renWin);
renWin.Finalize()
winToImageFilter.Update()
jw = vtk.vtkJPEGWriter();
jw.SetInput(winToImageFilter.GetOutput());
jw.SetFileName(fileName + ".jpg");
jw.Write();
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100707/affa0cf8/attachment.htm>
More information about the vtkusers
mailing list