fish-quant/big-fish

Is there a way outside of visual inspection to set threshold value for watershed segementation?

buttf7 opened this issue · 1 comments

Is this possible?

Hi @buttf7,

I have nothing in mind. Threshold value is used to threshold the cell image and build a binary mask of the cells. Instead of using the function bigfish.segmentation.cell_watershed, you can use bigfish.segmentation.get_watershed_relief and bigfish.segmentation.apply_watershed, providing your own binary cell mask. Something like that:

# build relief
relief = get_watershed_relief(image, nuc_label, alpha)

# build cell mask
cell_mask = None

# segment cells
cell_label = apply_watershed(relief, nuc_label, cell_mask)

To get the cell mask, maybe you can try a more subtil Otsu thresholding or directly go for a deep learning method. we also provide a pretrained Unet model with bigfish.segmentation.unet_distance_edge_double and bigfish.segmentation.apply_unet_distance_double that does exactly that. The unet is used to predict a cell mask and the relief image on which we apply a watershed.