# How to export segmentation label from volume to surface mesh on the fly?

**URL:** <https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094>\
**Category:** Support\
**Created:** [November 9, 2019, 10:08am UTC](https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094 "2019-11-09T10:08:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ButuiHu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/butuihu/32/2386_2.png) [@ButuiHu](https://discourse.slicer.org/u/ButuiHu)\
**Post date:** [November 9, 2019, 10:08am UTC](https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094/1 "2019-11-09T10:08:35Z")

</div>

I’m trying to computes and displays surface-to-surface distance between two triangle meshes using [3DMeshMetric](https://www.nitrc.org/projects/meshmetric3d), which need a vtk format input. So I create one using model maker module in 3D Slicer. But it seems that model maker module generates newer version of vtk data file format which is not supported in 3DMeshMetric, I got unknown keyword error when load the vtk files. Then I try ITK-SNAP’s segmentation export, and it works well. How could I do this job with python script using SimpleITK, VTK or some other similar packages, so that I could convert many volume to vtk file needed in 3DMeshMetric?

I notice that there is a Model to Model distance module in 3D Slicer, which might be the same as 3DMeshMetric. However, I found the visualization of suface distance is more fancy with a colorbar.

---

<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:** [November 9, 2019, 1:55pm UTC](https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094/2 "2019-11-09T13:55:43Z")

</div>

Some software have problems with binary mesh files, so you can try to uncheck “Compression” option in Save dialog when exporting.

Yes, you can compute surface metrics within Slicer, too. You can show any color scheme, show color bar, etc. See some more info [here](https://discourse.slicer.org/t/colour-map-for-model-comparison/8446).

---

<div class="post-metadata">

**Author:** ![ButuiHu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/butuihu/32/2386_2.png) [@ButuiHu](https://discourse.slicer.org/u/ButuiHu)\
**Post date:** [December 7, 2019, 10:49am UTC](https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094/3 "2019-12-07T10:49:37Z")

</div>

Yeah, I have tried uncheck the ‘Compression’ option. But 3DMeshMetric complains that there are unrecognized keywords “METADATA” and “INFORMATION”. After manually delete these lines, it works.

---

<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:** [December 7, 2019, 12:00pm UTC](https://discourse.slicer.org/t/how-to-export-segmentation-label-from-volume-to-surface-mesh-on-the-fly/9094/4 "2019-12-07T12:00:10Z")

</div>

> [@ButuiHu](#):
>
> 3DMeshMetric complains that there are unrecognized keywords “METADATA” and “INFORMATION”

This seems to be a bug in 3DMeshMetric. Report these errors to its developers, they should be able to fix this very easily.
