# 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:** 8

<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 20, 2022, 5:14am UTC](https://discourse.slicer.org/t/howto-get-a-centroid-of-a-section-in-a-slice/24339/8 "2022-07-20T05:14:02Z")

</div>

> [@How to extract the vertex coordinates of a polygon of a model in the current section?](https://discourse.slicer.org/t/how-to-extract-the-vertex-coordinates-of-a-polygon-of-a-model-in-the-current-section/24380/3):
>
> Lassoan教授，好吧。。。我想出来个笨拙的解决方案：
> 
> > Prof.Lassoan, okay. . . I came up with a clumsy solution:
> > 
> > ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/f/4f4806076a2457dc66b6bbecbdf3b6bc7445f458.jpeg)
> 
> 不过这个解决方案有个问题：就是提取的点和点之间的距离不均匀。。。谁有好办法呢？
> 
> > However, there is a problem with this solution: the distance between the extracted points is not uniform. . . Who has a better solution?
> 
> Such As Weighted when calculating the average?

> I want to weight the centroid obtained above by the reciprocal of voxel (CT value), how to do it?

---

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