When I export multiple segmentations within one .nii file, and reopen it, the initial names of the segments are lost. Is there any way to save the names of the segments? Thanks
The Slicer-native format for saving segmentations is .seg.nrrd
. It is expected to suffer data loss when exporting to other formats.
First of all, I would not recommend using NIFTI files, ever. They have some advantages compared to general-purpose file formats if you store brain MRI images (they can store some MR imaging specific fields), but they are really bad for any other purpose. It is an unnecessarily complex yet extremely limited file format. For example, it has two ways to store image orientation (which can make interpretation if NIFTI images ambiguous), but it cannot store simple extra metadata like segment names.
I would recommend to use NRRD file format to store the segmentations. It is a very simple file format yet it allows saving custom information, such as segment names and colors.
If you want to create segmentations with archival quality (so that you can use it several years later, or the segmentations can be used in multiple projects) then you can use standard terminology (double-click on the colored box next to the segment name). When you want to use the segmentation for training a network, you can use slicerio Python package to specify what label value should be used for what segment as shown in this example.
Makes sense, thanks a lot!