0001 function varargout = prt_ui_reviewmodel(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 gui_Singleton = 1;
0037 gui_State = struct('gui_Name', mfilename, ...
0038 'gui_Singleton', gui_Singleton, ...
0039 'gui_OpeningFcn', @prt_ui_reviewmodel_OpeningFcn, ...
0040 'gui_OutputFcn', @prt_ui_reviewmodel_OutputFcn, ...
0041 'gui_LayoutFcn', [] , ...
0042 'gui_Callback', []);
0043 if nargin && ischar(varargin{1})
0044 gui_State.gui_Callback = str2func(varargin{1});
0045 end
0046
0047 if nargout
0048 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0049 else
0050 gui_mainfcn(gui_State, varargin{:});
0051 end
0052
0053
0054
0055
0056 function prt_ui_reviewmodel_OpeningFcn(hObject, eventdata, handles, varargin)
0057
0058
0059
0060
0061
0062
0063 Tag='modelrev';
0064 F = findall(allchild(0),'Flat','Tag',Tag);
0065 if length(F) > 1
0066
0067 close(F(2:end))
0068 F = F(1);
0069 uistack(F,'top')
0070 elseif length(F)==1
0071 uistack(F,'top')
0072 else
0073 set(handles.figure1,'Tag',Tag)
0074
0075 set(handles.figure1,'Name','PRoNTo :: Review Model Specification')
0076
0077 S0= spm('WinSize','0',1);
0078 if ispc
0079 PF='MS Sans Serif';
0080 else
0081 PF= spm_platform('fonts');
0082 PF=PF.helvetica;
0083 end
0084 tmp = [S0(3)/1280 (S0(4))/800];
0085 ratio=min(tmp)*[1 1 1 1];
0086 FS = 1 + 0.85*(min(ratio)-1);
0087 x=get(handles.figure1,'Position');
0088 set(handles.figure1,'DefaultTextFontSize',FS*12,...
0089 'DefaultUicontrolFontSize',FS*12,...
0090 'DefaultTextFontName',PF,...
0091 'DefaultAxesFontName',PF,...
0092 'DefaultUicontrolFontName',PF)
0093 set(handles.figure1,'Position',ratio.*x)
0094 set(handles.figure1,'Resize','on')
0095
0096 color=prt_get_defaults('color');
0097 set(handles.figure1,'Color',color.bg1)
0098 aa=get(handles.figure1,'children');
0099 for i=1:length(aa)
0100 if strcmpi(get(aa(i),'type'),'uipanel')
0101 set(aa(i),'BackgroundColor',color.bg2)
0102 bb=get(aa(i),'children');
0103 if ~isempty(bb)
0104 for j=1:length(bb)
0105 if ~isempty(find(strcmpi(get(bb(j),'Style'),{'text',...
0106 'radiobutton','checkbox'})))
0107 set(bb(j),'BackgroundColor',color.bg2)
0108 elseif ~isempty(find(strcmpi(get(bb(j),'Style'),'pushbutton')))
0109 set(bb(j),'BackgroundColor',color.fr)
0110 end
0111 set(bb(j),'FontUnits','pixel')
0112 xf=get(bb(j),'FontSize');
0113 set(bb(j),'FontSize',ceil(FS*xf),'FontName',PF,...
0114 'FontUnits','normalized','Units','normalized')
0115 end
0116 end
0117 elseif strcmpi(get(aa(i),'type'),'uicontrol')
0118 if ~isempty(find(strcmpi(get(aa(i),'Style'),{'text',...
0119 'radiobutton','checkbox'})))
0120 set(aa(i),'BackgroundColor',color.bg1)
0121 elseif ~isempty(find(strcmpi(get(aa(i),'Style'),'pushbutton')))
0122 set(aa(i),'BackgroundColor',color.fr)
0123 end
0124 end
0125 set(aa(i),'FontUnits','pixel')
0126 xf=get(aa(i),'FontSize');
0127 if ispc
0128 set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0129 'FontUnits','normalized','Units','normalized')
0130 else
0131 set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0132 'Units','normalized')
0133 end
0134 end
0135
0136
0137
0138
0139 handles.output = hObject;
0140
0141 if ~isempty(varargin{1}) && strcmpi(varargin{1},'UserData')
0142 handles.PRT=varargin{2}{1};
0143 handles.prtdir=varargin{2}{2};
0144 else
0145 beep
0146 disp('PRT.mat needs to be provided')
0147 return
0148 end
0149
0150 if ~isfield(handles.PRT,'model')
0151 beep
0152 disp('No model found in this PRT.mat')
0153 disp('No reviewing can be performed')
0154 delete(handles.figure1)
0155 end
0156
0157 listmod={handles.PRT.model(:).model_name};
0158 set(handles.pop_model,'String',listmod)
0159 set(handles.pop_model,'Value',1)
0160
0161 indm=get(handles.pop_model,'Value');
0162 if indm==0
0163 set(handles.pop_model,'Value',1)
0164 indm=1;
0165 end
0166 in.fs_name=handles.PRT.model(indm).input.fs.fs_name;
0167 indf=prt_init_fs(handles.PRT,in);
0168 handles.indm=indm;
0169 handles.indf=indf;
0170 end
0171
0172 guidata(hObject, handles);
0173
0174
0175
0176
0177
0178
0179
0180 function varargout = prt_ui_reviewmodel_OutputFcn(hObject, eventdata, handles)
0181
0182
0183
0184
0185
0186
0187 varargout{1} = handles.output;
0188
0189
0190
0191 function pop_model_Callback(hObject, eventdata, handles)
0192
0193
0194
0195
0196
0197
0198
0199 indm=get(handles.pop_model,'Value');
0200 if indm==0
0201 set(handles.pop_model,'Value',1)
0202 indm=1;
0203 end
0204 in.fs_name=handles.PRT.model(indm).input.fs.fs_name;
0205 indf=prt_init_fs(handles.PRT,in);
0206 handles.indm=indm;
0207 handles.indf=indf;
0208 if ~isfield(handles.PRT.model(handles.indm).input,'class')
0209 set(handles.modelbutt,'Enable','off')
0210 else
0211 set(handles.modelbutt,'Enable','on')
0212 end
0213
0214 guidata(hObject, handles);
0215
0216
0217 function pop_model_CreateFcn(hObject, eventdata, handles)
0218
0219
0220
0221
0222
0223
0224 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0225 set(hObject,'BackgroundColor','white');
0226 end
0227
0228
0229 function modelbutt_Callback(hObject, eventdata, handles)
0230
0231
0232
0233
0234 if isfield(handles.PRT.model(handles.indm).input,'class')
0235 prt_ui_select_class('UserData',{handles.PRT,handles.indf,handles.indm})
0236 end
0237
0238 function cvbutt_Callback(hObject, eventdata, handles)
0239
0240
0241
0242 prt_ui_reviewCV('UserData',{handles.PRT,handles.indm,...
0243 handles.indf,handles.prtdir})
0244
0245
0246 function kernbutt_Callback(hObject, eventdata, handles)
0247
0248
0249
0250 hf=figure;
0251 set(hf,'NumberTitle','off')
0252 set(hf,'Name','PRoNTo :: Review kernel')
0253 kername=handles.PRT.fs(handles.indf).k_file;
0254 try
0255 load([handles.prtdir,filesep,kername])
0256 catch
0257 beep
0258 disp('Could not load kernel file')
0259 return
0260 end
0261 imagesc(Phi)
0262 colormap(jet)
0263 colorbar