Accoring to suggestions about how to compute an SDF:
I tried to building one by my own nii pixel data.
That’s how i converts a NIfTI 3D voxel image to a triangulated mesh
vtkSmartPointer<vtkDiscreteMarchingCubes>discrete = vtkSmartPointer<vtkDiscreteMarchingCubes>::New();
discrete->SetInputConnection(niiReader->GetOutputPort());
iscrete->Update();
vtkSmartPointer<vtkWindowedSincPolyDataFilter> smoother = vtkSmartPointer<vtkWindowedSincPolyDataFilter>::New();
smoother->SetInputConnection(discrete->GetOutputPort());
smoother->SetNumberOfIterations(100);
Without generating .obj data, i try to directly convert mesh from vtkpolydata to surfacemesh.
so i displace MeshIO::read with imstk::GeometryUtils::copyToSurfaceMesh like this
std::shared_ptr<imstk::SurfaceMesh> spinalSurfMesh = imstk::GeometryUtils::copyToSurfaceMesh(smoother->GetOutput());
Results shows that part of surface becomes shattered and i can’t get properly collision(tool will disappear) but it goes well when i generate a obj file and reading it by MeshIO::read.
What’s different bewteen two operators or can any suggestions provide?