image segmentation in a fluorescent image
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Peyman Obeidy
el 19 de Sept. de 2016
Respondida: Peyman Obeidy
el 22 de Sept. de 2016
This is the code that I put together to count the cells in the attached image, it seems to be on a right track till I reach Overlay1, after this, I can't get a good segmentation. The selected cells in 'overlay1'are the through cells and the non-selected one are bleed-through from another channel (which I dont want to count). I would appreciate your help on this.
clc
clear all;
%I = imread('http://blogs.mathworks.com/images/steve/60/nuclei.png');
I_cropped =imread('JeramTest2-1.png');
%I_cropped = I(400:900, 465:965);
imshow(I_cropped)
I_eq = adapthisteq(I_cropped);
imshow(I_eq)
bw = im2bw(I_eq, graythresh(I_eq));
imshow(bw)
bw2 = imfill(bw,'holes');
bw3 = imopen(bw2, ones(5,5));
bw4 = bwareaopen(bw3, 5);
bw4_perim = bwperim(bw4);
overlay1 = imoverlay(I_eq, bw4_perim, [.3 1 .3]);
imshow(overlay1)
this is not very helpful
mask_em = imextendedmax(I_eq, 20);
imshow(mask_em)
mask_em = imclose(mask_em, ones(1,2));
mask_em = imfill(mask_em, 'holes');
mask_em = bwareaopen(mask_em, 4);
overlay2 = imoverlay(I_eq, bw4_perim | mask_em, [.3 1 .3]);
imshow(overlay2)
I_eq_c = imcomplement(I_eq);
I_mod = imimposemin(I_eq_c, ~bw4);% | mask_em);
L = watershed(I_eq_c);
imshow(label2rgb(L))
L2 = watershed(L);
imshow(label2rgb(L2))
bw5_perim = bwperim(L);
overlay3 = imoverlay(I_eq, bw5_perim, [.3 1 .3]);
end
imshow(overlay3)
0 comentarios
Respuesta aceptada
Gautham Sholingar
el 21 de Sept. de 2016
Hi Peyman,
I understand that you are trying to clean up this image to enable clear identification of the cells in the foreground of your image. Your first attempts have brought you to a point where you oversegment the image when you attempt to use the “watershed” function. This has been discussed as a common issue in MATLAB documentation when using the watershed method for segmentation.
Please refer to the following link for information on how to use the “watershed” function effectively:
In the meantime, another strategy that could prove very useful is background subtraction. I have modified the pre-processing stage before overlay 1 to use the “graythresh” function to extract the background cells and then remove them from the grayscale image. The script also uses the “imbinarize” function with adaptive thresholding to hollow out the cells in a way where it becomes easier to extract boundaries from the image.
The following script will create a 1x3 subplot with the original image, a higher contrast version and a background subtracted version with hollowed out cells. Please feel free to play around with the parameters for the sensitivity of the adaptive thresholding:
clc
clear all;
close all;
%I = imread('http://blogs.mathworks.com/images/steve/60/nuclei.png');
figure
I_cropped = imread('JeramTest2-1.png');
%%Basic image
subplot(1,3,1)
imshow(I_cropped)
title('original image');
%%Increase contrast
subplot(1,3,2)
I_eq = imadjust(I_cropped);
imshow(I_eq)
title('higher contrast')
%%background subtraction
bw_grayThresh = im2bw(I_eq, graythresh(I_eq));
% attempt with different thresholding
bw_adaptThresh = imbinarize(I_eq,'adaptive','Sensitivity',0.65)
subplot(1,3,3)
I_subtracted = I_eq;
I_subtracted(~bw_adaptThresh) = 0;
I_subtracted(~bw_grayThresh) = 0;
imshow(I_subtracted)
title('background subtraction')
These are some useful first steps to improve your solution. Other functions which could prove useful:
Please modify the provided code accordingly to accomplish your objective.
0 comentarios
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!