[vtkusers] Problem conversion vtkStructuredPoints to mesh/Polydata

David Doria daviddoria at gmail.com
Wed Mar 28 08:26:00 EDT 2012


On Wed, Mar 28, 2012 at 8:15 AM, agatte <agatakrason at gmail.com> wrote:
> I have already made it.  I used another filter. It works well ;)
>
> This is a code :
>
>
>         vtkSmartPointer<vtkStructuredPointsReader> reader =
>     vtkSmartPointer<vtkStructuredPointsReader>::New();
>     reader->SetFileName("Points.vtk");
>     reader->Update();
>
>         vtkSmartPointer<vtkImageDataGeometryFilter> geometryFilter =
>     vtkSmartPointer<vtkImageDataGeometryFilter>::New();
>     geometryFilter->SetInputConnection(reader->GetOutputPort());
>     geometryFilter->Update();
>
>
>    vtkContourFilter * contour = vtkContourFilter::New();
>    contour->SetInput(geometryFilter->GetOutput());
>    contour->SetValue(0, 128);
>
>
>
>        // Save mesh as vtk Poly Data
>    vtkPolyDataWriter * writerMesh = vtkPolyDataWriter::New();
>        writerMesh->SetFileName("MeshVTK.vtk");
>    writerMesh->SetInput(contour->GetOutput());
>    writerMesh->Write();
>
>    contour->Delete();
>    writerMesh->Delete();
>


This compiles fine for me with vtk 5.6:

http://codepad.org/WkVjgx6u



More information about the vtkusers mailing list