- a modal dialog (questdlg) and
 - an interactive ROI tool (imrect).
 
- Call questdlg.
 - Handle “Cancel” or window close. If the user hits Cancel or closes the dialog, stop.
 - After you start imrect, wait for the user to finish. Please note imrect is not recommended now, use drawrectangle. https://in.mathworks.com/help/images/ref/imrect.html