来自给定图像的细胞计数

时间:2015-05-04 18:49:56

标签: matlab image-processing

我无法弄清楚如何计算下图中的大单元数。 enter image description here

1 个答案:

答案 0 :(得分:5)

Since the cells of interest look quite circular you can use imfindcircles in the Lab colorspace, which is more suitable to work with here than the RGB space given the ~purple colors from the H&E staining of the cells.

So basically convert the color space, then apply a threshold on the 3rd channel in which the large cells are the most bright, and then apply imfindcircles. Note that here the Edge property has to be quite low in order to distinguish cells close to one another (as in the lower left of your image). Moreover, my version of Matlab does not support rgb2lab so I used makecform to convert between color spaces.

Here is what the 3 channels of the image in the Lab colorspace look like:

enter image description here

As you see, the large cells with the big nucleus that seemed the brightest stand out quite a lot in the 3rd channel. Thus we will threshold only this channel for the rest.

In order to get the # of detected cells simply ask for the number of radii given by the function imfindcircles (numel(radii)).

clear
clc

close all

Im = imread('Cells.jpg');

%// Transform to Lab color space
cform = makecform('srgb2lab');
Im_lab = applycform(Im,cform);

%// Apply threshold
Im_lab = im2bw(Im_lab(:,:,3),.35);

%// Detect ~circles
[centers, radii] = imfindcircles(Im_lab,[12 35],'Sensitivity',0.7,'Edge',0.1,'ObjectPolarity','dark');

imshow(Im);
hold on
viscircles(centers, radii,'EdgeColor','k','LineWidth',4);

NumCircles = numel(radii);

%// Display message box
Msg = sprintf('You have just found %i circles!!!\n',NumCircles);

msgbox(Msg)

Output:

enter image description here