hello i'm a beginner of using matlab
and as part of my Homework. i need to detect infected white cells in image and count them where the Nucleus of an infected white cell large and color Blue.
Original Image
Explain Image:
so i try to isolate the whit cells then detect the infected white cells but i'm stuck and do not what to do i will write my code and mention where i stuck and please if three is anther way to do this pleas help
convert the image from RGB
to YcBcR
space color to detect the whit sells
OrgenalImg = imread('D:\Users\FADI\Desktop\cells\cells1.jpg');
CopyOfOrgenalImg = OrgenalImg;
YcbcrImage = rgb2ycbcr(CopyOfOrgenalImg);
cb = YcbcrImage(:,:,2);
cr = YcbcrImage(:,:,3);
[r,c,v] = find(cb>=77 & cb<=127 & cr>=133 & cr<=173);
index1 = size(r,1);
%Mark the white cell pixel
for i=1:index1
CopyOfOrgenalImg(r(i),c(i),:) = 255;
end
figure, imshow(CopyOfOrgenalImg);title('White Cells');
the White Cells image:
2.here i'm stuck i try to convert the White Cells image to gray grayscale
to delete and remove the unwanted shape but i can't find way to do that so pleas help and how can i continue in my homework to detect and count the with cells and if there is anther ways to do this pleas let me know thanks in advance on any help.
What do white blood cells look like? Contrary to their name, white blood cells are colorless but can appear as a very light purple to pink color when examined under a microscope and colored with dye. These extremely tiny cells have a round shape with a distinct center membrane (nucleus).
Given that all white blood cells are over 5 micrometers in diameter, they are large enough to be seen using a typical optical microscope (compound microscope). Staining with Leishman's stain makes it possible to not only easily identify different types of leukocytes, but also count them.
Thin sections of white blood cells from human being, guinea pigs and cats are examined under the electron microscope.
Dectin-1, a receptor on the surface of white blood cells, recognizes specific components of fungal cell walls, and alerts or “switches on” the immune cells to prepare to fight the infection.
You might attempt this by thresholding the image based on the blue channel to identify regions corresponding to each cell. For a non-research/homework exercise this may be sufficent given a carefully chosen threshold (0.66 in code below). Then you can iterate through each connected component and make a decision based on the area. In a real-world situation you would train up a system based on some kind of shape descriptor for this, but given you have only 2 example images some kind of hard-coded heuristic like this seems unavoidable.
Here is one solution:
INFECTED_AREA_THRESHOLD=3000;
img=double(imread('\cell.jpg'))./255;
blueness=img(:,:,3)./(img(:,:,1)+img(:,:,2)+img(:,:,3));
blueness=blueness./max(max(blueness));
cellmask=blueness<0.66;
cellmask=bwfill(~cellmask,'holes');
map=bwlabel(cellmask);
labels=setdiff(unique(map),0)';
infectedcomponents=zeros(size(img,1),size(img,2));
areas=[];
infected=0;
for thislbl=labels
connectedcomp=(map==thislbl);
thisarea=sum(sum(connectedcomp));
areas=[areas; thisarea];
if (thisarea>INFECTED_AREA_THRESHOLD)
infected=infected+1
infectedcomponents=infectedcomponents | connectedcomp;
end
end
imshow(rgb2gray(img).*infectedcomponents);
title(strcat(num2str(infected),' infected components detected'));
sort(areas)
The decision to threshold at 3000 was made by inspecting the list of component/cell areas in variable "areas". The blue threshold of 0.66 was by trial and error.
Sample output:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With