# Finding center of designated points

**URL:** <https://discourse.slicer.org/t/finding-center-of-designated-points/32841>\
**Category:** Support\
**Created:** [November 15, 2023, 5:28pm UTC](https://discourse.slicer.org/t/finding-center-of-designated-points/32841 "2023-11-15T17:28:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lccmyers](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lccmyers](https://discourse.slicer.org/u/lccmyers)\
**Post date:** [November 15, 2023, 5:28pm UTC](https://discourse.slicer.org/t/finding-center-of-designated-points/32841/1 "2023-11-15T17:28:31Z")

</div>

I’m trying to figure out how to find the center of 4+ points that I place on a 3D model. I’m placing the points on two separate models (they’re vertebrae) and the center point would lie in the space in between the models.

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [November 16, 2023, 12:42am UTC](https://discourse.slicer.org/t/finding-center-of-designated-points/32841/2 "2023-11-16T00:42:50Z")

</div>

The centroid of the points would just be the average of the coordinates. If the points are the control points of a markups node, the following would calculate it

```auto
myMarkupsNode = slicer.util.getNode('F') # replace 'F' with the name of the markups node containing your points

# Calculated center point position
import numpy as np
pointPositionArray = slicer.util.arrayFromMarkupsControlPoints(myMarkupsNode, world=True)
centerPosition = np.mean(pointPositionArray, axis=0)

# Create a new markups node and put a point at the calculated center
centerPointMarkupsNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsFiducialNode', 'MyCenterPoint')
centerPointMarkupsNode.AddControlPoint(centerPosition)

```
