# Slice-by-slice statistics

**URL:** https://discourse.slicer.org/t/slice-by-slice-statistics/1099
**Category:** Support
**Tags:** segmentation, statistics
**Created:** [September 21, 2017, 7:51pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099 "2017-09-21T19:51:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)
#### Post date: [September 21, 2017, 7:51pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/1 "2017-09-21T19:51:00Z")

</div>

Given an image volume and a segmentation, is there a way to get image statistics on individual slices along an axis? In particular, I’m looking for mean image intensities within 2D segmentations in multiple Axial views.

---

<div class="post-metadata">

### Author: ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)
#### Post date: [September 21, 2017, 7:55pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/2 "2017-09-21T19:55:20Z")

</div>

Have you tried the **Segment Statistics** module of the latest nightly version?

---

<div class="post-metadata">

### Author: ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)
#### Post date: [September 21, 2017, 8:12pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/3 "2017-09-21T20:12:39Z")

</div>

I have, yes. However, if I create a 3D segmentation, it appears that what’s produced is a set of statistics for the full 3D segmentation, rather than individual slices along an axis. Is there a way to get (Axial) slice-by-slice statistics, without creating a separate segment for every slice?

---

<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: [September 21, 2017, 9:18pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/4 "2017-09-21T21:18:58Z")

</div>

This is a very specialized requirement that you have to implement a simple script for. Probably the easiest is to export segmentation to labelmap volume and do compute statistics using numpy. In numpy it’s very easy to get a single slice of a volume, apply a mask, and compute mean.

---

<div class="post-metadata">

### Author: ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)
#### Post date: [September 21, 2017, 10:46pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/5 "2017-09-21T22:46:37Z")

</div>

Ok, thanks, I’ll try it that way.

---

<div class="post-metadata">

### Author: ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)
#### Post date: [December 2, 2019, 12:03pm UTC](https://discourse.slicer.org/t/slice-by-slice-statistics/1099/6 "2019-12-02T12:03:45Z")

</div>

Dear Professor Michael Schumaker:

Did you completed such a statistics?
