[vtkusers] 'Incorrect' Geometry on Conversion to Polydata
Ted Kord
teddy.kord at googlemail.com
Sun May 16 17:22:33 EDT 2010
Hi
I converted a vtk StructuredData file to Polydata format. However, when I
load the result in Paraview, all I get is a red cube. Is there a filter I'm
supposed to use to get back my original image geometry?
What I actually want to do is obtain a .ply file from the .vtk file (by
saving the .vtp file as .ply). Is there a better way to do this?
Thanks
Theodore
==
The code I used to convert form vtk to polydata is:
int main(int, char *[])
{
vtkSmartPointer<vtkStructuredPointsReader> reader =
vtkSmartPointer<vtkStructuredPointsReader>::New();
reader->SetFileName("test.vtk");
reader->Update();
//create Structuredpoints
vtkSmartPointer<vtkStructuredPoints> structuredPoints = reader->GetOutput();
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->SetInput(structuredPoints);
geometryFilter->Update();
vtkPolyData* polydata = geometryFilter->GetOutput();
std::cout << "Output has " << polydata->GetNumberOfPoints() << "
points."<< std::endl;
vtkSmartPointer<vtkXMLPolyDataWriter> writer =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
writer->SetFileName("test.vtp");
writer->SetInput(polydata);
writer->Write();
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100516/fb779fa6/attachment.htm>
More information about the vtkusers
mailing list