# Howto get a centroid of a section in a slice?

**URL:** <https://discourse.slicer.org/t/howto-get-a-centroid-of-a-section-in-a-slice/24339>\
**Category:** Development\
**Tags:** python\
**Created:** [July 16, 2022, 8:59am UTC](https://discourse.slicer.org/t/howto-get-a-centroid-of-a-section-in-a-slice/24339 "2022-07-16T08:59:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [July 18, 2022, 1:54pm UTC](https://discourse.slicer.org/t/howto-get-a-centroid-of-a-section-in-a-slice/24339/5 "2022-07-18T13:54:24Z")

</div>

> [@Centroid determination](https://discourse.slicer.org/t/centroid-determination/3541/7):
>
> ```auto
> import numpy as np
> print(np.average(array('ModelX'), axis=0))
> 
> ```

老师您的意思👆🏻是说，多边形各顶点坐标的`np.average()'就是这个多边形的质心吗？

> Teacher, do you mean 👆🏻 that the `np.average()’ of the coordinates of each vertex of the polygon is the centroid of the polygon?

---

_[View the full topic](https://discourse.slicer.org/t/howto-get-a-centroid-of-a-section-in-a-slice/24339)._
