Why is size/shape of numpy array from labelmap and scalar volume not the same?

Hi,

I want to export my volume and segmentation into numpy arrays so that I can use them for further analysis. I did as explained in this post and it seems to work but I don’t quite understand why the arrays I obtain do not have the same shape and size. I thought the labelmap would have the same geometry of my volume, just with the scalar units replaced by binary labels where I have placed a segment and some null-value elsewhere. Can somebody clarify?

Thank you

Size of voxel array is always the minimum necessary size to store that segment. You can convert between physical position and array index as shown in this example in the script repository: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_centroid_of_a_segment_in_world_.28RAS.29_coordinates

2 Likes