Closed kretes closed 6 months ago
Thanks for sharing this code. We definitely need to add functions for creating .seg.nrrd files from scratch. Your code looks nice, but it would need to be extended with at least these two features before I would promote it as the way of creating segmentations:
Thanks for the reply!
Shared labelmap makes sense, I will switch to this style for my needs as well. I will post the updated version that will let the user control this behaviour.
Terminologies seems like something that should be done on top of this util. It just defines the segment_names
. In my use case segment nnames are dynamic, as I generate seg.nrrd
to understand predictions from a nodule detection model. So I put there some metadata like model's confidence.
It is better not to pollute the segment name with additional metadata. You can put extra information in segment tags (key/value pairs).
These tags are easily accessible in Slicer for Python scripts.
Currently, the tags are only shown in the Data module, but we could also think about making it more easily accessible (maybe show selected tag values in additional columns in the segment list?). In the meantime, you can write a short Python script to retrieve the tags and display them somewhere.
This feature is available now - see example here: https://github.com/lassoan/slicerio?tab=readme-ov-file#create-segmentation-file-from-numpy-array
Maybe that's something obvious but what I just needed was a simple tool to name the segments in nrrd.
It turned out that this works to create a valid
seg.nrrd
for Slicer:Leaving it here for others finding the same need. Would this be something worth adding in this or extended way to
slicerio
?