[vtkusers] vtkContourFilter issue
David Doria
daviddoria+vtk at gmail.com
Wed Dec 9 10:17:11 EST 2009
On Wed, Dec 9, 2009 at 10:04 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> You need to set the value to be extracted by the contour filter. You
> also need to Update() the contour filter before requesting its output.
>
> Or, did you just leave out those in your e-mail?
Francois,
Good point, that would have been a bug in my algorithm, but it
shouldn't prevent SOMETHING from happening (i.e. not producing a
PolyData with 0 points and cells).
Bill,
Yes, sorry I omitted that part:
vtkSmartPointer<vtkContourFilter> contourFilter =
vtkSmartPointer<vtkContourFilter>::New();
contourFilter->SetValue(0, 0); // the 0th contour should be the 0 contour
contourFilter->SetInput(grid);
contourFilter->Update();
vtkPolyData* surface = contourFilter->GetOutput();
vtkstd::cout << "Number of points: " <<
surface->GetNumberOfPoints() << vtkstd::endl;
vtkstd::cout << "Number of cells: " << surface->GetNumberOfCells()
<< vtkstd::endl;
Number of points: 0
Number of cells: 0
I checked that the values of 'd' that are being set in:
grid->SetScalarComponentFromDouble(x,y,z,0,d);
are valid and they are.
Any other thoughts?
Thanks,
David
More information about the vtkusers
mailing list