[vtkusers] 'Incorrect' Geometry on Conversion to Polydata

Bill Lorensen bill.lorensen at gmail.com
Sun May 16 17:26:31 EDT 2010


If you run GeometryFilter on Structured Points you will only get the
boundary faces.
\ply is a polygon format. AFAIK is cannot represent the solid elements
that exist within Structured Points.

Maybe you can share your final goal.

Bill

On Sun, May 16, 2010 at 5:22 PM, Ted Kord <teddy.kord at googlemail.com> wrote:
> 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;
>
> }
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list