I'm having trouble separating cells in microscope images. When I apply a watershed transform I end up cutting up cells into many pieces and not merely separating them at the boundary/minimum.
I am using the bpass filter from http://physics.georgetown.edu/matlab/code.html.
bp = bpass(image,1,15);
op = imopen(bp,strel('ball',10,700));
bw = im2bw(bp-op,graythresh(bp-op));
bw = bwmorph(bw,'majority',10);
bw = imclearborder(bw);
D = bwdist(~bw);
D = -D;
D(~bw) = -Inf;
L = watershed(D);
mask = im2bw(L,1/255);
Any ideas would be greatly appreciated! You can see that my cells are being split apart too much in the final mask.
Here is the kind of image I'm trying to watershed. It's a 16bit image so it looks like it is all black.
Starting fluorescent image
Final image mask:
I separated the cells manually here:
Finding the centers of the cells should be relatively straight-forward: finding a local maxima of the intensity. Using these points as seeds for the watershed, you might find this tutorial useful.
Some morphologcal operations you might find useful are:
- imimposemin
- forcing a seed point to be a local min when computing the watershed transform.
- imregionalmax
- finding local maxima of intensity image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With