I have two images one for cell and other for corresponding nuclei. My criteria for overlapping is that if the any cell is shown as a single connected component but their are more than one nuclie enclosed in the boundary of the connected component of cell. Suppose, If I have two nuclie in a connected component of cell then we have to separate that cell region into two connected components each having one nuclie and similarly for if more nuclie. I have tried used watershed algorithim in the IPT but didn't make much out of it. Please help me out to segment only such overlapping cells to their corresponding nuclei and not the ones in there is only one nuclei for one cell. (RUN THE CODE ONCE) Thanks in advance.
nucleus_gray = imread('nuclei.jpg'); cell_gray = imread('cell.jpg');
level = 0.17; Ithresh_nucleus_1 = im2bw(Inucleusgray, level);
level2 = 0.18; Ithresh_cell_1 = im2bw(Icellgray, level2); Ifilled = imfill(Ithresh_cell_1, 'holes'); Ithresh_cell_1 = bwareaopen(Ifilled, 245);
s = regionprops(Ithresh_nucleus_1, 'centroid'); centroids = cat(1, s.Centroid);
imshow(Ithresh_cell_1) hold on plot(centroids(:,1), centroids(:,2), 'b*') hold off