MATLAB: Tooltip for impoly in matlab

matlab gui

I am creating a ROI (using impoly,imellipse etc.) on an image. What I need is to make a tooltip for this ROI so that every time the cursor is in the area enclosed by ROI, I can display certain information (No. of pixels enclosed in ROI, Area etc.) related to it on the screen. Thanks

Best Answer

Unfortunately imroi do not have tooltips . uicontrol and uitoggletool and uipushtool have tooltipstring properties, but not much else.
You can build your own tool with WindowButtonMotionFcn callbacks, or you can use datacursormode with a custom UpdateFcn . You would have to check to see which imroi you were inside (they are boundaries, not implicitly "filled", so detecting that you are "over" one of them will not work.) Caution: imroi can overlap.