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

1 view (last 30 days)
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

Accepted Answer

David Young
David Young on 8 Oct 2011
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.

More Answers (1)

Image Analyst
Image Analyst on 8 Oct 2011
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 Comments
ws
ws on 8 Oct 2011
Thanks for your answer.
But your code is quite complex for me :)
Image Analyst
Image Analyst on 8 Oct 2011
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!