Shifted labels after auto segmentation caused by empty segments #809
-
Hello, I am testing the 'the radiology/segmentation' app with my own pretrained model and my local data for organ segmentation on abdominal CT. I am using MONAILabel version 0.4.0rc3 and 3D Slicer 5.1.0 r30918. I've noticed that if any of the labels are empty, for example, in case an organ happens to be out of frame in the particular image, then the existing segmentations are shifted when the result is loaded to Slicer after clicking 'Run' in the Auto segmentation function. Looking a bit into it, the result json file created in 'InferTask' includes the correct labels in "label_names", and the temporary file created during inference also contains the correct label numbers, although this seems to not be enough for Slicer to load the segmentation correctly (I found this related discussion: https://discourse.slicer.org/t/empty-segments-cause-shift-in-segment-index-when-reloaded/11212). Here is an example with a network pretrained for organ segmentation where the bladder is only included in some images: and the output in Slicer's console: the output in Slicer's console shows all the labels, but only creates four segmentation ids: This may not be a big deal in cases like the multiorgan segmentation example (although it will probably fail if a patient happens to have only one kidney, for example), but it is very bad for other cases such as vertebrae segmentation when all the possible vertebrae are usually not included in many of the images. Any ideas of what would be the easiest way to solve this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @marianabb, Thanks for the detailed comment. For the MONAI Label module we use these colors to represent the different organs: https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabelLib/labelcolors.py#L1 If an organ is not on the list, it takes a random color: https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabel.py#L1621 @SachidanandAlle please keep me honest here My suggestion for having the same color is to follow the same organ names as in the list. For instance, I'd call urinary bladder to what you called bladder, etc Hope this helps |
Beta Was this translation helpful? Give feedback.
Hi @marianabb,
Thanks for the detailed comment.
We've been discussing how to sort of standardizing the color for the different segments. Here @lassoan opened an issue in the NGFF repo to see the interest of the community.
For the MONAI Label module we use these colors to represent the different organs: https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabelLib/labelcolors.py#L1
If an organ is not on the list, it takes a random color: https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabel.py#L1621 @SachidanandAlle please keep me honest here
My suggestion for having the same color is to follow the same organ names as in …