[vtkusers] How to handle vtkWindowToImageFilter

rchqh at polyu.edu.hk rchqh at polyu.edu.hk
Fri Jul 25 03:30:39 EDT 2003


Dear all,

 I am programming with VTK 4.0 using VC++.I intend to generate an AVI with
respect to the motion of a vtkVolume.To record each frame of the
vtkRenderWindow, I used vtkWindowToImageFilter to copy the image of the
renderwindow to a vtkImagedata. The method used in my software is showed as
following:

 vtkRenderWindow *renWin = vtkRenderWindow::New();
 vtkWindowToImageFilter *wToImg = vtkWindowToImageFilter::New();
 vtkImageData *id = vtkImagedata::New();
 for(i=0;i<nIndex;i++)
 {
     ........//translate or rotate the 3D actor
     renWin->Render();
     wToImg->SetInput(renWin);
     wToImg->Update();
     wToImg->SetOutput(id);
     ........//transfer the scalars of id to a buffer
 }

 However, the vtkWindowToImageFilter can only capture the first scene of the
window without other consequent images. I found that vtkWindowToImageFilter
could not detect the modification of the renderwindow, since the
renderwindow didn't modify its interior time. I wonder how to capture all
images using tkWindowToImageFilter.Can anyone help me with this problem?
Any help or advice is appreciated.

 QH





More information about the vtkusers mailing list