[vtkusers] Output lost in vtkPolyDataToPolyDataFilter !

Amy Henderson amy.henderson at kitware.com
Mon Nov 1 10:51:31 EST 2004


At 10:42 AM 11/1/2004, Klaus Kesseler wrote:
>Hi Mailinglist,
>
>i'm new to vtk and i have to questions:
>
>----------------------------------------------------
>
>1.)
>
>I want to use the vtkDecimatePro class to reduce some meshes, but the 
>problems i describe seem to happen with all childs of 
>'vtkPolyDataToPolyDataFilter'.
>The filter, used like in the following code seems to work if i use it in 
>the built in vtk renderer. But if i try to export the (triangle) data, vtk 
>tells me that after filtering my vtkPolyData Object (polydata) is empty:
>
>
>this is the code fragment, where it happens:
>
>         cout << polydata->GetNumberOfCells(); // e.g. == 4
>
>         vtkDecimatePro * filter = vtkDecimatePro::New();
>         filter->SetInput(polydata);
>         filter->SetMaximumError(0);
>         filter->SetTargetReduction(1);
>         polydata = (vtkPolyData*) filter->GetOutput();
>
>         cout << polydata->GetNumberOfCells(); // alway == 0;
>

You need to call Update() on the filter before you try to access its 
output. This is true of all filters, sources, and readers in VTK. In the 
process of rendering (with VTK's built-in rendering), Update() is called 
for you on the pipeline, but if you're not using this portion of VTK, 
you'll need to call Update() yourself on the last filter in your 
visualization pipeline.

- Amy 






More information about the vtkusers mailing list