Segmentation not working properly?

I want to segment tumors from stomach. 'u2.png' is the original image. The region inside the red boundary should be the actual segmentated region. However, my segmentation result is 'u1.png', which is not correct. I tried the method below. Any suggestions would be appreciated, Thank you.
m=imread('u2.png');
T = graythresh(m); % find the threshold for input image
S = imbinarize(m,T); % Segment the image using thresholding
figure, imshow(S,[])
binaryImage = imfill(S, 'holes');
figure, imshow(binaryImage)
BW = bwareafilt(binaryImage, 1);
figure, imshow(BW)
img_class=class(j);
fill=cast(BW,img_class);
m1=fill.*j;
figure,imshow(m1)

9 Commenti

You have a grayscale image, and you let graythresh() pick out a binary discretization level, and then you complain that the region implied by that discretization is not the one you want. How is graythresh() supposed to know that you want the level chosen to carefully include that entire sub-blob without extending to other areas of the blobs and without accidentally picking out bright portions of the rest of the image ? Isn't that expecting a bit much from a function that merely does a form of statistical calculation that is independent of pixel location?
I understand your statement. This was one of the processes that I tried. I also tried the region growing segmentation method below. The result is 'u3.png'. However, the result is not accuracte. I am actually looking for a method that could give me the correct segmentation result as close as possible.
j=rgb2gray(imread('u2.png'));
figure, imshow(j)
[x,y]=getpts;x=round(x);y=round(y);
a=imgaussfilt(m,2);
% a=rgb2gray(a);
b=adapthisteq(a);
m=regiongrowing_MLT(b,x,y,15);
figure,imshow(m,[])
seg2=double(j).*double(m);
figure, imshow(seg2,[])
I worked at a research institution. At one point we invested a bunch of time trying to automatically detect brain tumors from images. Our results after a few years was that using those kinds of image processing techniques to detect tumors from images was too inexact for actual use -- too many false positives, too many false negatives. We could seldom reliably get more than 78% accuracy, which just is not good enough for clinical work.
What worked much better for us was using MRS (Magnetic Resonance Spectroscopy) instead of MRI (Magnetic Resonance Imaging.) The analysis of the chemical composition at points was significantly more precise than trying to analyze through visual techniques. One of the most significant chemical indicators we found became quite active even in regions that had no visual indication.
Our work predated widespread Deep Learning, so we never tried that -- but in our experience the sorts of techniques you are using just are not good enough (other than perhaps as a pre-pass to point out the obvious, with the understanding that a clinician was going to have to manually review all of the images anyhow.)
Thank you for your valuable suggestions. I would look for other techniques.
Is it possible to create a window around the initial seed point of any algorithm. I tried to select the initial seed point by using the code below, but I am unable to create a window around the seed point(e.g. a 5*5 window)
j=rgb2gray(imread('IMG-0012-00218.png'));
figure, imshow(j)
[x,y]=getpts;x=round(x);y=round(y);
You can crop the image, or you can mask out the remainder of the image.
Question: how do you want to handle the situation where the initial user selection is within 2 pixels of the edge? Do you want to use a smaller window, or do you want to move the window so that it is completely inside the image even if that means that the window is not centered on where the user pointed to?
You raised a very good point. I want to create a 5*5 window around the user's input point. If the input point is within 2 pixels of the edge, I would like to move the window so that it is completely inside the image even if the window is not centered where the user pointed to.
j=rgb2gray(imread('IMG-0012-00218.png'));
figure, imshow(j)
[numrow, numcol] = size(j);
[x,y]=getpts;x=round(x);y=round(y);
x = max(3, min(x, numcol-2));
y = max(3, min(y, numrow-2));
a 5 x 5 window centered on x and y should now be entirely within the image, provided that the image has at least 5 rows and 5 columns.
At this point you can do things like
subimage = j(y-2:y+2, x-2:x+2);
do growing within subimage starting from (2,2)
or you can do
maskedimage = zeros(numrow, numcol, 'like', j);
maskedimage(y-2:y+2, x-2:x+2) = j(y-2:y+2, x-2:x+2);
do growing on maskedimage starting from row y column x
Thank you very much.

Accedi per commentare.

Risposte (1)

Vinayak Choyyan
Vinayak Choyyan il 20 Ott 2022

0 voti

Hi,
As per my understanding, you are trying to perform medical image segmentation. I see you are trying to use predefined segmentation techniques but have not got good results.
Please check out this link
to know more about the segmentation tools and methods provided in MATLAB and easily try out various segmentation techniques, including deep learning based segmentation, through MATLAB’s Image Segmenter App. You can also use the Image Segmenter App to refine the segmentation and get better results.

3 Commenti

The Image segmenter app is definitely helpful. However, I am looking for automatic segmentation of the tumor which might be difficult to implement.
In that case you can train a supervised deep learning model to do automatic segmentation.
You will have to create dataset to train the model for automatic segmentation. To label/segment the training images, you can use the Image Labeler, Video Labeler, or Ground Truth Labeler apps. Then you could train various deep learning models like convolutional neural network (CNN) based encoder decoder segmentations to get a fairly accurate model. You can leverage the tools available in MATLAB, which you can find in the link in my comment above.
Or you could also find many examples of medical image segmentation on google which used deep learning and produced good results of accuracy. It is a highly explored topic.
Thank you for your suggestions.

Accedi per commentare.

Categorie

Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange

Prodotti

Release

R2022a

Richiesto:

il 17 Ott 2022

Commentato:

il 21 Ott 2022

Community Treasure Hunt

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

Start Hunting!

Translated by