Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to improve cell detection / image segmentation with watershed

Asked by David on 2 Apr 2013
Latest activity Commented on by Image Analyst on 17 Dec 2013

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 understand what he does and my code is pretty much the same so far, besides that I adjusted parameters:

 clear;
 bclose all;
 I = imread('Captured DAPI 20x 1.jpg');
 figure, imshow(I),title('I')
 Igray=I(:,:,3);
 figure, imshow(Igray)
 %I_eq = adapthisteq(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)
 mask_em = imextendedmax(I_eq, 15);
 figure, imshow(mask_em)
 mask_em = imclose(mask_em, ones(5,5));
 figure, imshow(mask_em)
 mask_em = imfill(mask_em, 'holes');
 figure, imshow(mask_em)
 mask_em = bwareaopen(mask_em, 40);
 figure, imshow(mask_em)
 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));
 set(himage, 'AlphaData', 0.3);

Especially important is the mask line: mask_em = imextendedmax(I_eq, 15);

The Problem I have is if I lower the second parameter too much, I'll get a lots of point that I don't want and are mostly due to noise or I'll end up with two markers in one cell. But with the current setting it doesn't find a maxima region in every cell. Does anybody have a good idea how to improve the mask for the watershed so I'll detect all my cells individually? I know some pre-processing would probably help, but I'm not sure which ones.

Thank you for your help

Here are some pictures for you to see what I mean:

starting image: http://imageshack.us/a/img43/3669/captureddapi20x1.jpg

watershed: http://imageshack.us/a/img839/8830/watershed.jpg

watershed overlay: http://imageshack.us/a/img853/8989/watershedoverlay.jpg

0 Comments

David

1 Answer

Answer by gomathi on 17 Dec 2013

sorry :( this s not the answer but i have a question ... how to improve limits of basic watershed segmentation??

gomathi

Contact us