view_blocked_results - view the average time-course in a ROI Usage: handle = view_blocked_results('gui_data', ROIs) view_blocked_results is used in conjunction with view_roi_results to display the results of a ROI computation; this function displays the average time-course for each run within your ROI. To use, you must simply give two parameters: 'gui_data', to tell the program that you are passing extra data to the function, and a ROIs structure with the appropriate elements filled. Note that much of this program is the result of code generated by Matlab's GUIDE tool and may or may not work on versions of Matlab earlier than R13. Within view_blocked_results, view the items under the "Help" menu for more information on how to use the program. This function is part of froi, available from http://froi.sourceforge.net, and is goverened by the Artistic License. $Id: view_blocked_results.m,v 1.2 2003/09/24 22:39:02 nknouf Exp $
This function calls:
This function is called by:
0001 function varargout = view_blocked_results(varargin) 0002 % view_blocked_results - view the average time-course in a ROI 0003 % 0004 % Usage: handle = view_blocked_results('gui_data', ROIs) 0005 % 0006 % view_blocked_results is used in conjunction with view_roi_results to 0007 % display the results of a ROI computation; this function displays 0008 % the average time-course for each run within your ROI. 0009 % 0010 % To use, you must simply give two parameters: 'gui_data', 0011 % to tell the program that you are passing extra data to the function, and 0012 % a ROIs structure with the appropriate elements filled. Note that much of 0013 % this program is the result of code generated by Matlab's GUIDE tool and 0014 % may or may not work on versions of Matlab earlier than R13. 0015 % 0016 % Within view_blocked_results, view the items under the "Help" menu for more 0017 % information on how to use the program. 0018 % 0019 % This function is part of froi, available from http://froi.sourceforge.net, 0020 % and is goverened by the Artistic License. 0021 % 0022 % $Id: view_blocked_results.m,v 1.2 2003/09/24 22:39:02 nknouf Exp $ 0023 0024 0025 % Begin initialization code 0026 gui_Singleton = 1; 0027 gui_State = struct('gui_Name', mfilename, ... 0028 'gui_Singleton', gui_Singleton, ... 0029 'gui_OpeningFcn', @view_blocked_results_OpeningFcn, ... 0030 'gui_OutputFcn', @view_blocked_results_OutputFcn, ... 0031 'gui_LayoutFcn', @view_blocked_results_LayoutFcn, ... 0032 'gui_Callback', [], ... 0033 'gui_data', []); 0034 if nargin & isstr(varargin{1}) 0035 gui_State.gui_Callback = str2func(varargin{1}); 0036 end 0037 0038 if nargout 0039 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 0040 else 0041 gui_mainfcn(gui_State, varargin{:}); 0042 end 0043 0044 % End initialization code 0045 0046 % --- Executes just before view_blocked_results is made visible. 0047 function view_blocked_results_OpeningFcn(hObject, eventdata, handles, varargin) 0048 % This function has no output args, see OutputFcn. 0049 % hObject handle to figure 0050 % eventdata reserved - to be defined in a future version of MATLAB 0051 % handles structure with handles and user data (see GUIDATA) 0052 % varargin command line arguments to view_blocked_results (see VARARGIN) 0053 global ROIs; 0054 0055 % Choose default command line output for view_blocked_results 0056 handles.output = hObject; 0057 0058 % Update handles structure 0059 guidata(hObject, handles); 0060 0061 % This sets up the initial plot - only do when we are invisible 0062 % so window can get raised using view_blocked_results. 0063 if strcmp(get(hObject,'Visible'),'off') 0064 %%plot(rand(5)); 0065 end 0066 0067 if (strncmp('gui_data', varargin{1}, 8)) 0068 ROIs = varargin{2}; 0069 0070 if (findstr('blocked', ROIs.designtype)) 0071 display_init(handles); 0072 else 0073 errordlg('The results must be for blocked data.', 'Not blocked data'); 0074 end 0075 end 0076 0077 % UIWAIT makes view_blocked_results wait for user response (see UIRESUME) 0078 % uiwait(handles.figure1); 0079 0080 0081 % --- Outputs from this function are returned to the command line. 0082 function varargout = view_blocked_results_OutputFcn(hObject, eventdata, handles) 0083 % varargout cell array for returning output args (see VARARGOUT); 0084 % hObject handle to figure 0085 % eventdata reserved - to be defined in a future version of MATLAB 0086 % handles structure with handles and user data (see GUIDATA) 0087 0088 % Get default command line output from handles structure 0089 varargout{1} = handles.output; 0090 0091 % -------------------------------------------------------------------- 0092 function FileMenu_Callback(hObject, eventdata, handles) 0093 % hObject handle to FileMenu (see GCBO) 0094 % eventdata reserved - to be defined in a future version of MATLAB 0095 % handles structure with handles and user data (see GUIDATA) 0096 0097 0098 % -------------------------------------------------------------------- 0099 function OpenMenuItem_Callback(hObject, eventdata, handles) 0100 % hObject handle to OpenMenuItem (see GCBO) 0101 % eventdata reserved - to be defined in a future version of MATLAB 0102 % handles structure with handles and user data (see GUIDATA) 0103 file = uigetfile('*.fig'); 0104 if ~isequal(file, 0) 0105 open(file); 0106 end 0107 0108 % -------------------------------------------------------------------- 0109 function PrintMenuItem_Callback(hObject, eventdata, handles) 0110 % hObject handle to PrintMenuItem (see GCBO) 0111 % eventdata reserved - to be defined in a future version of MATLAB 0112 % handles structure with handles and user data (see GUIDATA) 0113 printdlg(handles.figure1) 0114 0115 % -------------------------------------------------------------------- 0116 function CloseMenuItem_Callback(hObject, eventdata, handles) 0117 % hObject handle to CloseMenuItem (see GCBO) 0118 % eventdata reserved - to be defined in a future version of MATLAB 0119 % handles structure with handles and user data (see GUIDATA) 0120 0121 delete(handles.figure1) 0122 0123 0124 % --- Executes during object creation, after setting all properties. 0125 function selectRun_CreateFcn(hObject, eventdata, handles) 0126 % hObject handle to popupmenu3 (see GCBO) 0127 % eventdata reserved - to be defined in a future version of MATLAB 0128 % handles empty - handles not created until after all CreateFcns called 0129 0130 % Hint: popupmenu controls usually have a white background on Windows. 0131 % See ISPC and COMPUTER. 0132 if ispc 0133 set(hObject,'BackgroundColor','white'); 0134 else 0135 set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); 0136 end 0137 0138 % --- Executes on selection change in popupmenu3. 0139 function selectRun_Callback(hObject, eventdata, handles) 0140 % hObject handle to popupmenu3 (see GCBO) 0141 % eventdata reserved - to be defined in a future version of MATLAB 0142 % handles structure with handles and user data (see GUIDATA) 0143 0144 % Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array 0145 % contents{get(hObject,'Value')} returns selected item from popupmenu3 0146 global ROIs; 0147 0148 axes(handles.plot); 0149 cla; 0150 0151 popup_sel_index = get(handles.selectRun, 'Value'); 0152 plot(ROIs.ROImean(popup_sel_index, :)); 0153 title(ROIs.legendRun{popup_sel_index}); 0154 xlabel('Time (s)'); 0155 ylabel('ROI Response (scanner units)'); 0156 0157 0158 % -------------------------------------------------------------------- 0159 function openMenu_Callback(hObject, eventdata, handles) 0160 % hObject handle to openMenu (see GCBO) 0161 % eventdata reserved - to be defined in a future version of MATLAB 0162 % handles structure with handles and user data (see GUIDATA) 0163 global info; 0164 global ROIs; 0165 curdir = pwd; 0166 [info.fname info.pname] = uigetfile('*.mat', 'Open Blocked Results'); 0167 if(info.fname ~= 0) 0168 cmd = sprintf('load %s%s', info.pname, info.fname); 0169 eval(cmd); 0170 %% the try...catch block below ensures that we have an actual 0171 %% ROI results structure 0172 try 0173 numVoxels = ROIs.numVoxels; 0174 catch 0175 oops(1000); 0176 end 0177 0178 if (findstr('blocked', ROIs.designtype)) 0179 display_init(handles); 0180 else 0181 errordlg('The results must be for blocked data.', 'Not blocked data'); 0182 end 0183 else return; 0184 end 0185 0186 0187 % -------------------------------------------------------------------- 0188 function helpMenu_Callback(hObject, eventdata, handles) 0189 % hObject handle to helpMenu (see GCBO) 0190 % eventdata reserved - to be defined in a future version of MATLAB 0191 % handles structure with handles and user data (see GUIDATA) 0192 0193 0194 % -------------------------------------------------------------------- 0195 function howtoMenu_Callback(hObject, eventdata, handles) 0196 % hObject handle to howtoMenu (see GCBO) 0197 % eventdata reserved - to be defined in a future version of MATLAB 0198 % handles structure with handles and user data (see GUIDATA) 0199 s = sprintf('Under the drop-down menu you can select different runs\n'); 0200 s = sprintf('%sto display the raw time-course. As well, extra\n', s); 0201 s = sprintf('%sinformation about the runs are available.\n', s); 0202 msgbox(s, 'How to'); 0203 return; 0204 0205 % -------------------------------------------------------------------- 0206 function aboutMenu_Callback(hObject, eventdata, handles) 0207 % hObject handle to aboutMenu (see GCBO) 0208 % eventdata reserved - to be defined in a future version of MATLAB 0209 % handles structure with handles and user data (see GUIDATA) 0210 about = sprintf('\t\tfroi -- FS-FAST ROI\t\t\n'); 0211 about = sprintf('%s\n',about); 0212 about = sprintf('%sThis visualization tool was written by Nicholas Knouf <nknouf@mit.edu>.\n', about); 0213 about = sprintf('%sfroi is Copyright (c) 2003, Nicholas Knouf & MIT, and is licensed under the Artistic License.\n', about); 0214 about = sprintf('%sfroi can be obtained from http://froi.sourceforge.net.', about); 0215 msgbox(about, 'About froi'); 0216 return; 0217 0218 % -------------------------------------------------------------------- 0219 function display_init(handles) 0220 %% Initializes the figure with the first run of blocked data 0221 global info; 0222 global ROIs; 0223 info = parse_results; 0224 [junk, numRuns] = size(ROIs.legendRun); 0225 selectRun_string = {}; 0226 for i=1:numRuns 0227 selectRun_string = {selectRun_string{:} ROIs.legendRun{i}}; 0228 end 0229 set(handles.selectRun, 'String', selectRun_string); 0230 plot(ROIs.ROImean(1,:)); 0231 title(ROIs.legendRun{1}); 0232 xlabel('Time (s)'); 0233 ylabel('ROI Response (scanner units)'); 0234 0235 set(handles.run_info_text, 'String', info.run_info_string); 0236 return; 0237 0238 0239 % --- Creates and returns a handle to the GUI figure. 0240 function h1 = view_blocked_results_LayoutFcn(policy) 0241 % policy - create a new figure or use a singleton. 'new' or 'reuse'. 0242 0243 persistent hsingleton; 0244 if strcmpi(policy, 'reuse') & ishandle(hsingleton) 0245 h1 = hsingleton; 0246 return; 0247 end 0248 0249 h1 = figure(... 0250 'Units','characters',... 0251 'Color',[0.614 0.687 0.651],... 0252 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],... 0253 'IntegerHandle','off',... 0254 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),... 0255 'MenuBar','none',... 0256 'Name','Display Blocked Data',... 0257 'NumberTitle','off',... 0258 'PaperPosition',get(0,'defaultfigurePaperPosition'),... 0259 'Position',[128.6 19.4505494505494 130.333333333333 34.8571428571429],... 0260 'Renderer',get(0,'defaultfigureRenderer'),... 0261 'RendererMode','manual',... 0262 'HandleVisibility','callback',... 0263 'Tag','figure1',... 0264 'UserData',zeros(1,0)); 0265 0266 setappdata(h1, 'GUIDEOptions', struct(... 0267 'active_h', 1.500040e+02, ... 0268 'taginfo', struct(... 0269 'figure', 2, ... 0270 'axes', 2, ... 0271 'pushbutton', 2, ... 0272 'popupmenu', 3, ... 0273 'frame', 5, ... 0274 'text', 5), ... 0275 'override', 1, ... 0276 'release', 13, ... 0277 'resize', 'simple', ... 0278 'accessibility', 'callback', ... 0279 'mfile', 1, ... 0280 'callbacks', 1, ... 0281 'singleton', 1, ... 0282 'syscolorfig', 0, ... 0283 'lastSavedFile', '/afs/athena.mit.edu/user/n/k/nknouf/gui/view_blocked_results.m')); 0284 0285 0286 h2 = uicontrol(... 0287 'Parent',h1,... 0288 'Units','normalized',... 0289 'Position',[0.0741687979539642 0.790983606557377 0.360613810741688 0.139344262295082],... 0290 'String',{ '' },... 0291 'Style','frame',... 0292 'Tag','frame1'); 0293 0294 0295 h3 = uimenu(... 0296 'Parent',h1,... 0297 'Callback','view_blocked_results(''FileMenu_Callback'',gcbo,[],guidata(gcbo))',... 0298 'Label','File',... 0299 'Tag','FileMenu'); 0300 0301 h4 = uimenu(... 0302 'Parent',h3,... 0303 'Callback','view_blocked_results(''openMenu_Callback'',gcbo,[],guidata(gcbo))',... 0304 'Label','Open...',... 0305 'Tag','openMenu'); 0306 0307 h5 = uimenu(... 0308 'Parent',h3,... 0309 'Callback','view_blocked_results(''PrintMenuItem_Callback'',gcbo,[],guidata(gcbo))',... 0310 'Label','Print ...',... 0311 'Tag','PrintMenuItem'); 0312 0313 h6 = uimenu(... 0314 'Parent',h3,... 0315 'Callback','view_blocked_results(''CloseMenuItem_Callback'',gcbo,[],guidata(gcbo))',... 0316 'Label','Close',... 0317 'Separator','on',... 0318 'Tag','CloseMenuItem'); 0319 0320 h7 = axes(... 0321 'Parent',h1,... 0322 'ALim',get(0,'defaultaxesALim'),... 0323 'ALimMode','manual',... 0324 'CameraPosition',[0.5 0.5 9.16025403784439],... 0325 'CameraPositionMode','manual',... 0326 'CameraTarget',[0.5 0.5 0.5],... 0327 'CameraTargetMode','manual',... 0328 'CameraUpVector',[0 1 0],... 0329 'CameraUpVectorMode','manual',... 0330 'CameraViewAngle',6.60861036031192,... 0331 'CameraViewAngleMode','manual',... 0332 'CLim',get(0,'defaultaxesCLim'),... 0333 'CLimMode','manual',... 0334 'Color',get(0,'defaultaxesColor'),... 0335 'ColorOrder',get(0,'defaultaxesColorOrder'),... 0336 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 0337 'DataAspectRatioMode','manual',... 0338 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 0339 'PlotBoxAspectRatioMode','manual',... 0340 'Position',[0.0754475703324808 0.0922131147540984 0.870843989769821 0.631147540983607],... 0341 'TickDir',get(0,'defaultaxesTickDir'),... 0342 'TickDirMode','manual',... 0343 'XColor',get(0,'defaultaxesXColor'),... 0344 'XLim',get(0,'defaultaxesXLim'),... 0345 'XLimMode','manual',... 0346 'XTick',[0 0.2 0.4 0.6 0.8 1],... 0347 'XTickLabel',{ '0 ' '0.2' '0.4' '0.6' '0.8' '1 ' },... 0348 'XTickLabelMode','manual',... 0349 'XTickMode','manual',... 0350 'YColor',get(0,'defaultaxesYColor'),... 0351 'YLim',get(0,'defaultaxesYLim'),... 0352 'YLimMode','manual',... 0353 'YTick',[0 0.2 0.4 0.6 0.8 1],... 0354 'YTickLabel',{ '0 ' '0.2' '0.4' '0.6' '0.8' '1 ' },... 0355 'YTickLabelMode','manual',... 0356 'YTickMode','manual',... 0357 'ZColor',get(0,'defaultaxesZColor'),... 0358 'ZLim',get(0,'defaultaxesZLim'),... 0359 'ZLimMode','manual',... 0360 'ZTick',[0 0.5 1],... 0361 'ZTickLabel','',... 0362 'ZTickLabelMode','manual',... 0363 'ZTickMode','manual',... 0364 'Tag','plot',... 0365 'UserData',zeros(1,0)); 0366 0367 0368 h8 = get(h7,'title'); 0369 0370 set(h8,... 0371 'Parent',h7,... 0372 'Color',[0 0 0],... 0373 'HorizontalAlignment','center',... 0374 'Position',[0.496753246753247 1.0211038961039 1.00005459937205],... 0375 'VerticalAlignment','bottom',... 0376 'HandleVisibility','off'); 0377 0378 h9 = get(h7,'xlabel'); 0379 0380 set(h9,... 0381 'Parent',h7,... 0382 'Color',[0 0 0],... 0383 'HorizontalAlignment','center',... 0384 'Position',[0.496753246753247 -0.073051948051948 1.00005459937205],... 0385 'VerticalAlignment','cap',... 0386 'HandleVisibility','off'); 0387 0388 h10 = get(h7,'ylabel'); 0389 0390 set(h10,... 0391 'Parent',h7,... 0392 'Color',[0 0 0],... 0393 'HorizontalAlignment','center',... 0394 'Position',[-0.0909090909090908 0.49512987012987 1.00005459937205],... 0395 'Rotation',90,... 0396 'VerticalAlignment','bottom',... 0397 'HandleVisibility','off'); 0398 0399 h11 = get(h7,'zlabel'); 0400 0401 set(h11,... 0402 'Parent',h7,... 0403 'Color',[0 0 0],... 0404 'HorizontalAlignment','right',... 0405 'Position',[-0.798701298701298 1.43344155844156 1.00005459937205],... 0406 'HandleVisibility','off',... 0407 'Visible','off'); 0408 0409 h12 = uicontrol(... 0410 'Parent',h1,... 0411 'Units','normalized',... 0412 'Callback','view_blocked_results(''selectRun_Callback'',gcbo,[],guidata(gcbo))',... 0413 'CData',zeros(1,0),... 0414 'ListboxTop',0,... 0415 'Position',[0.1 0.824074074074075 0.307692307692308 0.0481481481481482],... 0416 'String','{ none }',... 0417 'Style','popupmenu',... 0418 'Value',1,... 0419 'CreateFcn','view_blocked_results(''selectRun_CreateFcn'',gcbo,[],guidata(gcbo))',... 0420 'Tag','selectRun',... 0421 'UserData',zeros(1,0)); 0422 0423 0424 h13 = uicontrol(... 0425 'Parent',h1,... 0426 'Units','normalized',... 0427 'BackgroundColor',[0.683 0.702 0.491],... 0428 'Position',[0.0869565217391304 0.889344262295082 0.258312020460358 0.0758196721311475],... 0429 'String',{ '' },... 0430 'Style','frame',... 0431 'Tag','frame2'); 0432 0433 0434 h14 = uicontrol(... 0435 'Parent',h1,... 0436 'Units','normalized',... 0437 'FontUnits','inches',... 0438 'BackgroundColor',[0.683090009422724 0.701960784313725 0.491366506055482],... 0439 'FontSize',0.194444444444445,... 0440 'FontWeight','bold',... 0441 'Position',[0.0971867007672634 0.907786885245902 0.237851662404092 0.0471311475409836],... 0442 'String','Available Runs',... 0443 'Style','text',... 0444 'Tag','availble_run_title'); 0445 0446 0447 h15 = uicontrol(... 0448 'Parent',h1,... 0449 'Units','normalized',... 0450 'Position',[0.58695652173913 0.790983606557377 0.360613810741688 0.139344262295082],... 0451 'String',{ '' },... 0452 'Style','frame',... 0453 'Tag','frame3'); 0454 0455 0456 h16 = uicontrol(... 0457 'Parent',h1,... 0458 'Units','normalized',... 0459 'BackgroundColor',[0.683 0.702 0.491],... 0460 'Position',[0.599744245524297 0.889344262295082 0.258312020460358 0.0758196721311475],... 0461 'String',{ '' },... 0462 'Style','frame',... 0463 'Tag','frame4'); 0464 0465 0466 h17 = uicontrol(... 0467 'Parent',h1,... 0468 'Units','normalized',... 0469 'FontUnits','inches',... 0470 'BackgroundColor',[0.683090009422724 0.701960784313725 0.491366506055482],... 0471 'FontSize',0.194444444444445,... 0472 'FontWeight','bold',... 0473 'Position',[0.60997442455243 0.907786885245902 0.237851662404092 0.0471311475409836],... 0474 'String','Run Information',... 0475 'Style','text',... 0476 'Tag','runinfo_title'); 0477 0478 0479 h18 = uicontrol(... 0480 'Parent',h1,... 0481 'Units','normalized',... 0482 'HorizontalAlignment','left',... 0483 'Position',[0.601023017902813 0.809426229508196 0.332480818414322 0.0635245901639344],... 0484 'String','{ none }',... 0485 'Style','text',... 0486 'Tag','run_info_text'); 0487 0488 0489 h19 = uimenu(... 0490 'Parent',h1,... 0491 'Callback','view_blocked_results(''helpMenu_Callback'',gcbo,[],guidata(gcbo))',... 0492 'Label','Help',... 0493 'Tag','helpMenu'); 0494 0495 h20 = uimenu(... 0496 'Parent',h19,... 0497 'Callback','view_blocked_results(''howtoMenu_Callback'',gcbo,[],guidata(gcbo))',... 0498 'Label','How to...',... 0499 'Tag','howtoMenu'); 0500 0501 h21 = uimenu(... 0502 'Parent',h19,... 0503 'Callback','view_blocked_results(''aboutMenu_Callback'',gcbo,[],guidata(gcbo))',... 0504 'Label','About...',... 0505 'Tag','aboutMenu'); 0506 0507 0508 hsingleton = h1; 0509 0510 0511 % --- Handles default GUIDE GUI creation and callback dispatch 0512 function varargout = gui_mainfcn(gui_State, varargin) 0513 0514 gui_StateFields = {'gui_Name' 0515 'gui_Singleton' 0516 'gui_OpeningFcn' 0517 'gui_OutputFcn' 0518 'gui_LayoutFcn' 0519 'gui_Callback'}; 0520 gui_Mfile = ''; 0521 for i=1:length(gui_StateFields) 0522 if ~isfield(gui_State, gui_StateFields{i}) 0523 error('Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile); 0524 elseif isequal(gui_StateFields{i}, 'gui_Name') 0525 gui_Mfile = [getfield(gui_State, gui_StateFields{i}), '.m']; 0526 end 0527 end 0528 0529 numargin = length(varargin); 0530 0531 if numargin == 0 0532 % VIEW_BLOCKED_RESULTS 0533 % create the GUI 0534 gui_Create = 1; 0535 elseif numargin > 3 & ischar(varargin{1}) & ishandle(varargin{2}) 0536 % VIEW_BLOCKED_RESULTS('CALLBACK',hObject,eventData,handles,...) 0537 gui_Create = 0; 0538 else 0539 % VIEW_BLOCKED_RESULTS(...) 0540 % create the GUI and hand varargin to the openingfcn 0541 gui_Create = 1; 0542 end 0543 0544 if gui_Create == 0 0545 varargin{1} = gui_State.gui_Callback; 0546 if nargout 0547 [varargout{1:nargout}] = feval(varargin{:}); 0548 else 0549 feval(varargin{:}); 0550 end 0551 else 0552 if gui_State.gui_Singleton 0553 gui_SingletonOpt = 'reuse'; 0554 else 0555 gui_SingletonOpt = 'new'; 0556 end 0557 0558 % Open fig file with stored settings. Note: This executes all component 0559 % specific CreateFunctions with an empty HANDLES structure. 0560 0561 % Do feval on layout code in m-file if it exists 0562 if ~isempty(gui_State.gui_LayoutFcn) 0563 gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt); 0564 else 0565 gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); 0566 % If the figure has InGUIInitialization it was not completely created 0567 % on the last pass. Delete this handle and try again. 0568 if isappdata(gui_hFigure, 'InGUIInitialization') 0569 delete(gui_hFigure); 0570 gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); 0571 end 0572 end 0573 0574 % Set flag to indicate starting GUI initialization 0575 setappdata(gui_hFigure,'InGUIInitialization',1); 0576 0577 % Fetch GUIDE Application options 0578 gui_Options = getappdata(gui_hFigure,'GUIDEOptions'); 0579 0580 if ~isappdata(gui_hFigure,'GUIOnScreen') 0581 % Adjust background color 0582 if gui_Options.syscolorfig 0583 set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor')); 0584 end 0585 0586 % Generate HANDLES structure and store with GUIDATA 0587 guidata(gui_hFigure, guihandles(gui_hFigure)); 0588 end 0589 0590 % If user specified 'Visible','off' in p/v pairs, don't make the figure 0591 % visible. 0592 gui_MakeVisible = 1; 0593 for ind=1:2:length(varargin) 0594 if length(varargin) == ind 0595 break; 0596 end 0597 len1 = min(length('visible'),length(varargin{ind})); 0598 len2 = min(length('off'),length(varargin{ind+1})); 0599 if ischar(varargin{ind}) & ischar(varargin{ind+1}) & ... 0600 strncmpi(varargin{ind},'visible',len1) & len2 > 1 0601 if strncmpi(varargin{ind+1},'off',len2) 0602 gui_MakeVisible = 0; 0603 elseif strncmpi(varargin{ind+1},'on',len2) 0604 gui_MakeVisible = 1; 0605 end 0606 end 0607 end 0608 0609 % Check for figure param value pairs 0610 for index=1:2:length(varargin) 0611 if length(varargin) == index 0612 break; 0613 end 0614 try, set(gui_hFigure, varargin{index}, varargin{index+1}), catch, break, end 0615 end 0616 0617 % If handle visibility is set to 'callback', turn it on until finished 0618 % with OpeningFcn 0619 gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); 0620 if strcmp(gui_HandleVisibility, 'callback') 0621 set(gui_hFigure,'HandleVisibility', 'on'); 0622 end 0623 0624 feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:}); 0625 0626 if ishandle(gui_hFigure) 0627 % Update handle visibility 0628 set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); 0629 0630 % Make figure visible 0631 if gui_MakeVisible 0632 set(gui_hFigure, 'Visible', 'on') 0633 if gui_Options.singleton 0634 setappdata(gui_hFigure,'GUIOnScreen', 1); 0635 end 0636 end 0637 0638 % Done with GUI initialization 0639 rmappdata(gui_hFigure,'InGUIInitialization'); 0640 end 0641 0642 % If handle visibility is set to 'callback', turn it on until finished with 0643 % OutputFcn 0644 if ishandle(gui_hFigure) 0645 gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); 0646 if strcmp(gui_HandleVisibility, 'callback') 0647 set(gui_hFigure,'HandleVisibility', 'on'); 0648 end 0649 gui_Handles = guidata(gui_hFigure); 0650 else 0651 gui_Handles = []; 0652 end 0653 0654 if nargout 0655 [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); 0656 else 0657 feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); 0658 end 0659 0660 if ishandle(gui_hFigure) 0661 set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); 0662 end 0663 end 0664 0665 function gui_hFigure = local_openfig(name, singleton) 0666 if nargin('openfig') == 3 0667 gui_hFigure = openfig(name, singleton, 'auto'); 0668 else 0669 % OPENFIG did not accept 3rd input argument until R13, 0670 % toggle default figure visible to prevent the figure 0671 % from showing up too soon. 0672 gui_OldDefaultVisible = get(0,'defaultFigureVisible'); 0673 set(0,'defaultFigureVisible','off'); 0674 gui_hFigure = openfig(name, singleton); 0675 set(0,'defaultFigureVisible',gui_OldDefaultVisible); 0676 end 0677