# Export values from histogram?

**URL:** <https://discourse.slicer.org/t/export-values-from-histogram/1312>\
**Category:** Support\
**Created:** [October 28, 2017, 12:26pm UTC](https://discourse.slicer.org/t/export-values-from-histogram/1312 "2017-10-28T12:26:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [October 28, 2017, 12:26pm UTC](https://discourse.slicer.org/t/export-values-from-histogram/1312/1 "2017-10-28T12:26:11Z")

</div>

Is there a way to export values from the histogram in the Volumes module? There are instances where I need to make a histogram in R or something to export for publication.

If not, I was thinking of adding it - It looks doable, looking at qSlicerScalarVolumeDisplayWidget.cxx - once the Histogram is fed the data array and it generates the histogram, I can call value() for each of the bins to get the data. (I think.)

Comments/opinions/complaints?

Thanks!

-Hollister

---

<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 28, 2017, 12:55pm UTC](https://discourse.slicer.org/t/export-values-from-histogram/1312/2 "2017-10-28T12:55:51Z")

</div>

You can compute histogram using numpy:

```
import numpy as np
histogram = np.histogram(arrayFromVolume(getNode('MRHead')))
```

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [October 28, 2017, 1:13pm UTC](https://discourse.slicer.org/t/export-values-from-histogram/1312/3 "2017-10-28T13:13:51Z")

</div>

Wow, that’s a lot simpler! Thanks!
