# Export Segmentation as Labeled LabelMap

**URL:** <https://discourse.slicer.org/t/export-segmentation-as-labeled-labelmap/26468>\
**Category:** Support\
**Created:** [November 27, 2022, 11:08pm UTC](https://discourse.slicer.org/t/export-segmentation-as-labeled-labelmap/26468 "2022-11-27T23:08:24Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [November 29, 2022, 1:09am UTC](https://discourse.slicer.org/t/export-segmentation-as-labeled-labelmap/26468/7 "2022-11-29T01:09:01Z")

</div>

> [@apparrilla](#):
>
> It´s strange that Segmentation Module ask you for a ColorTable during export task and labels are not added to the labelmap and output labelmap have no color as @Dolzodmaa_D said.

Because labelmap format does not have a field to store actual labels, only indices. The labels are preserved in the color table that was saved during the export.

See this thread on how to correctly load the labelmap as a segmentation using the color table from the UI. [Copying segment names/colors from one segmentation to another - #7 by lassoan](https://discourse.slicer.org/t/copying-segment-names-colors-from-one-segmentation-to-another/21204/7)

The example I sent you is the programmatic approach to the same thing.

> [@apparrilla](#):
>
> I need to add my cases to VerSe Dataset to retrain a Monai Pipeline with them.

This may or may not be relevant for you, but we encountered an issue when using a labelmaps with non-contiguous numbers, and not starting from 1. We were training a multilabel model, and the source we used had for training had labelmaps that go from 1-50 (with couple gaps) and then 101-103. Monai didn’t like that so we ended having to reorder the labels in a continuous fashion from 1-50. So if your first label has an index of 8, you may or may not encounter the same issue. FYI.

---

_[View the full topic](https://discourse.slicer.org/t/export-segmentation-as-labeled-labelmap/26468)._
