# New Segment Statistics: Oriented Bounding Box, Diameter and More

**URL:** <https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203>\
**Category:** Support\
**Tags:** feature, segment-statistics\
**Created:** [February 11, 2020, 2:08pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203 "2020-02-11T14:08:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 11, 2020, 2:08pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/1 "2020-02-11T14:08:37Z")

</div>

New statistics have been added to the Segment Statistics module:

- Centroid
- Oriented bounding box
- Feret diameter
- Perimeter
- Roundness
- Flatness
- Elongation
- Principal axes/moments

These statistics are not enabled by default. To enable them, click on the “Options” button beside the “Labelmap Statistics” checkbox, and select the statistics that you would like calculated from the popup window.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/2/1215fbf5a379c4665e2091ef31cba1e48ae25474.png)

You can read the documentation for the Segment Statistics module [here](https://slicer.readthedocs.io/en/latest/user_guide/module_segmentstatistics.html).

**Oriented bounding box:**

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/7/e72285939b0de724fdb92c1f2509b07eb474397a.jpeg)

**Feret diameter and centroid:**

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/3/d375f2b5aeb4bb014a0c2e4e9bbb545b90fe02be.jpeg)

**Principal axes and moments**

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/e/5e7172a358013703714098d133f9a91da2e91e84.png)

**For developers:**  
A new filter called vtkITKLabelShapeStatistics has been added to vtkITK that can be used to calculate the above statistics on any labelmap image.

An example script for visualizing segment OBB can be found [here](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_size.2C_position.2C_and_orientation_of_each_segment).  
The ITK paper for the shape label filter can be found [here](https://www.insight-journal.org/browse/publication/176).

---

<div class="post-metadata">

**Author:** ![Carlos\_Felipe\_Lobo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/carlos_felipe_lobo/32/66594_2.png) [@Carlos\_Felipe\_Lobo](https://discourse.slicer.org/u/Carlos_Felipe_Lobo)\
**Post date:** [July 21, 2023, 1:34pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/2 "2023-07-21T13:34:15Z")

</div>

Hello @Sunderlandkyl,  
The statistics available in the module are fantastic and have helped me a lot, thank you.  
I’m just not able to visualize the box, sphere and axes in 3D, as shown in the images. Could you help me with this issue?  
Thank you very much and congratulations for the work.

 ![segmentStatistics](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/d/bd95e9bf772af47124f911cbe7f58a25fd68436f.png)

---

<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 21, 2023, 1:57pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/3 "2023-07-21T13:57:48Z")

</div>

You can copy-paste [this code snippet](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#markups-roi) into the Python console to display the bounding boxes.

---

<div class="post-metadata">

**Author:** ![Carlos\_Felipe\_Lobo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/carlos_felipe_lobo/32/66594_2.png) [@Carlos\_Felipe\_Lobo](https://discourse.slicer.org/u/Carlos_Felipe_Lobo)\
**Post date:** [July 21, 2023, 4:08pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/4 "2023-07-21T16:08:58Z")

</div>

> [@Sunderlandkyl](#):
>
> moment

Thank you for your attention and for the quick response @lassoan . The boxes turned out fine. I am now looking for a script to display principal axes and moments. Do you know if there are any available?  
Thank you very much

 ![segmentStatistics](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b4273d6240f8cbf346558d69c73a20a0ba577b17.png)

---

<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 21, 2023, 5:08pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/5 "2023-07-21T17:08:05Z")

</div>

The box axes are the principal axes.

---

<div class="post-metadata">

**Author:** ![Carlos\_Felipe\_Lobo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/carlos_felipe_lobo/32/66594_2.png) [@Carlos\_Felipe\_Lobo](https://discourse.slicer.org/u/Carlos_Felipe_Lobo)\
**Post date:** [July 21, 2023, 5:50pm UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/6 "2023-07-21T17:50:32Z")

</div>

Thank you! I appreciate the help 👍

---

<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:** [November 27, 2023, 7:05am UTC](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203/7 "2023-11-27T07:05:24Z")

</div>

3 posts were merged into an existing topic: [Segmentation size measurements (craniocaudal length and max diameter) to table](https://discourse.slicer.org/t/segmentation-size-measurements-craniocaudal-length-and-max-diameter-to-table/20825/8)
