How to interactively display the size of ROI created by imellipse?
3 次查看(过去 30 天)
显示 更早的评论
I want to draw a ROI on one image with imellipse and display the size of ROI, so that I can adjust the size of ROI to the desired size. The following is my code:
figure(1)
h_im = imshow(myimage);
roi_small = imellipse;
BW_small_temp = sum(sum(createMask(roi_small, h_im)));
BW_small_temp_area = BW_small_temp * info_MTL.(current_name).PixelSpacing(1)*info_MTL.(current_name).PixelSpacing(2);
txt1 = [num2str(BW_small_temp_area) ' mm^2'];
text(256,256,txt1)
wait_small = wait(roi_small);
pos_small = getPosition(roi_small);
This code can only display the ROI size at the first attempt. By adjusting the size of ROI, the text in the figure won't change. Please see the picture:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161266/image.jpeg)
Is there a way to display the text of ROI size interactively, such that when adjusting the ROI size, the text of ROI size also changes? Many thanks!
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!