How is mean attenuation calculated?

How does 3D slicer calculate the output ‘mean attenuation’? For example, I select the range of -190 to -30 HU to capture adipose tissue, and I am interested in both the volume and mean attenuation. I always assumed that ‘mean’ references to the average attenuation value for each individual pixel identified within that -190 to -30 range, but I would appreciate it if someone could clarify/explain. Thanks!

The “Mean” column of Segment statistics module output table contains the mean value of all voxel values in the segment’s region.

Thank you. Would you be able to share the Python code for attenuation, both the code for volume within an attenuation range and for mean attenuation?

Just following this again again… would you be able to link me to the Python code for this? Thank you!!

Segment statistics module is implemented in Python (see source code). You can either use VTK or ITK filters or numpy (get the voxels as a numpy array, use masking to get the voxels in the segment’s region, and get the mean by calling the mean method of the masked array).