如何使用Matlab正确镶嵌图像的细胞? [英] How to properly tesselate a image of cells using matlab?
问题描述
我有以下图片是胰腺细胞的照片
I have the following picture which is a photo of pancreatic cells
我想做的是能够获得每个细胞的膜(红色细丝),然后进行细分,以了解细丝的长度. 到目前为止,我已经尝试使用matlab网站上给出的示例,但结果并不是很好...
What I would like to do is being able to get the membrane of each cell (red filament) and then do a tessellation in order to get an idea of the length of a filament. So far I have tried to use the example given on the matlab website but the result is not really good...
I = imread('picture.tiff');
I_gray = rgb2gray(I);
[~, threshold] = edge(I_gray, 'sobel');
fudgeFactor = .5;
BWs = edge(I_gray,'sobel', threshold * fudgeFactor);
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWsdil = imdilate(BWs, [se90 se0]);
我一直在寻找其他方法来做这件事,但是却没有令人满意的结果……有办法吗?也许使用除matlab之外的其他软件可能会更有效率.预先谢谢你!
I have been searching for hours other way to do it but without any satisfying result... Is there a way to do so ? Maybe an other software than matlab could be more efficient. Thank you by advance !
推荐答案
我对细胞或镶嵌或其他任何东西一无所知.但是,如果您想在非统一的背景下检测这些斑点,那么我可能会有所帮助.由于背景不一致,您需要单独分析斑点.您不能只是设置固定的阈值来一次检测所有斑点.首先,您将单独检测每个斑点,然后使用单独的阈值.这是示例
I don't know anything about cells or tessellation or whatever. But if you want to detect those blobs in a non uniform background, then I might help. You need to analyse the blobs individually because of the non uniform background. You can't just set a fixed threshold to detect all blobs at once. First, you will detect each blob individually and then use individual threshold. Here is the example
原始图像
im=imread('gxGkH.jpg');
figure,imagesc(im);axis image;
我只选择蓝色进行分析
imb=im(:,:,3);
figure,imagesc(imb);axis image;
1)模糊图像,因为模糊后斑点会出现局部 中心处的最大值/最小值
1) Blur the image, since after blurring the blobs will have local maxima/minima at their centres
sigma=7;
kernel = fspecial('gaussian',4*sigma+1,sigma);
im2=imfilter(imb,kernel,'symmetric');
figure,imagesc(im2);axis image;
2)使用分水岭变换来分离每个斑点区域
2) Use watershed transform to separate each blob region
% L = watershed(im2);
L = watershed(max(im2(:))-im2);
[x,y]=find(L==0);
绘制边界
figure,imagesc(im2),axis image
hold on, plot(y,x,'r.')
3)在这里,我分别分析每个斑点,并为 每个斑点,然后我检测到斑点并结合所有检测结果
3) Here I analyse each blob individually and find an otsu threshold for each blob, then I detect the blobs and combine all detections
tmp=zeros(size(imb));
for i=1:max(L(:))
ind=find(L==i);
mask=L==i;
[thr,metric] =multithresh(imb(ind),1);
if metric>0.7
tmp(ind)=imb(ind)>thr;
end
end
消除噪音
tmp=imopen(tmp,strel('disk',1));
figure,imagesc(tmp),axis image
如果背景的对比度高于斑点,那么您将不需要在分水岭变换中反转图像.
If the background has higher contrast then the blobs, then you won't need to invert the image in watershed transform.
这篇关于如何使用Matlab正确镶嵌图像的细胞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!