Interactive Segmentation: Behavior of Background Label


I am currently experimenting with the background label and the interactive Segmentation. When I “lock” the Background, It seems that it locks the invisible “Clear Label” instead of the Background. Is this an intended behaviour? I have seen in the exported NIFTI File that the Background I have annotated has 253 and the real Background the number 0. What would be the best way to work with pre-processed segmentation? For example we would use Unet to pre-segment the lung-lobes, we would then make all other regions other than the lungs to 253 to make it to background. Then we would load the segmentation and could lock the background so we won’t have to worry about other regions other than the lungs. We are not sure if it is better to leave the background as “0” and to lock. It is kind of complicated. I hope I could somehow explain our approach. The main question is, in which way the “interactive segmentation” works better: background annotated as number 0 oder 253 in the pre-processing?

I think you already understood that but, just to prevent any misunderstanding, we need to differentiate two concepts in the interactive segmentation:

  • the “transparent label”, which is represented as a 0
  • the “background pixels”, which are pixels that are marked by the user as definitely not part of any of the labels
    The transparent label serves as “unknown” and the goal of the interactive segmentation will be to fill all the unknown pixels with one of the other label values.
    (this is why we needed to add this additional value).
    Those pixels are indeed internally represented by the value 253. However when you click on the “Accept” button of the Interactive Segmentation, all those values should be replaced by 0.
    Therefore, your label maps should only have 253 values temporarily (in the context of the interactive segmentation).

Now if you have want to refine a segmentation, you should import a label map that mimics what you would do manually via the brush, i.e. set values to pixels which you are sure belong to a specific object (or 253 for the background), and 0 where you want the interactive segmentation to work.

Note that this is roughly what the “Image-based Refine” button of the “Refine” tab does: it creates a margin of 0s around the selected label and runs the same propagation algorithm as the interactive algorithm within this narrow band.

Thank you for your precise reply. It has clarified all my questions.