Adding control points with undefined position from Python

I’d like to create a landmarking template with named, unplaced points. I can unset the position status of a point I have placed, but would like to add points to the node with uninitialized positions. It looks like I could do this if I could access vtkMRMLMarkupsNode::AddNControlPoints from python. Would this be the best approach, or is there a way to call vtkMRMLMarkupsNode::AddControlPoint with an uninitialized control point?

Alternatively, would it be preferable to set the coordinates of unplaced points to something like [0,0,0]?

@lassoan I’m interested in your thoughts on the correct approach.

Unplaced points can have any point coordinates, as they would not be showed to users and they would not be used in any computations.

vtkMRMLMarkupsNode API already allows adding points and undefining their point position (for example, using vtkMRMLMarkupsNode::UnsetNthControlPointPosition(int pointIndex)), so you don’t need to do anything with that.

What is still to be implemented:

  • improve control points table in Markups module GUI:
    • hide positions of unplaced points
    • add “place” button to the table to each line, which allows (re)placing the control point
  • improve the markup point placement logic (probably here): when control point placement is activated then check first if there is a control point with undefined position and if there is one then place that (instead of creating a new control point)
1 Like