uiwait Interfering with Object Wait Function in GUIDE GUI
조회 수: 2 (최근 30일)
이전 댓글 표시
I have created a GUI using GUIDE to allow users to segment objects out of an image interactively using marker-controlled watershed segmentation. One of the push buttons of the GUI allows a user to draw additional regions on the image using impoly. The impoly doc says to use wait(h) to have the rest of the push button callback pause until the user double clicks the polygon, so that they have time to interactively re-size and move the object they drew. The problem I'm having is that after wait(h) is completed and the remaining push button script completes, the entire GUI closes. I think the wait function is interfering with the GUI uiwait(hObject) call in the OpeningFcn. I tried modifying the push button code so that uiwait(hObject) is called again at the end of the script, thereby preventing the GUI from closing. However, it doesn't appear to work well, as the whole GUI freezes and then MATLAB crashes.
Any ideas on how I can get the remaining push button script to wait until the user is done manipulating their object without using the wait(h) command so that it doesn't interfere with the GUI's uiwait(hObject) command? I'd really appreciate any suggestions! Thanks!
댓글 수: 0
채택된 답변
Image Analyst
2013년 4월 5일
Try roipolyold() instead, and don't use the wait. I think that will avoid the problem. Or else try imfreehand():
message = sprintf('Left click and hold to begin drawing.\nSimply lift the mouse button to finish');
uiwait(msgbox(message));
hFH = imfreehand();
% Create a binary image ("mask") from the ROI object (if needed).
binaryImage = hFH.createMask();
xy = hFH.getPosition; % Get (x,y) coordinates also.
댓글 수: 3
Image Analyst
2013년 4월 8일
You are mistaken. roipolyold() does not display any image. Whatever image you have displayed last, or is the "current" image, it will put up a dashed black and white line/outline. It does not do anything to change the color of the underlying image.
You can popup a full screen figure to draw on. I do that often so that I can see the thing I'm drawing better. After drawing, close it down
figure(1)
imshow(yourImage);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
[x y] = roipolyold();
close(1);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!