how to obtain a report/table of the histogram of grayvalues

Hi!

I’m trying to obtain a table with the histogram of gray values of a volume (obtained from a segmentation using the mask volume) but I can’t. At the moment, I only see the plot in the volume module but I need the values. It is possible?

Thanks!

A solution is described in this post: Histogram of volume in regions defined by segments

When I paste the script to my slicer, it crashes, I have the version 4.8.1

You need to use latest nightly version.

Thanks! I will try it

Hi again!

Now I have the latest nightly version, and the script works but I don’t know how to change it to work with my data. I have performed the segmentation (using thresholding values) with the segmentation module, then I have created the mask volume with the segment created and filling outside with 0. But this is all, I don’t know how to call my mask volume and segmentation to obtain the histogram chart and table. Also I would like to know how to obtain the histogram and table of my initial master volume.
Sorry, I have never used python language.

Run the script as is and modify it step-by-step to see the effect of your changes. I would strongly recommend to copy-paste the code into a Python scripted module (as described in the programming tutorial) and run it line by line using a Python debugger. If you are not confident with Python syntax, then spend a couple of days completing basic Python tutorials.

1 Like

Thanks a lot, I will try it