# Label Color Changed after saving

**URL:** <https://discourse.slicer.org/t/label-color-changed-after-saving/33070>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [November 27, 2023, 6:56pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070 "2023-11-27T18:56:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/reza/32/69926_2.png) [@Reza](https://discourse.slicer.org/u/Reza)\
**Post date:** [November 27, 2023, 6:56pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/1 "2023-11-27T18:56:11Z")

</div>

Hi,

After segmenting with Segment Editor Module and saving it, I closed 3D slicer and then I tried to reload my segmentation, but I noticed that the label colors have been changed. For example, I segmented a tumor with label color 31, necrosis with label color 15, and fat with label color 12. After saving my work, I re-opened the saved files (label and etc.) in 3D slicer and found out that the labels have changed to 1, 2, and 3! How can I fix this issue?

Thank you,

---

<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 27, 2023, 8:09pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/2 "2023-11-27T20:09:28Z")

</div>

Are you exporting your segmentation to a labelmap, or are you saving them as seg.nrrd?

---

<div class="post-metadata">

**Author:** ![Reza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/reza/32/69926_2.png) [@Reza](https://discourse.slicer.org/u/Reza)\
**Post date:** [November 27, 2023, 8:15pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/3 "2023-11-27T20:15:56Z")

</div>

Hi, I am segmenting to a labelmap. Also, I tried saving as seg.nrrd, but same the issue happend.

---

<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 27, 2023, 8:46pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/4 "2023-11-27T20:46:07Z")

</div>

This should not happen if you keep the segmentation in seg.nrrd format. Make sure you are saving the original segmentation, not the exported labelmap in this format.

---

<div class="post-metadata">

**Author:** ![Reza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/reza/32/69926_2.png) [@Reza](https://discourse.slicer.org/u/Reza)\
**Post date:** [November 28, 2023, 1:09pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/5 "2023-11-28T13:09:43Z")

</div>

Okay. I will try that. Thanks.

---

<div class="post-metadata">

**Author:** ![Reza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/reza/32/69926_2.png) [@Reza](https://discourse.slicer.org/u/Reza)\
**Post date:** [November 28, 2023, 2:25pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/6 "2023-11-28T14:25:29Z")

</div>

When I save it in seg.nrrd, there would be no issue. But the thing is that I want to save it in Nifti format, because the algorithm we use for feature extraction is based on Nifti format(nii). So, after I am done with the segmentation in “Segment Editor Module”, I go to “Import\export nodes”, then I go to the Export/Import models and labelmaps and put the **Operation** on **Export** and the **Output type** on **Labelmap** and then I click on Export. Then for saving the segmentation, I uncheck the “Segmentation.seg.nrrd” box and I change the “Segmentation-label.nrrd”'s format to **Nifti**. After I am done with saving, and when I re-open my segmentation, I see that the labels have been changed.  
Which part did I do wrong and what can I do to fix it?  
Is there any way to save my segmentation in Nifti format?

Thank you,

---

<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 28, 2023, 3:43pm UTC](https://discourse.slicer.org/t/label-color-changed-after-saving/33070/7 "2023-11-28T15:43:29Z")

</div>

If you need to export your label with assigning specific indices, then you need to create a color table and specify that. Specifically you need to use this section of the `Segmentations` module:

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

Also see this [Segmentations — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html#export-segmentation-to-labelmap-volume-file)

**The label value is index of the color table entry that has the same name as the segment name.**
