[Insight-users] Unable to write a delaunay2D mesh in a .vtu file

Sylvain Bernhardt sylvainb at ece.ubc.ca
Fri Mar 9 01:54:57 EST 2012


Hi all,
I'm triangulating a 2D Delaunay mesh from a cloud of points encapsulated 
in std::vector<int> *N like so:

     vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();

     for(int i = 0; i < N->size(); i += 2)
         points->InsertNextPoint(N->at(i), N->at(i+1), some_value[i]);

     vtkSmartPointer<vtkPolyData> polydata = 
vtkSmartPointer<vtkPolyData>::New();
     polydata->SetPoints(points);

     vtkSmartPointer<vtkDelaunay2D> delaunay = 
vtkSmartPointer<vtkDelaunay2D>::New();
     delaunay->SetInput(polydata);
     delaunay->Update();

     vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
         vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
     writer->SetInputConnection(delaunay->GetOutputPort());
     writer->SetFileName("Mesh.vtu");
     writer->Write();

Apparently the triangulation is fine since I'm able to render it later 
on. But the writing part triggers the following error:
ERROR: In ..\..\Filtering\vtkDemandDrivenPipeline.cxx, line 827
vtkStreamingDemandDrivenPipeline (0000000002E8D030): Input for 
connection index 0 on input port index 0 for algorithm 
vtkXMLUnstructuredGridWriter(00000000035DC9C0) is of type vtkPolyData, 
but a vtkUnstructuredGrid is required.

I find it weird since I pretty much did exactly the same than in this 
example 
<http://www.itk.org/Wiki/VTK/Examples/Boneyard/Cxx/PolyData/ConvexHull_vtkDelaunay3D> 
with a delaunay3d.

Any thoughts ?

Cheers,
S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120308/87fbae1b/attachment.htm>


More information about the Insight-users mailing list