MATLAB: How to separate touching cells in a binary image and count them

cell countingcell detectioncell recognitionImage Processing Toolboxla-icp-mswatershed

Hello,
I have a greyscale image produced by LA-ICP-MS data obtained from a section of cells ablated for gadolinium distribution. The laser spot size is 5 microns.
The microscopy image taken before laser ablation looks like this.
I want MATLAB to automatically detect the individual cells from the top image and count the number of cells. From this site, I have found codes that can transform the top image into a binary image.
[~, threshold] = edge(I, 'sobel');
fudgeFactor = .5;
BWs = edge(I,'sobel', threshold * fudgeFactor);
figure, imshow(BWs), title('binary gradient mask');
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWsdil = imdilate(BWs, [se90 se0]);
figure, imshow(BWsdil), title('dilated gradient mask');
BWdfill = imfill(BWsdil, 'holes');
figure, imshow(BWdfill);
title('binary image with filled holes');
BWnobord = imclearborder(BWdfill, 4);
figure, imshow(BWnobord), title('cleared border image');
I have also found ways to detect the white blobs and mark them. But as you can see some cells are touching, so they appear as one giant pixelated blob and are detected as one. How can I separate these cells with watershed or other methods?
s = regionprops(BWfinal,'centroid');
centroids = cat(1, s.Centroid);
imshow(BWfinal)
hold on
plot(centroids(:,1),centroids(:,2), 'b*')
hold off
And
stats = regionprops('table',BWfinal,'Centroid',
'MajorAxisLength','MinorAxisLength')
centers = stats.Centroid;
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
hold on
viscircles(centers,radii);
hold off
Many thanks!

Best Answer

Try the method the head of the imaging team at the Mathworks posted: