Filter to Data newbie question

Vetle Roeim vetler at ifi.uio.no
Thu Mar 2 02:31:05 EST 2000


on 2000-03-01, owner-vtkusers at public.kitware.com wrote:

> How does one obtain data from a filter, or make the filter execute
> such that a concrete object is instantiated and data can be obtained.
> 
> I have the output from vtkContourFilter and I would like to retrieve all
> the vertices and polygons.  I have tried to do
> 
> vtkPolyData *pd = contourfilter->GetOutput( );
> 
> and then 
> 
> vtkCellArray *verts = pd->GetVerts( );
> cerr << verts->GetNumberOfCells( ) << endl;
> vtkCellArray *polys = pd->GetPolys( );
> cerr << polys->GetNumberOfCells( ) << endl;
> 
> But the number of verts and polys is always zero.

You have to make the vtkContourFilter generate contours. It does not do
that automatically.

>From the documentation:

  ``To use this filter you must specify one or more contour values. You
    can either use the method SetValue() to specify each contour value, or
    use GenerateValues() to generate a series of evenly spaced contours.''


vr

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list