I have manual and automated segmentation files in NIFTI format. Now, I am computing some statistical measures, like Jaccard, average distance, etc. But the problem is manual and automated files have different label values. I checked both the files in Slicer and found that “Segment_1” of the automated segmented file matches with “Segment_4” of the manual segmented file. Similarly, “Segment_2” of the automated segmented file matches with “Segment_3” of the manual segmented file. I am assuming due to these issues, I am not getting correct scores.
Is there any way to fix this problem using Slicer? Any help will be highly appreciated.
Label values can change while you are editing a segmentation, because you can split and merge existing segments, create new segments, delete segments, etc.
We developed a robust method for ensuring that imported and exported label values remain consistent. All you need to do is to create a color table that specifies label value, name, and color for each segment (see the file format description here, you can use any text editor to create it). For example, I created this
test.txt file in Notepad:
1 artery 216 101 79 255 2 bone 241 214 145 255 10 connective_tissue 111 184 210 255
Load the created color table file into Slicer. Then, select this color node when you load the labelmap image file (e.g., a NIFTI file) into Slicer (see detailed instructions here):
When you export the segmentation to NIFTI file in Segmentations module, make sure “Use color table values” is enabled and the same color node is selected there (see detailed instructions here):
To simplify this import/export process, I would recommend to store segmentations in .seg.nrrd segmentation files (nrrd files with custom attributes that specify segment label values and colors). Using segmentation files have the advantage that you don’t rely on external knowledge about what each label value encodes. This is very useful because for example each project specifies meaning of label values differently, therefore you cannot use the same NIFTI files across different projects, while the same .seg.nrrd files can be safely used in many projects without modifications.