Abort roipoly in GUIDE
Show older comments
I created a GUI with axes that show the "slices" of a 3D matrix ( vol); a slider is used for skipping through the slices. In the slider's callback function I use roipoly to show each slice and manually segment an area from each slice.
function slider_draw_Callback(hObject, eventdata, handles)
% Get the current slice number.
slicen = round(get(hObject, 'Value'));
% Show the sliceand start drawing using roipoly.
axes(handles.axes_image);
[~, x, y] = roipoly(vol(:, :, slicen));
... some analysis with x, y...
Now, when I draw a polygon in each slice the roipoly works fine and saves x, y without issues. If I want to skip the 1st slice and draw something in the 2nd, roipoly is still "running" (crosshair visible) but can't draw anything when I click in the axes/image, giving me an eror in command window:
Error using waitfor
Error while evaluating figure WindowButtonMotionFcn
...
This is expected as roipoly needs a polygon to be drawn for it to be closed and then evoked again when I scroll to the next slice. How can I abort and restart roipoly when I press the slider buttons, essentially giving me the option to draw whenever I want? I've tried using uiwait/uiresume but can't make it work. Thanks.
1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on ROI-Based Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!