# How to find the volume of a segmentation node whose master representation is closed surface representation

**URL:** <https://discourse.slicer.org/t/how-to-find-the-volume-of-a-segmentation-node-whose-master-representation-is-closed-surface-representation/44738>\
**Category:** Development\
**Tags:** segmentation, segment-statistics\
**Created:** [October 13, 2025, 5:33am UTC](https://discourse.slicer.org/t/how-to-find-the-volume-of-a-segmentation-node-whose-master-representation-is-closed-surface-representation/44738 "2025-10-13T05:33:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)\
**Post date:** [October 13, 2025, 5:33am UTC](https://discourse.slicer.org/t/how-to-find-the-volume-of-a-segmentation-node-whose-master-representation-is-closed-surface-representation/44738/1 "2025-10-13T05:33:44Z")

</div>

Hello,

I want to find the volume of a segmentation node with closed surface representation. How can I do that using segment statistics module? I have found an example in script repository but I think it is only applicable for binary lablemap representation. Here is the code I found.

```python
segmentationNode = getNode("Segmentation")

# Compute segment statistics
import SegmentStatistics
segStatLogic = SegmentStatistics.SegmentStatisticsLogic()
segStatLogic.getParameterNode().SetParameter("Segmentation", segmentationNode.GetID())
segStatLogic.computeStatistics()
stats = segStatLogic.getStatistics()

# Display volume of each segment
for segmentId in stats["SegmentIDs"]:
  volume_cm3 = stats[segmentId,"LabelmapSegmentStatisticsPlugin.volume_cm3"]
  segmentName = segmentationNode.GetSegmentation().GetSegment(segmentId).GetName()
  print(f"{segmentName} volume = {volume_cm3} cm3")

```

Thanks for your help in advance.

---

<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:** [October 14, 2025, 2:49am UTC](https://discourse.slicer.org/t/how-to-find-the-volume-of-a-segmentation-node-whose-master-representation-is-closed-surface-representation/44738/2 "2025-10-14T02:49:16Z")

</div>

You can use metrics provided by `ClosedSurfaceSegmentStatisticsPlugin`.

> <https://github.com/Slicer/Slicer/blob/ad238246c73ef8323d87dcef047e2514f937ae0f/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ClosedSurfaceSegmentStatisticsPlugin.py#L14>

---

<div class="post-metadata">

**Author:** ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)\
**Post date:** [October 16, 2025, 9:00am UTC](https://discourse.slicer.org/t/how-to-find-the-volume-of-a-segmentation-node-whose-master-representation-is-closed-surface-representation/44738/3 "2025-10-16T09:00:03Z")

</div>

Thank you. This works.
