Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Improving cell detection using watershed function for segmentation
Replies: 0

 David Posts: 1 Registered: 4/28/13
Improving cell detection using watershed function for segmentation
Posted: Apr 1, 2013 6:30 PM

Hey,
I have a rather noisy image with stained nuclei of cells. I want to detect single nuclei and then recognize their center.
I'm quite new to image processing, I've read through a bunch of cell detection posts.
The one I found especially useful:
http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/
I completely understand what he does and my code is pretty much the same so far, besides that I adjusted parameters:

clear;
close all;

I = imread('Captured DAPI 20x 1.jpg');
figure, imshow(I),title('I')

Igray=I(:,:,3);
figure, imshow(Igray)

%figure, imshow(I_eq), title('I_eq')
I_eq=Igray;

bw = im2bw(I_eq, graythresh(I_eq));
figure, imshow(bw)

bw2 = imfill(bw,'holes');
figure, imshow(bw2)
bw3 = imopen(bw2, ones(5,5));
figure, imshow(bw3)

bw4 = bwareaopen(bw3, 40);
figure, imshow(bw4)

bw4_perim = bwperim(bw4);
figure, imshow(bw4_perim)

overlay1 = imoverlay(I_eq, bw4_perim, [.3 1 .3]);
figure, imshow(overlay1)

overlay2 = imoverlay(I_eq, bw4_perim | mask_em, [.3 1 .3]);
figure, imshow(overlay2)

I_eq_c = imcomplement(I_eq);

I_mod = imimposemin(I_eq_c, ~bw4 | mask_em);

L = watershed(I_mod);
figure, imshow(label2rgb(L))

figure, imshow(I_eq), hold on
himage = imshow(label2rgb(L));
title('Lrgb superimposed transparently on original image')

Especially important is the mask line: