[vtkusers] Converting a Structured Points File to an Unstructured Points/Grid File
Eric E. Monson
emonson at cs.duke.edu
Fri May 7 16:22:30 EDT 2010
One quick way might be to send the output of the reader right into a vtkThreshold filter (that is set with a threshold range which will pass all of your data). I've never tried it with a vtkStructuredPoints, but it works well for vtkImageData, and I think it should work in your case.
There are test code samples linked off of the Doxygen page:
Or, there is at least this one (and maybe more) on the VTK examples Wiki:
(There's also a vtkThresholdPoints filter that outputs vtkPolyData)
Eric E Monson
Duke Visualization Technology Group
On May 7, 2010, at 2:16 PM, Jack wrote:
> 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");
> 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.
> 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:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers