Open zhangcl-163 opened 1 year ago
Hi @zhangcl-163 ,
vtu is not planned in the current future as far as I am aware; however, .vtk
unstructured data is planned around December.
Hey Matt, did UNSTRUCTURED_DATA get implemented?
My models are working fine with itk.js but itk-wasm is crashing without any usefull error codes so this might be the problem
I don't think I need it, but maybe it would help people in the future
For now I am just doing an extra postprocessing step of converting to XML PolyData:
import vtk
# Step 1: Read the unstructured grid data
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName("x.vtk")
reader.Update()
# Step 2: Convert the unstructured grid to polydata
geometryFilter = vtk.vtkGeometryFilter()
geometryFilter.SetInputData(reader.GetOutput())
geometryFilter.Update()
# Step 3: Write the polydata to a new VTK file
polydata = geometryFilter.GetOutput()
writer = vtk.vtkXMLPolyDataWriter()
writer.SetFileName("x.vtk")
writer.SetInputData(polydata)
writer.Write()
Than using the https://kitware.github.io/vtk-js/examples/XMLPolyDataWriter.html But it did take some time to figure out that that is possible :)
@jord1e thanks for sharing the workaround!
I currently do not have plans to add VTU support, but contributions are welcome.
Thank you for the update!
The workaround is working perfectly, and I am getting WAY better performance as compared to using the vtk.js IO/Legacy vtkITKPolyDataReader/ITKPolyDataReader + itk.js+ setReadPolyDataArrayBufferFromITK
Hoping Google guides people to it ;)
since vtk.js -itk, unstructureddata file (vtu) can be loaded. in itk-wasm, does it support vtu file type to be loaded? or it is supported in seperate itk-wasm io module?
any suggestions are appreciated!