LevelSetModel construction change

Hello,I have read the FemurCut example ,in which you first compute the SDF of a leg nii and then modify their voxels.But Could you give me some advice or examples on how to modify a SDF of a SurfaceMesh(such as .stl)? Is there a filter available in the current library? Thanks a lot! :slight_smile:

Yes! Given a triangle mesh we can compute an SDF using the SurfaceMeshDistanceTransform. Supply it the SurfaceMesh and the bounds+dimensions you want to compute it in, call update, and get the output ImageData SDF.

Here’s an example that computes one: https://gitlab.kitware.com/iMSTK/iMSTK/-/blob/master/Examples/SPH-Obj-SDF/SPH-Obj-SDFInteractionExample.cpp#L138

If you’re interested in how it computes the SDF. It uses vtkImplicitPolyDataDistance which uses the approach described in “Signed Distance Computation using the Angle Weighted Pseudo-normal”. Computing the nearest point on the surface for distance, and then projecting onto the angled weighted (to deal with discontinuities) normal for sign.