All aspectes of vtk io

One of the task for visulization software is to change the format of data back and force between different types. This blog includes some notes about the vtk io.

Which reader or writer should be used

Version info

The vision 5.1 is not well supported for some software such as Visit. Try to use the SetFileVersion(42) if the generated file can not be properly loaded into the software.

For the imageData, use the vtkStructurePoints reader/writer, instead of the imageDataReader or writer.

Examples

(read/write using vtkm dataset reader/writer)

//reader example
vtkm::cont::DataSet ds;
vtkm::io::VTKDataSetReader reader(vtkFileName);
ds=reader.ReadDataSet();

//writer example (write vtkm data set to the vtk data)
vtkm::io::VTKDataSetWriter(vtkFileName);
write.WriteDataSet(vtkmdataset)

References

All kinds of exmaples for the online example

https://kitware.github.io/vtk-examples/site/Cxx/

Check the IO section for more details

Documents for the data writer

https://vtk.org/doc/nightly/html/classvtkDataWriter.html

Some online examples I have sorted out bfore

https://github.com/wangzhezhe/5MCST/tree/master/vtk_example

推荐文章