image segmentation in a fluorescent image

조회 수: 6 (최근 30일)
Peyman Obeidy
Peyman Obeidy 2016년 9월 19일
답변: Peyman Obeidy 2016년 9월 22일
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.
clear all;
%I = imread('');
I_cropped =imread('JeramTest2-1.png');
%I_cropped = I(400:900, 465:965);
I_eq = adapthisteq(I_cropped);
bw = im2bw(I_eq, graythresh(I_eq));
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]);
this is not very helpful
mask_em = imextendedmax(I_eq, 20);
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]);
I_eq_c = imcomplement(I_eq);
I_mod = imimposemin(I_eq_c, ~bw4);% | mask_em);
L = watershed(I_eq_c);
L2 = watershed(L);
bw5_perim = bwperim(L);
overlay3 = imoverlay(I_eq, bw5_perim, [.3 1 .3]);

채택된 답변

Gautham Sholingar
Gautham Sholingar 2016년 9월 21일
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:
clear all;
close all;
%I = imread('');
I_cropped = imread('JeramTest2-1.png');
%%Basic image
title('original image');
%%Increase contrast
I_eq = imadjust(I_cropped);
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)
I_subtracted = I_eq;
I_subtracted(~bw_adaptThresh) = 0;
I_subtracted(~bw_grayThresh) = 0;
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.

추가 답변 (1개)

Peyman Obeidy
Peyman Obeidy 2016년 9월 22일
Dear Gautham, Thank you for replying to my question. very helpful comments. I used both of your suggestions to improve the contrast and cell detection. I have a script that does a decent job now. Thank you again. Regard Peyman

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by