How to store ROIs?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The MightySpaceQuin
am 8 Dez. 2019
Kommentiert: Image Analyst
am 9 Dez. 2019
Hello. I am writing a GUI that allows a user to plot multiple ROI's using the drawline function on an axes by interactively using the mouse. I want to be able to store each ROI as they are drawn by the user so that I can iterate over them individually. I am using GUIDE and I'm unsure how to do this. Any help would be appreciated.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 8 Dez. 2019
Try this:
imshow('peppers.png');
uiwait(helpdlg('Draw a line'));
hLine = drawline('SelectedColor','yellow');
allROIs{1} = hLine.Position;
% Draw and save the second line.
uiwait(helpdlg('Draw another line'));
hLine = drawline('SelectedColor','yellow');
allROIs{2} = hLine.Position;
% Now clear lines
hLines = findobj(gca, 'type', 'images.roi.Line');
delete(hLines);
% Now have program draw them back again.
for k = 1 : length(allROIs)
message = sprintf('Click OK to see ROI #%d', k);
uiwait(helpdlg(message));
thisROI = allROIs{k}
drawline('Position', thisROI);
end
Adapt as needed.
4 Kommentare
Image Analyst
am 9 Dez. 2019
Did you see the code I gave for clearing the lines:
% Now clear lines
hLines = findobj(gca, 'type', 'images.roi.Line');
delete(hLines);
It would be easier for me to debug if you just attached the complete .m and .fig files.
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!