Turn 3D binary segmentation masks into instance segmentation masks

Hi guys,

I’m struggling these days trying to find a good way to turn 3D binary semantic segmentation masks into instance segmentation masks. The data I’m working on is 3D C. elegans data, I got the binary semantic segmentation masks with 3D U-Net. But I find it is very hard to turn these binary masks into instance masks.
I’ve tried watershed postprocessing (watershed on smoothed Euclidean distance transform), but the result is very ugly, with many oversegmented or unsegmented cells (see attached), though I’ve explored many parameters in the watershed pipeline. I’m wondering if there are better ways to convert these binary masks into instance masks.

Any help/advice would be appreciated! Thanks very much!

t162.tif (1.0 MB)

t162_watershed_segmentation_8bit.tif (8.0 MB)

It looks like your cells are fairly nicely formed. Have you tried StarDist, either 2D or 3D? There are some premade 2D models, but you might need to annotate some data for a 3D model. There was a post a while back on selecting software to generate 3D annotations.

An example of 2D stardist that somewhat matches your example data.


A 3D model would be of more use to you, I think, as it would match up the cell objects in different layers of the Z-stack automatically, but as far as I know, you would need to train your own, unless that has changed.

Thanks for the advice!
I’ve tried StarDist3D before and it works good. I just want to see if it is possible to use 3D U-Net and postprocessing to do instance segmentations then compare these methods.
The data I’m testing is an 3D ground truth binary annotation, not real microscopy images. I want to see if the postprocessing pipeline works or not on the simple non-noise grouth truth binary masks, then transfer the pipeline to real images. But I’ve be stuck here… Maybe my watershed setting is not good enough. My data is anisotropic. I read from somewhere that to get good watershed performance, the data should be isotropic, so this may cause bad results.
Meanwhile, I’m exploring some clustering or blob detection methods, I’ll test them if I find an appropriate one.

@guiwitz
Hi Guillaume!
Not sure if you have any thoughts on this?
Thanks very much!