source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_m_menu.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 6.7 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3function match_param_out = c_menu(varargin)
4% C_MENU Application M-file for c_menu.fig
5%    FIG = C_MENU launch c_menu GUI.
6%    C_MENU('callback_name', ...) invoke the named callback.
7
8% Last Modified by GUIDE v2.0 28-Mar-2002 14:11:45
9error(nargchk(0,4,nargin)) % function takes only 0 or 2 argument
10if  nargin == 2 % LAUNCH GUI
11   
12   
13        fig = openfig(mfilename,'reuse');   
14        % Use system color scheme for figure:
15        set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
16
17   
18%     % Position figure
19%     if nargin == 2
20%         pos_size = get(fig,'Position');
21%         pos = varargin{2};
22%         if length(pos) ~= 2
23%             errordlg('Input argument must be a 2-element vector','argh')
24%         end
25%         new_pos = [pos(1) pos(2) pos_size(3) pos_size(4)];
26%              set(fig,'Position',new_pos,'Visible','on')
27%              figure(fig)
28%         
29%     end
30   
31 
32
33    % Use system color scheme for figure:
34    set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
35   
36    % Generate a structure of handles to pass to callbacks, and store it.
37    handles = guihandles(fig);
38   
39   
40   
41    match_param = varargin{1};
42    handles.max_disparity = match_param.max_disparity;
43    handles.match_half_size = match_param.match_half_size;
44   
45   
46    set(handles.max_disparity_button, 'String', num2str(handles.max_disparity));
47    set(handles.width_button, 'String', num2str(handles.match_half_size));
48   
49   
50   
51   
52    guidata(fig, handles);
53   
54
55   
56   
57        % Wait for callbacks to run and window to be dismissed:
58        uiwait(fig);
59
60
61    % UIWAIT might have returned because the window was deleted using
62    % the close box - in that case, return 'cancel' as the answer, and
63    % don't bother deleting the window!
64    if ~ishandle(fig)
65        disp('No changes made');
66        match_param_out(1) = handles.max_disparity;
67        match_param_out(2) = handles.match_half_size ;
68    else
69        % otherwise, we got here because the user pushed one of the two buttons.
70        % retrieve the latest copy of the 'handles' struct, and return the answer.
71        % Also, we need to delete the window.
72       
73        handles = guidata(fig);
74        match_param_out(1) = handles.max_disparity
75        match_param_out(2) = handles.match_half_size
76        delete(fig);
77    end
78   
79
80elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
81
82        try
83                [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
84        catch
85                disp(lasterr);
86        end
87
88end
89
90
91%| ABOUT CALLBACKS:
92%| GUIDE automatically appends subfunction prototypes to this file, and
93%| sets objects' callback properties to call them through the FEVAL
94%| switchyard above. This comment describes that mechanism.
95%|
96%| Each callback subfunction declaration has the following form:
97%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
98%|
99%| The subfunction name is composed using the object's Tag and the
100%| callback type separated by '_', e.g. 'slider2_Callback',
101%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
102%|
103%| H is the callback object's handle (obtained using GCBO).
104%|
105%| EVENTDATA is empty, but reserved for future use.
106%|
107%| HANDLES is a structure containing handles of components in GUI using
108%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
109%| structure is created at GUI startup using GUIHANDLES and stored in
110%| the figure's application data using GUIDATA. A copy of the structure
111%| is passed to each callback.  You can store additional information in
112%| this structure at GUI startup, and you can change the structure
113%| during callbacks.  Call guidata(h, handles) after changing your
114%| copy to replace the stored original so that subsequent callbacks see
115%| the updates. Type "help guihandles" and "help guidata" for more
116%| information.
117%|
118%| VARARGIN contains any extra arguments you have passed to the
119%| callback. Specify the extra arguments by editing the callback
120%| property in the inspector. By default, GUIDE sets the property to:
121%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
122%| Add any extra arguments after the last argument, before the final
123%| closing parenthesis.
124
125
126
127% --------------------------------------------------------------------
128function varargout = close_button_Callback(h, eventdata, handles, varargin)
129% Stub for Callback of the uicontrol handles.close_button.
130%Stub for Callback of the uicontrol handles.close_button.
131%
132% Obtaining the Figure Handle from Within a Callback.   In general, dismissing a modal figure requires the handle
133% of the figure. Since most GUIs hide figure handles to prevent accidental access, the gcbf (get callback figure)
134% command provides the most effective method to get the figure handle from within a callback routine.
135%
136% gcbf returns the handle of the figure containing the object whose callback is executing. This enables you to use
137% gcbf in the callback of the component that will dismiss the dialog. For example, suppose your dialog includes a
138% push button (tagged pushbutton1) that closes the dialog. Its callback could include a call to delete at the end of
139% its callback subfunction.
140
141disp('closing');
142% match_param_out.max_disparity = handles.max_disparity;
143% match_param_out.corner_sigma = handles.corner_sigma;
144% match_param_out.match_half_size = handles.match_half_size;
145
146uiresume(handles.figure1);
147
148
149
150% --------------------------------------------------------------------
151function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)
152% Stub for Callback of the uicontrol handles.pushbutton2.
153disp('pushbutton2 Callback not implemented yet.')
154
155
156% --------------------------------------------------------------------
157function varargout = width_button_Callback(h, eventdata, handles, varargin)
158nc = str2num(get(handles.width_button, 'String'));
159minnc = 0;
160maxnc = 20;
161if (isempty(nc) | (nc <= minnc)  | (nc >maxnc))
162    nc = handles.match_half_size;
163    WARNDLG(['out of range' num2str(minnc) '-' num2str(maxnc)],'ooops')
164end;
165handles.match_half_size = nc;
166set(handles.width_button, 'String', num2str(handles.match_half_size));
167
168%save data
169guidata(handles.figure1, handles);
170
171
172% --------------------------------------------------------------------
173function varargout = max_disparity_button_Callback(h, eventdata, handles, varargin)
174% Stub for Callback of the uicontrol handles.max_disparity_button.
175nc = str2num(get(handles.max_disparity_button, 'String'));
176
177minnc = 1;
178maxnc = 1000;
179if (isempty(nc) | (nc < minnc)  | (nc >maxnc))
180    nc = handles.max_disparity;
181    WARNDLG(['out of range' num2str(minnc) '-' num2str(maxnc)],'ooops')
182end;
183
184if (nc >100)
185    WARNDLG('Big Max disparities take a lot of computation','hint')
186end
187handles.max_disparity = nc;
188set(handles.max_disparity_button, 'String', num2str(handles.max_disparity));
189
190%save data
191guidata(handles.figure1, handles);
192
Note: See TracBrowser for help on using the repository browser.