# Combine shape stats from multiple labelled 2D slices

**URL:** <https://discourse.itk.org/t/combine-shape-stats-from-multiple-labelled-2d-slices/2366>\
**Category:** Algorithms\
**Tags:** simpleitk, python\
**Created:** [November 1, 2019, 9:50am UTC](https://discourse.itk.org/t/combine-shape-stats-from-multiple-labelled-2d-slices/2366 "2019-11-01T09:50:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jigabytes](https://discourse.itk.org/user_avatar/discourse.itk.org/jigabytes/32/967_2.png) [@Jigabytes](https://discourse.itk.org/u/Jigabytes)\
**Post date:** [November 1, 2019, 9:50am UTC](https://discourse.itk.org/t/combine-shape-stats-from-multiple-labelled-2d-slices/2366/1 "2019-11-01T09:50:49Z")

</div>

Hi, Post applying segmentation filters on a 3D image, I gather shape stats for each 2D slice. How do I combine shape stats for each of 2D slices into one data structure. Is there simple ITK filter for such operation or I need to do this in pure python and build data structure some map like form z -\> shape stats Thanks Jiten

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [November 1, 2019, 1:19pm UTC](https://discourse.itk.org/t/combine-shape-stats-from-multiple-labelled-2d-slices/2366/2 "2019-11-01T13:19:29Z")

</div>

Hi @Jigabytes,

If you just want a data structure to store the statistics on a per slice basis I would suggest using a pandas dataframe. You can then easily run statistics on the values export nice looking tables and graphs etc. See examples in [this notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/35_Segmentation_Shape_Analysis.ipynb) and [this one](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/34_Segmentation_Evaluation.ipynb).

---

<div class="post-metadata">

**Author:** ![Jigabytes](https://discourse.itk.org/user_avatar/discourse.itk.org/jigabytes/32/967_2.png) [@Jigabytes](https://discourse.itk.org/u/Jigabytes)\
**Post date:** [November 2, 2019, 3:01am UTC](https://discourse.itk.org/t/combine-shape-stats-from-multiple-labelled-2d-slices/2366/3 "2019-11-02T03:01:23Z")

</div>

Hi @zivy, I will definitely use pandas for my final list of labelled regions. Before that I have an unfiltered list of regions which I need to filter further. I wanted to save this unfiltered list of regions across different slices in one data structure so that I can apply my filtering logic on all regions across slices in one go. Thanks, Jiten
