Home > . > prt_ui_reviewmodel.m

prt_ui_reviewmodel

PURPOSE ^

PRT_UI_REVIEWMODEL M-file for prt_ui_reviewmodel.fig

SYNOPSIS ^

function varargout = prt_ui_reviewmodel(varargin)

DESCRIPTION ^

 PRT_UI_REVIEWMODEL M-file for prt_ui_reviewmodel.fig
 
 PRT_UI_REVIEWMODEL, by itself, creates a new PRT_UI_REVIEWMODEL or raises
 the existing singleton*.

 H = PRT_UI_REVIEWMODEL returns the handle to a new PRT_UI_REVIEWMODEL or 
 the handle to the existing singleton*.

 PRT_UI_REVIEWMODEL('CALLBACK',hObject,eventData,handles,...) calls the 
 local function named CALLBACK in PRT_UI_REVIEWMODEL.M with the given 
 input arguments.

 PRT_UI_REVIEWMODEL('Property','Value',...) creates a new PRT_UI_REVIEWMODEL
 or raises the existing singleton*.  Starting from the left, property 
 value pairs are applied to the GUI before prt_ui_reviewmodel_OpeningFcn 
 gets called.  An unrecognized property name or invalid value makes 
 property application stop.  All inputs are passed to prt_ui_reviewmodel_OpeningFcn
 via varargin.

 *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
  instance to run (singleton)".

 See also: GUIDE, GUIDATA, GUIHANDLES
__________________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = prt_ui_reviewmodel(varargin)
0002 % PRT_UI_REVIEWMODEL M-file for prt_ui_reviewmodel.fig
0003 %
0004 % PRT_UI_REVIEWMODEL, by itself, creates a new PRT_UI_REVIEWMODEL or raises
0005 % the existing singleton*.
0006 %
0007 % H = PRT_UI_REVIEWMODEL returns the handle to a new PRT_UI_REVIEWMODEL or
0008 % the handle to the existing singleton*.
0009 %
0010 % PRT_UI_REVIEWMODEL('CALLBACK',hObject,eventData,handles,...) calls the
0011 % local function named CALLBACK in PRT_UI_REVIEWMODEL.M with the given
0012 % input arguments.
0013 %
0014 % PRT_UI_REVIEWMODEL('Property','Value',...) creates a new PRT_UI_REVIEWMODEL
0015 % or raises the existing singleton*.  Starting from the left, property
0016 % value pairs are applied to the GUI before prt_ui_reviewmodel_OpeningFcn
0017 % gets called.  An unrecognized property name or invalid value makes
0018 % property application stop.  All inputs are passed to prt_ui_reviewmodel_OpeningFcn
0019 % via varargin.
0020 %
0021 % *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0022 %  instance to run (singleton)".
0023 %
0024 % See also: GUIDE, GUIDATA, GUIHANDLES
0025 %__________________________________________________________________________
0026 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0027 
0028 % Written by J. Schrouff
0029 % $Id$
0030 
0031 % Edit the above text to modify the response to help prt_ui_reviewmodel
0032 
0033 % Last Modified by GUIDE v2.5 25-Mar-2012 23:08:29
0034 
0035 % Begin initialization code - DO NOT EDIT
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 % End initialization code - DO NOT EDIT
0053 
0054 
0055 % --- Executes just before prt_ui_reviewmodel is made visible.
0056 function prt_ui_reviewmodel_OpeningFcn(hObject, eventdata, handles, varargin)
0057 % This function has no output args, see OutputFcn.
0058 % hObject    handle to figure
0059 % eventdata  reserved - to be defined in a future version of MATLAB
0060 % handles    structure with handles and user data (see GUIDATA)
0061 % varargin   command line arguments to prt_ui_reviewmodel (see VARARGIN)
0062 %if window already exists, just put it as the current figure
0063 Tag='modelrev';
0064 F = findall(allchild(0),'Flat','Tag',Tag);
0065 if length(F) > 1
0066     % Multiple Graphics windows - close all but most recent
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     %set size of the window, taking screen resolution and platform into account
0077     S0= spm('WinSize','0',1);   %-Screen size (of the current monitor)
0078     if ispc
0079         PF='MS Sans Serif';
0080     else
0081         PF= spm_platform('fonts');     %-Font names (for this platform)
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);  %factor to scale the fonts
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 % Choose default command line output for prt_ui_reviewmodel
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 %Get the indexes of the model and fs to display
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 % Update handles structure
0168 guidata(hObject, handles);
0169 
0170 
0171 
0172 % UIWAIT makes prt_ui_reviewmodel wait for user response (see UIRESUME)
0173 % uiwait(handles.figure1);
0174 
0175 
0176 % --- Outputs from this function are returned to the command line.
0177 function varargout = prt_ui_reviewmodel_OutputFcn(hObject, eventdata, handles) 
0178 % varargout  cell array for returning output args (see VARARGOUT);
0179 % hObject    handle to figure
0180 % eventdata  reserved - to be defined in a future version of MATLAB
0181 % handles    structure with handles and user data (see GUIDATA)
0182 
0183 % Get default command line output from handles structure
0184 if ~isempty(handles)
0185     varargout{1} = handles.output;
0186 end
0187 
0188 
0189 
0190 % --- Executes on selection change in pop_model.
0191 function pop_model_Callback(hObject, eventdata, handles)
0192 % hObject    handle to pop_model (see GCBO)
0193 % eventdata  reserved - to be defined in a future version of MATLAB
0194 % handles    structure with handles and user data (see GUIDATA)
0195 
0196 % Hints: contents = get(hObject,'String') returns pop_model contents as cell array
0197 %        contents{get(hObject,'Value')} returns selected item from pop_model
0198 %Get the indexes of the model and fs to display
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 % Update handles structure
0214 guidata(hObject, handles);
0215 
0216 
0217 % --- Executes during object creation, after setting all properties.
0218 function pop_model_CreateFcn(hObject, eventdata, handles)
0219 % hObject    handle to pop_model (see GCBO)
0220 % eventdata  reserved - to be defined in a future version of MATLAB
0221 % handles    empty - handles not created until after all CreateFcns called
0222 
0223 % Hint: popupmenu controls usually have a white background on Windows.
0224 %       See ISPC and COMPUTER.
0225 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0226     set(hObject,'BackgroundColor','white');
0227 end
0228 
0229 
0230 % --- Executes on button press in modelbutt.
0231 function modelbutt_Callback(hObject, eventdata, handles)
0232 % hObject    handle to modelbutt (see GCBO)
0233 % eventdata  reserved - to be defined in a future version of MATLAB
0234 % handles    structure with handles and user data (see GUIDATA)
0235 % --- Executes on button press in cvbutt.
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 % hObject    handle to cvbutt (see GCBO)
0243 % eventdata  reserved - to be defined in a future version of MATLAB
0244 % handles    structure with handles and user data (see GUIDATA)
0245 prt_ui_reviewCV('UserData',{handles.PRT,handles.indm,...
0246     handles.indf,handles.prtdir})
0247 
0248 
0249 % --- Executes on button press in kernbutt.
0250 function kernbutt_Callback(hObject, eventdata, handles)
0251 % hObject    handle to kernbutt (see GCBO)
0252 % eventdata  reserved - to be defined in a future version of MATLAB
0253 % handles    structure with handles and user data (see GUIDATA)
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

Generated on Tue 10-Feb-2015 18:16:33 by m2html © 2005