big-fish icon indicating copy to clipboard operation
big-fish copied to clipboard

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

Open buttf7 opened this issue 3 years ago • 1 comments
trafficstars

Is this possible?

buttf7 avatar May 31 '22 14:05 buttf7

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.

Henley13 avatar Jun 04 '22 06:06 Henley13