How to initiate the double-click callback function once ROI is moved by user?

8 vues (au cours des 30 derniers jours)
Brie E.
Brie E. le 12 Août 2020
Commenté : Brie E. le 18 Août 2020
I would like to add an ROI (line) to an image frame. I would like to specify the size of that line but allow a user to move it within the frame. I am able to generate the line of specified length with the following code but I am unsure how to indicate that once the user moves the ROI and double clicks, the new location is accepted and the script proceeds.
Thanks in advance for any assistance.
Display image and line:
imshow(frame);
h = images.roi.Line(gca,'Position',[600 600;600 650])
addlistener(h,'MovingROI',@allevents);
addlistener(h,'ROIMoved',@allevents);
customWait function:
function pos = customWait(hROI)
l = addlistener(hROI, 'ROIMoved', @allevents)
uiwait;
delete(l)
pos = hROI.Position;
end

Réponse acceptée

Vimal Rathod
Vimal Rathod le 17 Août 2020
You could refer to the following link to refer the double-click workflow for ROI using wait function and modify it according to your use case. You can disable the mouse event listeners in your double-click listener function so that you can restrict the user from modifying the ROI after double-clicking.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by