필터 지우기
필터 지우기

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
ws
ws 2011년 10월 8일
Thanks for your answer.
But your code is quite complex for me :)
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