Label Color Changed after saving

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,

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

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

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.

1 Like

Okay. I will try that. Thanks.

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,

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

Also see this Segmentations — 3D Slicer documentation

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

2 Likes