Beta Version CountMe

by

 

for minicell image analysis

caliMat=ProcessCalibration(cellArray,maxsize)
function caliMat=ProcessCalibration(cellArray,maxsize)
caliMat1=[]; 
caliMat2=[]; 

for i=1:numel(cellArray) 
%remove the glare 
rollingObject=strel('disk',8); 
background = imopen(cellArray{i},rollingObject);
I2=cellArray{i}-background; 

%convert to black and white ;
level = graythresh(I2);
I2 = im2bw(I2,level);

%improve the contrast
I2=double(I2); 
I3=imadjust(I2); 
 

%label each cell and count 
I4=bwlabel(I3);
count=bwconncomp(I4); 


%get a size distribution of the cells, so you can set a 
%threshold for minicell max size 

cc = bwconncomp(I3, 4);
total=cc.NumObjects; 
cellData = regionprops(cc, 'basic');
cell_areas1 = [cellData.Area]; 
SortedAreas=transpose(sort(cell_areas1)); 

TrueFalse=SortedAreas; 

for j=1:numel(SortedAreas) 
    if SortedAreas(j)>maxsize(i)
        TrueFalse(j)= 1; 
    else 
        TrueFalse(j)=0; 
    end 
end 


% add the new vector to a return matrix part 1 
caliMat1=[caliMat1;SortedAreas]; 

%add the new TrueFalse Group to the return Matrix part 2 
caliMat2=[caliMat2;TrueFalse] ; 

caliMat=[caliMat1,caliMat2] ; 


%{ 
optional: plot the cell arrays in a histogram 
figure, hist(sorted_cell_areas, total);
title('Histogram of Cell Area'); 
x=1:1:total; 
y=sorted_cell_areas(1):1:sorted_cell_areas(end); 
bar(x,sorted_cell_areas);  

%} 
end 
end 

Contact us