Closed deepakri201 closed 11 months ago
Hi Deepa! Thanks for your suggestion! I was not able to quickly find a way to directly save nii files. I see the script you attached also uses an intermediate file "-label.nrrd". Do you know if there is a way to directly save niftys?
Hi Anna,
So I believe that slicer.util.saveNode works for both nrrd and nii.gz, so instead of:
filepath = outputPath + "/" + referenceVolumeNode.GetName() + "-label.nrrd"
You can instead do:
filepath = outputPath + "/" + referenceVolumeNode.GetName() + "-label.nii.gz"
Yeah so that does not work, I have tried it awhile ago and just now, here is the log: [Python] Failed to save node to file [Python] Error: No writer found to write file .nii.gz of type SegmentationFile.
Is there a functional reason why you convert the nrrd/save the nifti? Why not just save the segmentations as .seg.nrrd? I can think of a few benefits of using .seg.nrrd instead of nifti, such as preserving header/metadata, segmentation color
Good point, the only reason I can think of is the consistency between input and output. Also, nifty also saves headers with metadata (not the color tho)
The inputs can be .nrrd files too (with the new mappings feature). Personally, I think the extension would benefit from saving the segmentations as .seg.nrrd. If nothing else, saves the overhead of re-saving the segmentations as niftis.
i have removed the t.seg.nrrd in the latest commit, saving only nifty files.
Hi Anna,
I've been trying out your extension, thanks for this! I'm also interested in streamlining annotations in Slicer, for DICOM files. :)
I noticed that a t.seg.nrrd file is created when I click 'Overwrite Edited Mask'. I see in your code that you save the segmentation node as t.seg.nrrd, read it in, and write it out as nifti. Perhaps you could convert this seg node into a label map and save it directly out as nifti without the intermediate file.
Maybe something like this from the script repo:
Thanks!