# Load segment from matrix of integers

**URL:** <https://discourse.slicer.org/t/load-segment-from-matrix-of-integers/3524>\
**Category:** Support\
**Tags:** segmentation, file-import\
**Created:** [July 19, 2018, 2:39pm UTC](https://discourse.slicer.org/t/load-segment-from-matrix-of-integers/3524 "2018-07-19T14:39:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessandronavacchia](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alessandronavacchia](https://discourse.slicer.org/u/alessandronavacchia)\
**Post date:** [July 19, 2018, 2:39pm UTC](https://discourse.slicer.org/t/load-segment-from-matrix-of-integers/3524/1 "2018-07-19T14:39:40Z")

</div>

Hi all,

I have been exporting and importing segmentation masks as .stl files or other formats that describe the segmented volume as a surface mesh made of triangular elements.

I was wondering if it is possible to load segmentation masks described as a 3d matrix of ones and zeros, in which each element represents a voxel of the image volume (1 = included in the mask, 0 = not included).

Any help with this would be appreciated! Thanks!

Alessandro

---

<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:** [July 19, 2018, 7:00pm UTC](https://discourse.slicer.org/t/load-segment-from-matrix-of-integers/3524/2 "2018-07-19T19:00:55Z")

</div>

I think this example does exactly what you asked: [https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Create\_a\_segmentation\_from\_a\_labelmap\_volume\_and\_display\_in\_3D](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Create_a_segmentation_from_a_labelmap_volume_and_display_in_3D)
