[vtkusers] Converting a Structured Points File to an Unstructured Points/Grid File
David Doria
daviddoria+vtk at gmail.com
Fri May 7 16:18:05 EDT 2010
On Fri, May 7, 2010 at 2:16 PM, Jack <teddy.kord at yahoo.co.uk> wrote:
> Hi
>
> I have a file with a dataset of structured points. I'd like to convert this
> to a dataset of unstructured points and/or unstructured grid. How can I do
> this?
>
> So far, this is what I have:
>
> int main()
> {
> //get all data from the file
> vtkSmartPointer< vtkStructuredPointsReader> reader = vtkSmartPointer<
> vtkStructuredPointsReader>:: New();
> reader->SetFileName("geometry. vtk");
> reader->Update();
>
> vtkStructuredPoints* structuredPoints = reader->GetOutput();
>
> //get the number of points the file contains
> vtkIdType numPoints = structuredPoints-> GetNumberOfPoints();
>
> std::cout << "There are " << numPoints << " points." << std::endl;
>
> vtkSmartPointer< vtkUnstructuredGrid> unstructuredGrid = vtkSmartPointer<
> vtkUnstructuredGrid>::New();
>
> }
>
> It's incomplete and I'm not sure how to proceed.
>
> Thanks in advance.
>
> Theodore
>
These are the basics of creating and writing a VTU:
http://www.vtk.org/Wiki/VTK/Examples/IO/WriteVTU
I've never used vtkStructuredPoints - it seems to be a subclass of
vtkImageData, so you may be able to get the dat aout of it using something
similar to
http://www.vtk.org/Wiki/VTK/Examples/ImageData/IterateImageData
Good luck - if you figure it out please make a wiki example!
<http://www.vtk.org/Wiki/VTK/Examples/IO/WriteVTU>
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100507/310cc3be/attachment.htm>
More information about the vtkusers
mailing list