conversion NII to NRRD segmentation


I used Slicer 5.0.3 to segment brain lesions on MRIs. After that, I converted the seg.nrrd files into nii.gz files to fit in my coregistration workflow (I have to work on different dates for each patient).

Whereas the conversion of the segmentations from nrrd to nii was fairly simple, using sitk.writeimage, the inverse does not seem to work.
It produces a seg.nrrd file of one slice (instead of 3D) which seems to be empty when I load it with Slicer.

I would really appreciate your help, or your ideas!
Thanks a lot,

What format your registration pipeline is outputting? If you registration pipeline is creating new label maps in a format slicer understands (like nii.gz), you can load them directly into Slicer as segmentation without having to do any conversion. Just expand the load dialog box option, and at the description field instead of default volume choose “Segmentation”

Thanks a lot for your quick answer !
I didn’t think that Nifti format could be recognized as segmentation since Slicer only proposes nrrd and vtm format when I save my label maps.

I believe any volumetric format that Slicer understands can be imported as a segmentation. The quality of the output you are going to get out of that process can vary though (based on the format). So give it a try… But for the segmentations you are doing in Slicer, it is best to keep them in the seg.nrrd format.