# Median and IQR values please help

**URL:** <https://discourse.slicer.org/t/median-and-iqr-values-please-help/22448>\
**Category:** Support\
**Created:** [March 11, 2022, 9:52am UTC](https://discourse.slicer.org/t/median-and-iqr-values-please-help/22448 "2022-03-11T09:52:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saffana](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Saffana](https://discourse.slicer.org/u/Saffana)\
**Post date:** [March 11, 2022, 9:52am UTC](https://discourse.slicer.org/t/median-and-iqr-values-please-help/22448/1 "2022-03-11T09:52:05Z")

</div>

Hello

I am segmenting the lungs and I am looking for median and IQR in the results

the software provides mean and SD for the values of segmented lungs

Can you help me please?

Thank you

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 11, 2022, 7:27pm UTC](https://discourse.slicer.org/t/median-and-iqr-values-please-help/22448/2 "2022-03-11T19:27:21Z")

</div>

You can get a the median of any scalar volume within a segmented region using the Segment Statistics module.

[https://slicer.readthedocs.io/en/latest/user\_guide/modules/segmentstatistics.html](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentstatistics.html)

Standard deviation is provided but not IQR, which you could calculate yourself by accessing the volume and mask as numpy arrays and using scipy to compute.

[scipy.stats.iqr — SciPy v1.8.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.iqr.html#:~:text=The%20interquartile%20range%20(IQR)%20is,ranges%20than%20the%20actual%20IQR).

It’s also possible to make an IQR plugin to Segment Statistics if you end up using it a lot.

[https://slicer.readthedocs.io/en/latest/user\_guide/modules/segmentstatistics.html#information-for-developers](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentstatistics.html#information-for-developers)
