[vtkusers] Problem to crop an image

Adrian Wyssmann wyssa1 at hta-bi.bfh.ch
Fri Nov 26 09:45:47 EST 2004


I found a solution: I use a vtkImageClip. With the function
SetOutputWholeExtent() I can set the extent of the output image. That's all
I want :-)

Adrian 

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Adrian Wyssmann
Sent: Donnerstag, 25. November 2004 19:09
To: 'Charles Boivin'; vtkusers at vtk.org
Subject: RE: [vtkusers] Problem to crop an image

Hello Charles

Unfortunately it doesn't solve my problem. Well, the output is ever as
expected for the whole image (content of the renderWindow), also without
vtkWindowToImageFilter::Modified(). I tried it with
vtkWindowToImageFilter::Modified() but again the whole image was saved.

But thanks

P.S. Saving of the file .... pImageData is the OutputData of the
pWindowToImageFilter ...
else if (strTemp.Right(4) == ".bmp")
{
	vtkBMPWriter *writer = vtkBMPWriter::New();
	writer->AddObserver(vtkCommand::ErrorEvent, pO3DvtkCallbackMsg);
	writer->AddObserver(vtkCommand::WarningEvent, pO3DvtkCallbackMsg);
	writer->SetInput(pImageData);
	writer->SetFileName(strFile);
	writer->Write();
	writer->Delete();
}




-----Original Message-----
From: Charles Boivin [mailto:cb at rwdi.com]
Sent: Donnerstag, 25. November 2004 18:47
To: wyssa1 at hta-bi.bfh.ch; vtkusers at vtk.org
Subject: Re: [vtkusers] Problem to crop an image

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



_______________________________________________
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