Hi,
I have two volumetric meshes that have same number of nodes and connectivities (cells). The only difference is that one mesh is kind of a deformed version of the other. This means only the node positions are sligtly different.
What I want is that extract the surface meshes from those two and save back to the disk for further processing. However, when I attempt to extract by using vtk.geometryFilter (see below sample code) I enconter that the face ids are somehow different to each other.
How can I extract the surface meshes which compatible to each other so that I can compare them. This indicates only the node positions are different but the faces/tirangles ids are exactly the same.
Am I missed anything or any steps here ? If so can you elaborate the steps with an example please ?
I herewith attached a sample groundtruth mesh and its deformed/predicted version for your further reference.
import os
import vtk
def getSurfaceMesh(vol_mesh_path, out_save_path):
meshReader = vtk.vtkUnstructuredGridReader()
meshReader.SetFileName(vol_mesh_path)
meshReader.ReadAllVectorsOn()
meshReader.ReadAllScalarsOn()
meshReader.Update()
meshGeometryFilter = vtk.vtkGeometryFilter()
meshGeometryFilter.SetInputData(meshReader.GetOutput())
meshGeometryFilter.Update()
stlWriter = vtk.vtkSTLWriter()
stlWriter.SetFileName(out_save_path)
stlWriter.SetInputConnection(meshGeometryFilter.GetOutputPort())
stlWriter.Write()
volumetric_mesh_path = "F:/gt_scan_1.vtk"
surface_save_path = "F:/surface_meshes/gt_scan_1.stl"
pred_volumetric_mesh_path = "F:/pred_scan_1.vtk"
pred_surface_save_path = "F:/surface_meshes/pred_scan_1.stl"
getSurfaceMesh(volumetric_mesh_path, surface_save_path)
getSurfaceMesh(pred_volumetric_mesh_path, pred_surface_save_path)