Export values from histogram?

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.)




You can compute histogram using numpy:

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

Wow, that’s a lot simpler! Thanks!