Clear Filters
Clear Filters

Segmentation not working properly?

5 views (last 30 days)
Warid Islam
Warid Islam on 17 Oct 2022
Commented: Warid Islam on 21 Oct 2022
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.
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)
Walter Roberson
Walter Roberson on 21 Oct 2022
figure, imshow(j)
[numrow, numcol] = size(j);
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

Sign in to comment.

Answers (1)

Vinayak Choyyan
Vinayak Choyyan on 20 Oct 2022
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.
Vinayak Choyyan
Vinayak Choyyan on 21 Oct 2022
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.
Warid Islam
Warid Islam on 21 Oct 2022
Thank you for your suggestions.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!