"Adding data failed" Files edited with "Segment Editor" cannot be reopened

using slicer 5.6.2 on win11

we are segmenting a few hundred mri brain images.
we have mri scans stored in .nii.gz format.
we have segmentations stored in the same .nii.gz format.

now we are adding new features so we have to edit the segmentations.
opening scans & segmentations via drag and drop…
scans as VOLUMES
segmentations as SEGMENTATION

after editing (it is really cumbersome that Slicer doesn’t remember the settings ;( )
we save the new segmentation as .nrrd segmentations.

NOW! We reopen this .nrrd segmentations as VOLUMES and save the segmentations as .nii.gz again.
That works in many cases, BUT there are lots of cases where we get an error:

Adding data failed
Error occurred while loading the selected file
Click “Show details” button to…

End the info of the “Show details” button is:
Error: …file… - load failed.

Any idea how we can solve this problem???
Thanks for your help.

Please use seg.nrrd format to keep your segmentations, if you want to avoid issues like this.

Slicer remembers the settings. If you can give more details about what details are not preserved then let us know.

If you provide more information (for example, an image that cannot be opened) then we can have a look. However, I agere with @muratmaga - there is a good chance that the issues are due to that you are using NIFTI file format. NIFTI is not a general-purpose 3D image file format and it suffers from ambiguities and has serious limitations.

thank you for your help…
can you give me an address where I can show such files?
This is multi-center machine learning data. So there are no .nrrd files.

Oh really?
What I mean:
when I do the next segmentation and I open the segmentation in the segment editor, for example the 3d view is inactive at the start… I would like to have it active…
e.g. Paint tool:
Diameter of paint tool is 3% I need 1%
Sphere brush is inactive, I need it active…
Editable intensity range is inactive… need it active…
and so on… other tools as well.
that would be really nice to have…

You can post it on dropbox, google drive, onedrive publicly and share the link:

here are links to 2 .nrrd files…
in this case the files can be opened as .nrrd but not as volume
→ cannot be stored as nifi then…

have to look for those that cannot be reopened in both ways… (perhaps they are redone meanwhile…)

?? no idea if it works…

You did not publicly share.

Training_226_seg.nii.nrrd - Google Drive, Training_201_seg.nii.gz.nrrd - Google Drive

so hope it works now…

I was able to open both files and load them as segmentations without any problem or error messages. I didn’t have to change anything or set any option. I can edit them as well.

What is the specific problem you are facing?

yes that is correct.
the problem is: how to convert it into niftis again?
when I want to store it as nifti, I have to open it as VOLUME and that doesn t work…
is there a workaround?
thanks…

(there just one or two that don t open as segmentation & volume but thats not a problem to segment this number again… )

As we me

As we mentioned before, you will run into issues if you try to save a segmentation file as a nifti and try to load it as a segmentation into Slicer. NIFTI format will not store all the necessary information (like segment names, colors etc), and Slicer will have trouble reading back as a segmentation.

If you must save a nifti for some reason, then first export your segmentaiton as a labelmap, then you can save it as nifti. However, you will loose things like segment names and colors. To avoid that you can also look into creating a custom color table.

brilliant! segment names & colors don t matter…
thank you!