How can I extract the inner cell body(s) from the cell capsule in images (grayscale) such as these ??

1 view (last 30 days)
This is what I have written so far but I cannot seem to get the exact shape of the cell body in the mask
image_file = 'IMAGE_LOCATION';
image = imread(image_file);
figure
imshow(image);
image = adapthisteq(image);
figure
imshow(image);
image_wth = image - imopen(image, strel('disk', 5));
figure
imshow(image_wth);
image_bw = imbinarize(image_wth);
image_bw = bwareaopen(image_bw, 20);
image_bw = imclose(image_bw, strel('disk', 5));
image_bw = imfill(image_bw, 'holes');
B = bwboundaries(image_bw);
figure
imshow(image_bw);
hold on
visboundaries(B);
figure
imshowpair(image_wth, image_bw);
key = waitforbuttonpress;
close all
  1 Comment
Gaurav Kudva
Gaurav Kudva on 6 Feb 2018
Edited: Gaurav Kudva on 6 Feb 2018
This is what the result looks like for the first image using the code given above.
But a part of the first cell body is missing in the mask.
So I need help in extracting the exact shape of the cell body in the mask. How do I go about it ??

Sign in to comment.

Answers (1)

Arun Mathamkode
Arun Mathamkode on 22 Feb 2018
To get good results you have to finetune the parameters in the algorithm. For example, giving a lower threshold for imbinarize function (may be 0.1) will give you complete mask. Although I am not much clear about the algorithm you are using, I believe it is heavily depended on multiple parameters. Tuning these parameters for different images will be difficult.
If we can assume the cell body will be approximately circular, we can use imfindcircles to detect the circles in the image and use imfill to create the mask from the circle boundaries. I believe this approach will be more robust.

Community Treasure Hunt

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

Start Hunting!