# Issue with Mesh to Label Map

**URL:** <https://discourse.slicer.org/t/issue-with-mesh-to-label-map/17875>\
**Category:** Support\
**Tags:** vtk, stl, nrrd, labelmap, meshing\
**Created:** [May 31, 2021, 12:51am UTC](https://discourse.slicer.org/t/issue-with-mesh-to-label-map/17875 "2021-05-31T00:51:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![quan](https://avatars.discourse-cdn.com/v4/letter/q/7cd45c/32.png) [@quan](https://discourse.slicer.org/u/quan)\
**Post date:** [May 31, 2021, 12:51am UTC](https://discourse.slicer.org/t/issue-with-mesh-to-label-map/17875/1 "2021-05-31T00:51:55Z")

</div>

I’m trying to generate a SPHARM-PDM mesh from a .stl file. I imported the .stl and used “Mesh to Label Map” to obtain the .nrrd. However, the .nrrd is inverted (the white space are supposed to be black and vice versa). This inversion caused the final SPHARM-PDM mesh to be a rectangular box with a hole inside with the shape of my original mesh. How do I get my current procedure to work correctly?

Original mesh + generated label mesh:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/a/2ae2526be241233b900e0387c4ee7aebc0cb0f4c.png)

Final SPHARM-PDM mesh:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/7/b7d3f5b89bfe83ac14b4b1284d9eb9f1cf779ac2.png)

---

<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:** [May 31, 2021, 11:30pm UTC](https://discourse.slicer.org/t/issue-with-mesh-to-label-map/17875/2 "2021-05-31T23:30:29Z")

</div>

Probably “Mesh to label map” module does not know what is inside/outside because the model is not fully enclosed by the output image. You may also try the very similar “Model to Labelmap” module in Slicer core.

If you want a method that is simple and works more robustly then convert the model to segmentation (by right-clicking on the model in Data module), and then export the segmentation to binary labelmap (by right-clicking on the segmentation in Data module).

You can fine-tune conversion parameters in segmentation module (resolution, smoothing, decimation) if the default quality is not sufficient.

---

<div class="post-metadata">

**Author:** ![quan](https://avatars.discourse-cdn.com/v4/letter/q/7cd45c/32.png) [@quan](https://discourse.slicer.org/u/quan)\
**Post date:** [June 1, 2021, 5:18am UTC](https://discourse.slicer.org/t/issue-with-mesh-to-label-map/17875/3 "2021-06-01T05:18:30Z")

</div>

The “convert the model to segmentation” then “export the segmentation to binary labelmap” method works very well. Thank you for the help.
