segment to numpy array

Hello All,

I need to study the density histogram of ROI on CT so I am trying to get a numpy array out of a segment. But when I convert segmentation node to labelmap node and then to numpy array, I only have binary array(0, or 1). I want a array with exact value of ROI on CT.
Could anyone help me with this?
Thanks for any help and advice.

Gabriel

You can use the array of 0/1 as a mask in numpy processing operations, or just blank out values in the CT (set to -10000) where the mask is 0.

See this complete example: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Mask_volume_using_segmentation