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: prt_ui_reviewmodel.m 523 2012-05-09 11:43:36Z jrichiar $
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     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 % Choose default command line output for prt_ui_reviewmodel
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 %Get the indexes of the model and fs to display
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 % Update handles structure
0172 guidata(hObject, handles);
0173 
0174 
0175 % UIWAIT makes prt_ui_reviewmodel wait for user response (see UIRESUME)
0176 % uiwait(handles.figure1);
0177 
0178 
0179 % --- Outputs from this function are returned to the command line.
0180 function varargout = prt_ui_reviewmodel_OutputFcn(hObject, eventdata, handles) 
0181 % varargout  cell array for returning output args (see VARARGOUT);
0182 % hObject    handle to figure
0183 % eventdata  reserved - to be defined in a future version of MATLAB
0184 % handles    structure with handles and user data (see GUIDATA)
0185 
0186 % Get default command line output from handles structure
0187 varargout{1} = handles.output;
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 % --- Executes during object creation, after setting all properties.
0217 function pop_model_CreateFcn(hObject, eventdata, handles)
0218 % hObject    handle to pop_model (see GCBO)
0219 % eventdata  reserved - to be defined in a future version of MATLAB
0220 % handles    empty - handles not created until after all CreateFcns called
0221 
0222 % Hint: popupmenu controls usually have a white background on Windows.
0223 %       See ISPC and COMPUTER.
0224 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0225     set(hObject,'BackgroundColor','white');
0226 end
0227 
0228 % --- Executes on button press in modelbutt.
0229 function modelbutt_Callback(hObject, eventdata, handles)
0230 % hObject    handle to modelbutt (see GCBO)
0231 % eventdata  reserved - to be defined in a future version of MATLAB
0232 % handles    structure with handles and user data (see GUIDATA)
0233 % --- Executes on button press in cvbutt.
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 % hObject    handle to cvbutt (see GCBO)
0240 % eventdata  reserved - to be defined in a future version of MATLAB
0241 % handles    structure with handles and user data (see GUIDATA)
0242 prt_ui_reviewCV('UserData',{handles.PRT,handles.indm,...
0243     handles.indf,handles.prtdir})
0244 
0245 % --- Executes on button press in kernbutt.
0246 function kernbutt_Callback(hObject, eventdata, handles)
0247 % hObject    handle to kernbutt (see GCBO)
0248 % eventdata  reserved - to be defined in a future version of MATLAB
0249 % handles    structure with handles and user data (see GUIDATA)
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

Generated on Mon 03-Sep-2012 18:07:18 by m2html © 2005