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

**URL:** <https://discourse.slicer.org/t/why-is-size-shape-of-numpy-array-from-labelmap-and-scalar-volume-not-the-same/4522>\
**Category:** Support\
**Created:** [October 25, 2018, 12:04am UTC](https://discourse.slicer.org/t/why-is-size-shape-of-numpy-array-from-labelmap-and-scalar-volume-not-the-same/4522 "2018-10-25T00:04:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mag](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@mag](https://discourse.slicer.org/u/mag)\
**Post date:** [October 25, 2018, 12:04am UTC](https://discourse.slicer.org/t/why-is-size-shape-of-numpy-array-from-labelmap-and-scalar-volume-not-the-same/4522/1 "2018-10-25T00:04:22Z")

</div>

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](https://discourse.slicer.org/t/segment-binarylabelmap-to-numpy-array/778) 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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 25, 2018, 2:42am UTC](https://discourse.slicer.org/t/why-is-size-shape-of-numpy-array-from-labelmap-and-scalar-volume-not-the-same/4522/2 "2018-10-25T02:42:14Z")

</div>

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](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_centroid_of_a_segment_in_world_.28RAS.29_coordinates)
