[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
Hey Theodore,
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:
http://www.vtk.org/doc/nightly/html/classvtkThreshold.html
Or, there is at least this one (and maybe more) on the VTK examples Wiki:
http://www.itk.org/Wiki/VTK/Examples/ThresholdingCells
(There's also a vtkThresholdPoints filter that outputs vtkPolyData)
-Eric
------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group
On May 7, 2010, at 2:16 PM, Jack 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
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100507/40e87b8c/attachment.htm>
More information about the vtkusers
mailing list