Hi. I'm trying to use roipoly to select a region in order to make a calculation over that region. The problem is that when i create the image and select the region with "ginput", Matlab shows me a 1x1 image, just a pixel.
This is the code:
w = imshow(Lesion_Visible(:,:,150),[]);
[r c]=ginput(5)
BW = roipoly(w,r,c);
figure,imshow(BW)
[R C] = size(BW);
for i = 1:R
for j = 1:C
if BW(i,j) == 1
Out(i,j) = w(i,j);
else
Out(i,j) = 0;
end
end
end
figure; imshow(Out,[]);
I believe the problem is in the 'imshow' because Lesion_Visible is a logical array and w, that is imshow over Lesion_Visible, appears in the workspace like an 1x1 image. How can i fix this? Can i use roipoly over a logical array? Thanks.
PD: Lesion_Visible is an 434x362x362 array.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 5월 21일

0 개 추천

roipoly does not accept the handle of the image() graphics object as its first parameter: you have to pass the image array.

댓글 수: 4

Luis Lira
Luis Lira 2018년 5월 21일
Hi Sir. And how can i do that?
Luis Lira
Luis Lira 2018년 5월 21일
What dou you mean with 'pass the image array'? Thanks.
this_image = Lesion_Visible(:,:,150);
imshow(this_image,[]);
[r, c] = ginput(5)
BW = roipoly(this_image, r, c);
Luis Lira
Luis Lira 2018년 5월 22일
Thanks sir. That was the mistake.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Exploration에 대해 자세히 알아보기

질문:

2018년 5월 21일

댓글:

2018년 5월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by