Curve deviates or forms spikes when using Open Curve Markup Tool

Hi,

I’m using the Open Curve Markup Tool in 3D Slicer to create curves on a surface model, such as between the mesial and distal papilla of a tooth. To support this, I’m also calculating and visualizing minimum curvature using the following Python code in the Python Interactor:

-----------------------------------------------------------------
modelNode = getNode('DB')

import vtk
curv = vtk.vtkCurvatures()
curv.SetInputData(modelNode.GetPolyData())
curv.SetCurvatureTypeToMinimum()

modelNode.SetPolyDataConnection(curv.GetOutputPort())
modelNode.GetDisplayNode().SetActiveScalar("Minimum_Curvature", vtk.vtkAssignAttribute.POINT_DATA)
modelNode.GetDisplayNode().SetScalarVisibility(True)
-----------------------------------------------------------------

In the Markups module (Create open curve markup), I’m setting:

  • Curve type: Shortest distance on surface
  • Model node: the surface model
  • Cost function: Inverse squared
  • Weighting: distance / curvature

The problem is that the generated curve sometimes deviates in unexpected directions, even when the path seems straightforward. When I try to correct it by manually adding control points (Ctrl + click), the curve often becomes worse, with sharp spikes or unnatural shapes.

Is there any way to prevent this kind of behavior or improve the curve stability when editing?

Thanks.