Using findObj to locate ROI.Lines and extract position data
古いコメントを表示
Hi, Im trying to add an option to the Contex Menu of the MATLAB Distance_using_lines_ROIs example code that allowed users to display the magnitudes of all of the line ROIs magnitudes. I figured I could just use findObj to locate the ROIs and use a command like getPosition or evt.Source.Position but I dont think I'm going about it the right way. Would I need the handles of each ROI too in order to get access to their position? Is there a location that Event data is stored that can be refrenced? Would I have to import my Axes data? Clearly ROIs are still a little abstract to me...
This is my function, when I call it in my code I pick up all the ROIs I am just searching for a way to gather their magnitudes into a table.
function plotAll(src)
pFig = ancestor(src,'figure');
pROIs = findobj(pFig,'Type','images.roi.Line');
table(pROIS)
end
This is the MATLAB code i'm building off of
Thanks!
3 件のコメント
Walter Roberson
2021 年 4 月 17 日
In the brief test I just did,
cat(3,findobj(gcf,'Type','images.roi.Line').Position)
worked. The third dimension is for the case where there are multiple ROIs.
William Schultz
2021 年 4 月 17 日
Walter Roberson
2021 年 4 月 17 日
You will need to reshape it. Maybe
reshape(ROIs, 4,[]).'
My guess is that would give x1 x2 y1 y2 for each row
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!