# Segmentation terminology to labelmap indices

**URL:** https://discourse.slicer.org/t/segmentation-terminology-to-labelmap-indices/27405
**Category:** Support
**Tags:** segmentation, segment
**Created:** [January 22, 2023, 5:24pm UTC](https://discourse.slicer.org/t/segmentation-terminology-to-labelmap-indices/27405 "2023-01-22T17:24:49Z")
**Posts on this page:** 3
**Page:** 1

<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: [January 22, 2023, 5:24pm UTC](https://discourse.slicer.org/t/segmentation-terminology-to-labelmap-indices/27405/1 "2023-01-22T17:24:49Z")

</div>

In the SegmentationCategoryTypeModified-DICOM Master.json file, there are these fields called **3dSlicerIntergerLabel** (like below).

I thought these were the unique ID numbers that will be used when exporting a segmentation to a labelmap. but that doesn’t appear to be the case. Without a color table, segmentations seems to be exported simply by assigning a sequential number to segments in the order they are listed in the segmentations hierarchy.

What is the purpose of this field, and more importantly is it somehow possible to export labelmaps consistently if we use terminology, or regardless we will still need a color table for the correct conversion.

```auto
"CodeMeaning": "Occipital bone",
            "CodingSchemeDesignator": "SCT",
            "3dSlicerLabel": "occipital bone",
            "3dSlicerIntegerLabel": 151,
            "cid": "4028",
            "UMLSConceptUID": "C0028784",
            "CodeValue": "31640002",
            "contextGroupName": "CraniofacialAnatomicRegions",
            "SNOMEDCTConceptID": "31640002"
          },

```

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [January 23, 2023, 10:01am UTC](https://discourse.slicer.org/t/segmentation-terminology-to-labelmap-indices/27405/2 "2023-01-23T10:01:01Z")

</div>

That number is the index of the color in the `GenericAnatomyColors` color table

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

I think you can preserve the indices by checking the `Use color table values` checkbox in Segmentations module, see here

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/4/44ca3295cc8dc52597c4d1ccb47e35a8214d8f57.png)

I’m not sure why only the `User` type color tables show up (at least that’s what happened for me on Linux using 2022-11-13), maybe someone else knows. If not, then let me look in the latest version later.

---

<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: [January 23, 2023, 4:02pm UTC](https://discourse.slicer.org/t/segmentation-terminology-to-labelmap-indices/27405/3 "2023-01-23T16:02:23Z")

</div>

> [@cpinter](#):
>
> I’m not sure why only the `User` type color tables show up (at least that’s what happened for me on Linux using 2022-11-13), maybe someone else knows.

Thats the same behavior I am seeing. I cannot select a color table if I haven’t loaded/generated on in Slicer. I will also argue that this somewhat defeats the purpose of the having a segmentation terminology. If a proper segmentation terminology is used, the export to labelmap needs to happen automatically. I can envision a use case where the user assigns a terminology to a segmentation, and while it is being exported if there are “unnamed” segments (e.g., Segment\_23) this generates a warning error about lack of terminology in the segment.
