# Adding control points with undefined position from Python

**URL:** <https://discourse.slicer.org/t/adding-control-points-with-undefined-position-from-python/12344>\
**Category:** Support\
**Created:** [July 2, 2020, 6:07pm UTC](https://discourse.slicer.org/t/adding-control-points-with-undefined-position-from-python/12344 "2020-07-02T18:07:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [July 2, 2020, 6:07pm UTC](https://discourse.slicer.org/t/adding-control-points-with-undefined-position-from-python/12344/1 "2020-07-02T18:07:02Z")

</div>

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](https://github.com/Slicer/Slicer/blob/07bc92102ca225e3d46c5545af650aac3455125d/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx#L517) from python. Would this be the best approach, or is there a way to call [vtkMRMLMarkupsNode::AddControlPoint](https://github.com/Slicer/Slicer/blob/07bc92102ca225e3d46c5545af650aac3455125d/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx#L476) 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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 2, 2020, 7:10pm UTC](https://discourse.slicer.org/t/adding-control-points-with-undefined-position-from-python/12344/2 "2020-07-02T19:10:22Z")

</div>

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](https://github.com/Slicer/Slicer/blob/43300c7b9a3b27265c2bc736693cb881f05e3ea9/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsDisplayNode.cxx#L542-L633)): 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)
