Matlab中的分水岭算法

9

有人知道如何在Matlab中编写函数,使用watershed算法对细胞进行分割,并计算平均细胞面积吗?非常感谢任何帮助。谢谢!

这是酵母细胞的图像。

yeast cells

2个回答

13

这里介绍一种使用分水岭算法对图像进行分割的方法。还有很多其他操作可以进行(例如,如果细胞尚未完成细胞质分裂,则将具有两个细胞核的细胞融合),但以下步骤应该能让你对此有第一印象。

(1)确定细胞与背景的阈值,细胞核的阈值。

%# 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) 平滑原始图像(以避免过分分割)并将细胞核作为最小值施加

[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) 流域、遮罩单元格和显示

ws = watershed(filtImgM);
ws(~cellMsk) = 0;

lblImg = bwlabel(ws);

figure,imshow(label2rgb(lblImg,'jet','k','shuffle'));

enter image description here

(4) 现在您可以在标记图像上使用REGIONPROPS来提取您想要的统计信息。


0

请参考图像处理工具箱中的watershed和“Steve on Image Processing”博客上有关细胞分割的此篇文章


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接