[vtkusers] Points and Contour Filters

Luke Hetrick lhetrick at nnu.edu
Thu Jul 5 14:59:15 EDT 2012


I am having some difficulty reading in a .vtk file with information
regarding points, vertices, scalars, and normals into a contour filter.
When I try to connect the /vtkPolyDataReader to /vtkMarchingContourFilter,
it does not see any points to draw contours for. I know there are nearly 7k
points in the file but I just can not figure out why the contour filters
are not seeing the points. Here is the relevant bit of code I am using in
case you are interested:


  vtkSmartPointer<vtkPolyDataReader> PolyData =
    vtkSmartPointer<vtkPolyDataReader>::New();
   PolyData->SetFileName( argv[1] );
   PolyData->Update();

   vtkSmartPointer<vtkPolyData> Input  =
     vtkSmartPointer<vtkPolyData>::New();
   Input->ShallowCopy( PolyData->GetOutput() );

   vtkSmartPointer<vtkMarchingContourFilter> Extract1 =
     vtkSmartPointer<vtkMarchingContourFilter>::New();
   Extract1->SetInputConnection( Input->GetProducerPort() );
   Extract1->GenerateValues( atoi( argv[2] ),0,4096 );
   std::cout << std::endl << "The # of contours is: ";
   std::cout << Extract1->GetNumberOfContours() << std::endl << std::endl;

It has crossed my mind that perhaps creating contours from points is not
possible. Does anyone know if that might be true?

Thank you for your time and help,
Luke H
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120705/f1b9c14d/attachment.htm>


More information about the vtkusers mailing list