[vtkusers] Problem to crop an image

Charles Boivin cb at rwdi.com
Thu Nov 25 12:46:48 EST 2004


Hello Adrian,

There is this warning in the documentation regarding
vtkWindowToImageFilter...

***

Warning:
    A vtkWindow doesn't behave like other parts of the VTK pipeline:
its modification time doesn't get updated when an image is rendered. As
a result, naive use of vtkWindowToImageFilter will produce an image of
the first image that the window rendered, but which is never updated on
subsequent window updates. This behavior is unexpected and in general
undesirable.

    To force an update of the output image, call
vtkWindowToImageFilter's Modified method after rendering to the window.

***

... I don't know if this applies to you, but are you calling the
vtkWindowToImageFilter::Modified() function before you try to save to a
file? I ran into that problem when I was trying to dump stuff out with
that filter for the first time.

Hope that helps,

Charles

>>> wyssa1 <wyssa1 at hta-bi.bfh.ch> 11/25/04 10:26am >>>
Hello

I get the RenderWindow and set it as Input of a vtkWindowToImageFilter.
 
Now I want to get only a Portion of the hole image. I do this by the 2 

functions SetUpdateExtent() and Crop(). Then I save the Data (bmp or
jpg).  
But that doesn't work as excpeted: I want to save only that new extent
and  
not the whole image. What I'm doing wrong?

pWindowToImageFilter->SetInput(m_pRenderWindow);
pWindowToImageFilter->GetOutput()->SetUpdateExtent(0, 10, 0, 10, 0,
0);
pWindowToImageFilter->GetOutput()->Crop();
SaveImageData(pWindowToImageFilter->GetOutput(), strFilename);


Adrian
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ 
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list