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 set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0128 'Units','normalized')
0129 end
0130
0131
0132
0133
0134 handles.output = hObject;
0135
0136 if ~isempty(varargin{1}) && strcmpi(varargin{1},'UserData')
0137 handles.PRT=varargin{2}{1};
0138 handles.prtdir=varargin{2}{2};
0139 else
0140 beep
0141 disp('PRT.mat needs to be provided')
0142 return
0143 end
0144
0145 if ~isfield(handles.PRT,'model')
0146 beep
0147 disp('No model found in this PRT.mat')
0148 disp('No reviewing can be performed')
0149 delete(handles.figure1)
0150 return
0151 end
0152
0153 listmod={handles.PRT.model(:).model_name};
0154 set(handles.pop_model,'String',listmod)
0155 set(handles.pop_model,'Value',1)
0156
0157 indm=get(handles.pop_model,'Value');
0158 if indm==0
0159 set(handles.pop_model,'Value',1)
0160 indm=1;
0161 end
0162 in.fs_name=handles.PRT.model(indm).input.fs.fs_name;
0163 indf=prt_init_fs(handles.PRT,in);
0164 handles.indm=indm;
0165 handles.indf=indf;
0166 end
0167
0168 guidata(hObject, handles);
0169
0170
0171
0172
0173
0174
0175
0176
0177 function varargout = prt_ui_reviewmodel_OutputFcn(hObject, eventdata, handles)
0178
0179
0180
0181
0182
0183
0184 if ~isempty(handles)
0185 varargout{1} = handles.output;
0186 end
0187
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
0218 function pop_model_CreateFcn(hObject, eventdata, handles)
0219
0220
0221
0222
0223
0224
0225 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0226 set(hObject,'BackgroundColor','white');
0227 end
0228
0229
0230
0231 function modelbutt_Callback(hObject, eventdata, handles)
0232
0233
0234
0235
0236 if isfield(handles.PRT.model(handles.indm).input,'class')
0237 prt_ui_select_class('UserData',{handles.PRT,handles.indf,handles.indm})
0238 end
0239
0240
0241 function cvbutt_Callback(hObject, eventdata, handles)
0242
0243
0244
0245 prt_ui_reviewCV('UserData',{handles.PRT,handles.indm,...
0246 handles.indf,handles.prtdir})
0247
0248
0249
0250 function kernbutt_Callback(hObject, eventdata, handles)
0251
0252
0253
0254 kername=handles.PRT.fs(handles.indf).k_file;
0255 try
0256 load([handles.prtdir,filesep,kername])
0257 catch
0258 beep
0259 disp('Could not load kernel file')
0260 return
0261 end
0262 list = {};
0263 for i=1:length(Phi)
0264 list = [list;{['Kernel ',num2str(i)]}];
0265 end
0266 hf=figure;
0267 set(hf,'NumberTitle','off')
0268 set(hf,'Name','PRoNTo :: Review kernel')
0269 color=prt_get_defaults('color');
0270 set(hf,'Color',color.bg1)
0271 S0= spm('WinSize','0',1);
0272 tmp = [S0(3)/1280 (S0(4))/800];
0273 ratio=min(tmp)*[1 1 1 1];
0274 set(hf,'Resize','on')
0275 set(hf,'Position',ratio.*[360 278 560 420])
0276 set(hf,'Units','normalized')
0277 c = uicontrol(hf,'Style','popupmenu',...
0278 'String',list,...
0279 'Position', [170 365 200 50],...
0280 'Callback',@dispkern);
0281 set(c,'Units','normalized')
0282 set(c,'UserData',Phi)
0283 imagesc(Phi{1})
0284 colormap(jet)
0285 colorbar
0286
0287 function dispkern(source,callbackdata)
0288 ind = get(source,'Value');
0289 Phi = get(source,'UserData');
0290 imagesc(Phi{ind})
0291 colormap(jet)
0292 colorbar