How to identified left side or right side view mammogram by using mean?

1 次查看(过去 30 天)
Hi all
Below is my sample code I refer some website guide to identified left or right side view on my mask mammogram, but my code can't works well, anyone can help me through this? Thank you.
mean_LM = mean(LM);
mean_RM = mean(RM);
if mean_LM > mean_RM
view = LM;
disp('Left')
else
view = RM;
disp('Right')
end

采纳的回答

David Young
David Young 2011-10-8
If LM and RM are images, you need to say
mean_LM = mean(LM(:));
mean_RM = mean(RM(:));
If that's not the problem, you probably need to post some of the mammogram images, and explain what exactly goes wrong with your existing code.

更多回答(1 个)

Image Analyst
Image Analyst 2011-10-8
I don't see how David's answer is correct. It simply takes the mean of the entire image, for two images. What you need to do is to decide if the breast is in the left or right half of the image (it's a "left view image" or a "right view image") is to get two means from that single image and then from the mean on the left half and the mean on the right half decide which half is brighter and thus that half contains the breast. Like this:
[rows columns numberOfColorBands] = size(grayImage);
halfWayColumn = floor(columns/2);
leftMean = mean2(grayImage(:, 1:halfWayColumn))
rightMean = mean2(grayImage(:, halfWayColumn+1:end))
if leftMean > rightMean
uiwait(msgbox('Breast is in left half'));
else
uiwait(msgbox('Breast is in right half'));
end
  2 个评论
Image Analyst
Image Analyst 2011-10-8
Wow. I'm surprised, especially since it's pretty similar to yours except that it's more complete and robust. Maybe I misunderstood and you already extracted a single image into the left half and the right half. If that's the case then my and David's solution are nearly the same except that he used (:) because mean gives a mean for each column and he needs to get the mean of the column means, whereas I didn't have to do that because mean2() operates on a 2D array to give the mean of the whole thing directly. Good luck with your studies.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by