フィルターのクリア

Tooltip for impoly in matlab?

2 ビュー (過去 30 日間)
Sudhanshu Goel
Sudhanshu Goel 2017 年 2 月 3 日
コメント済み: Sudhanshu Goel 2017 年 2 月 10 日
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

採用された回答

Walter Roberson
Walter Roberson 2017 年 2 月 5 日
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.
  3 件のコメント
Walter Roberson
Walter Roberson 2017 年 2 月 9 日
Fetch the current point. Adjust it to be axes-relative if necessary (if you fetched the figure CurrentPoint then it will be figure relative; the axes CurrentPoint will be axes relative.)
Loop through all of the impoly accessing their position with getPosition(). Then use inpolygon() to see if the current point is in the polygon.
(If you know that you have not changed the ROIs since you last did this, you could save a copy of the impoly positions somewhere to save having to fetch them again.)
Sudhanshu Goel
Sudhanshu Goel 2017 年 2 月 10 日
Thanks a lot.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by