roipoly breaks uiwait and waitfor doesn't seems to work

3 views (last 30 days)
Hi guys!
I'm developing a GUI function that have to returns a matrix to the script that calls the function when the user closes the GUI. Basically, it have to work like this:
  1. User selects multiple ROIs over an image.
  2. User close the window.
  3. My GUI function returns a matrix with the multiple ROI masks.
I've been using uiwait() at the OpeningFcn to wait until the user closes the window, but it doesn't work because of the roipoly function. After selecting the first ROI, the entire window closes and returns the value.
I read in another thread that waitfor doesn't break with roipoly, but when I replace the uiwait for the waitfor sentence I get the next error message:
Attempt to reference field of non-structure array.
Error in trainingSetSelection3dgui>trainingSetSelection3dgui_OutputFcn (line 132)
varargout{1} = handles.voi;
Error in gui_mainfcn (line 263)
[varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
Error in trainingSetSelection3dgui (line 40)
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
I will appreciate your answer. I'm really stuck at this, and I have a deadline in a few weeks!!
Thanks a lot!!

Answers (1)

José Ignacio Orlando
José Ignacio Orlando on 5 Apr 2013
I already solve it!
It seems like roipoly calls to OutputFcn when the user selects the first ROI, avoiding all the uiwaits in the code. I just replace roipoly by roipolyold and it seems to work.
I hope this will be usefull!

Community Treasure Hunt

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

Start Hunting!