Matlab watershed algorithm

Does anyone know how to write a function in Matlab to segment cells and calculate the average using a watershed algorithm? Any help is appreciated. Thanks!

Here is an image of yeast cells

yeast cells

+8
matlab image-segmentation report watershed
source share
2 answers

Here is one way to segment an image using a watershed. There may be much more (for example, cells with two nuclei, if they have not completed cytokinesis), but the steps below should give you the first idea.

(1) Determine cell background threshold, cell nucleus threshold

%# read image img = imread('http://i.stack.imgur.com/nFDkX.png'); %# normalize to 0...1 imgN = double(img-min(img(:)))/(max(img(:)-min(img(:)))); th1=graythresh(imgN); th2 = graythresh(imgN(imgN>th1)); cellMsk = imgN>th1; nucMsk = imgN>th2; figure,imshow(cellMsk+nucMsk,[]) 

enter image description here

(2) Smooth the original image (to avoid overshoot) and apply kernels as lows

 [xx,yy]=ndgrid(-5:5,-5:5); gf = exp((-xx.^2-yy.^2)/20); filtImg = conv2(imgN,gf,'same'); figure,imshow(filtImg,[]) filtImgM = imimposemin(-filtImg,nucMsk); 

enter image description here

(3) Watershed, masking masks and display

 ws = watershed(filtImgM); ws(~cellMsk) = 0; lblImg = bwlabel(ws); figure,imshow(label2rgb(lblImg,'jet','k','shuffle')); 

enter image description here

(4) Now you can use REGIONPROPS on the labeled image to extract the desired statistics.

+13
source share

See watershed in the Image Processing toolbar and this post on cell segmentation on the Steve on Image Processing blog.

0
source share

All Articles