[vtkusers] How to write vtkDelaunay3D into .vtk file

M. Jordan mjordan at live.at
Tue Jan 17 06:17:50 EST 2017


Try to add this after Delaunay3D:


       vtkGeometryFilter* geom = vtkGeometryFilter::New();
        geom->SetInputData(delaunay3DAlpha->GetOutput());
        geom->Update();


writer->SetInputData(geom->GetOutput());


Moreover:

#include <vtkUnstructuredGrid.h>


________________________________
Von: Kailu Shan <kailushan at 163.com>
Gesendet: Dienstag, 17. Jänner 2017 12:08
An: M. Jordan
Cc: vtkusers at vtk.org
Betreff: Re:AW: [vtkusers] How to write vtkDelaunay3D into .vtk file

hi,
Thanks for your reply!
which version are you using? I am using vtk 5.10 and also test with vtk 6.1.
Below is my revised code:

vtkSmartPointer<vtkDataWriter> writer=
vtkSmartPointer<vtkDataWriter>::New();
writer->SetFileName("delaunay3.vtk");
writer->SetInputData(delaunay->GetOutput());
writer->Write();

error C2664: 'void vtkWriter::SetInputData(vtkDataObject *)' : cannot convert parameter 1 from 'vtkUnstructuredGrid *' to 'vtkDataObject *'

? 2017-01-17 17:32:38,"M. Jordan" <mjordan at live.at> ??:

Hi,

I use this code for it.
(the extract surface/smooth part is optional)


// clean the polydata
        vtkSmartPointer<vtkCleanPolyData> cleanPolyData =
        vtkSmartPointer<vtkCleanPolyData>::New();
        cleanPolyData->SetInputConnection(INPUT->GetOutputPort());
        cleanPolyData->Update();
// use delaunay3D
        vtkSmartPointer<vtkDelaunay3D> delaunay3DAlpha =
        vtkSmartPointer<vtkDelaunay3D>::New();
        delaunay3DAlpha->SetInputData(cleanPolyData->GetOutput());
        //delaunay3DAlpha->SetTolerance(0.0001);
        //delaunay3DAlpha->SetAlpha(20);
        //delaunay3DAlpha->SetAlphaLines(0);
        //delaunay3DAlpha->SetAlphaTris(0);
       // delaunay3DAlpha->SetAlphaTets(1);
        //delaunay3DAlpha->SetAlphaVerts(0);
        //delaunay3DAlpha->SetBoundingTriangulation(0);
        delaunay3DAlpha->Update();
// extract surface
        vtkGeometryFilter* geom = vtkGeometryFilter::New();
        geom->SetInputData(delaunay3DAlpha->GetOutput());
        geom->Update();
 // smooth
        vtkSmoothPolyDataFilter* smooth22 = vtkSmoothPolyDataFilter::New();
        smooth22->SetInputConnection(geom->GetOutputPort());
        smooth22->SetNumberOfIterations(15);
        smooth22->SetRelaxationFactor(0.3);
        smooth22->Update();
  // write output file
        vtkSmartPointer<vtkPolyDataWriter> writer =
        vtkSmartPointer<vtkPolyDataWriter>::New();
        writer->SetInputData(smooth22->GetOutput());
        writer->SetFileName(PATH + FILENAME.vtk);
        writer->Write();



________________________________
Von: vtkusers <vtkusers-bounces at vtk.org<mailto:vtkusers-bounces at vtk.org>> im Auftrag von Kailu Shan <kailushan at 163.com<mailto:kailushan at 163.com>>
Gesendet: Dienstag, 17. Jänner 2017 10:05
An: VTK Users
Betreff: [vtkusers] How to write vtkDelaunay3D into .vtk file

How to write the vtkDelaunay3D data into .vtk file?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170117/d6e55e32/attachment.html>


More information about the vtkusers mailing list