[vtkusers] vtkRenderWindow contents to ppm

Will Schroeder will.schroeder at kitware.com
Wed Mar 6 16:31:39 EST 2002


Hi Dean-

At 03:02 PM 3/6/2002 -0800, Dean Inglis wrote:
>Hi,
>
>RenderWindows used to be able to do this:
>
>   iren->SetUserMethod(&fn,(void*)renWin);
>
>void fn(void *ren)
>{
>  ((vtkWin32OpenGLRenderWindow *)ren)->SetFileName("scrdump.ppm");
>  ((vtkWin32OpenGLRenderWindow *)ren)->SaveImageAsPPM();
>}
>
>which now is in vtkImageWindow.  How can I do this with a 3D image from a
>vtkRenderWindow?


This functionality has been deprecated in favor of using 
vtkWindowToImageFilter to grab the render window contents, and then using 
vtkTIFFWriter, vtkJPEGWriter, etc. to actually write the file.

Something like:

vtkWindowToImageFilter wif
   wif SetWindow renWin
vtkTIFFWriter w
   w SetInput [wif GetOutput]
   w SetFileName my.tif
   w Write

cleaner, more flexible and consistent.

Will


William J. Schroeder, Ph.D
Kitware, Inc.
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 x102
1-518-371-3971 (fax)




More information about the vtkusers mailing list