[vtkusers] Problem conversion vtkStructuredPoints to mesh/Polydata
agatte
agatakrason at gmail.com
Tue Mar 27 15:30:55 EDT 2012
Hi ;)
I am just begining my adventure with vtk.
I have a *.vtk file STRUCTURED_POINTS. I want to convert it to POLYDATA and
save as *.vtk file.
Could anyone help me please ?
I would appreciate for any help.
I am trying with this code : but I received an error :
int main()
{
try
{
vtkSmartPointer<vtkStructuredPointsReader> reader =
vtkSmartPointer<vtkStructuredPointsReader>::New();
reader->SetFileName("Points.vtk");
reader->Update();
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->SetInput(reader->GetOutput);
geometryFilter->Update();
/*vtkContourFilter * contour = vtkContourFilter::New();
contour->SetInput( reader->GetOutput() );
contour->SetValue(0, 128); */
// Save mesh as vtk Poly Data
vtkPolyDataWriter * writerMesh = vtkPolyDataWriter::New();
writerMesh->SetFileName("MeshVTK.vtk");
writerMesh->SetInput(geometryFilter->GetOutput());
writerMesh->Write();
// contour->Delete();
writerMesh->Delete();
}
catch (itk::ExceptionObject &ex)
{
std::cout << ex << std::endl;
return EXIT_FAILURE;
}
}
# vtk DataFile Version 2.0
Comment goes here
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 3 201 1
ORIGIN 0.000 0.000 0.000
SPACING 1.000 1.000 1.000
POINT_DATA 603
SCALARS scalars double
LOOKUP_TABLE default
108 186 26
1.081485e+002 1.858573e+002 26
1.083255e+002 1.855720e+002 26
1.085282e+002 1.851580e+002 26
1.087540e+002 1.846294e+002 26
109 184 26
1.092600e+002 1.832852e+002 26
1.095138e+002 1.825058e+002 26
1.097375e+002 1.816838e+002 26
1.099075e+002 1.808411e+002 26
110 180 26
1.100035e+002 1.791777e+002 26
1.099555e+002 1.783727e+002 26
1.099057e+002 1.775789e+002 26
1.099040e+002 1.767900e+002 26
110 176 26
1.102301e+002 1.752040e+002 26
1.105764e+002 1.744034e+002 26
--
View this message in context: http://vtk.1045678.n5.nabble.com/Problem-conversion-vtkStructuredPoints-to-mesh-Polydata-tp5598716p5598716.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list