Home > . > prt_ui_results_ROI.m

prt_ui_results_ROI

PURPOSE ^

PRT_UI_RESULTS_ROI M-file for prt_ui_results_ROI.fig

SYNOPSIS ^

function varargout = prt_ui_results_ROI(varargin)

DESCRIPTION ^

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

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

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

 PRT_UI_RESULTS_ROI('Property','Value',...) creates a new 
 PRT_UI_RESULTS_ROI or raises the existing singleton*.  Starting from the
 left, property value pairs are applied to the GUI before 
 prt_ui_results_ROI_OpeningFcn gets called.  An unrecognized property name
 or invalid value makes property application stop.  All inputs are passed 
 to prt_ui_results_ROI_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_results_ROI(varargin)
0002 % PRT_UI_RESULTS_ROI M-file for prt_ui_results_ROI.fig
0003 %
0004 % PRT_UI_RESULTS_ROI, by itself, creates a new PRT_UI_RESULTS_ROI or
0005 % raises the existing singleton*.
0006 %
0007 % H = PRT_UI_RESULTS_ROI returns the handle to a new PRT_UI_RESULTS_ROI
0008 % or the handle to the existing singleton*.
0009 %
0010 % PRT_UI_RESULTS_ROI('CALLBACK',hObject,eventData,handles,...) calls the
0011 % local function named CALLBACK in PRT_UI_RESULTS_ROI.M with the given
0012 % input arguments.
0013 %
0014 % PRT_UI_RESULTS_ROI('Property','Value',...) creates a new
0015 % PRT_UI_RESULTS_ROI or raises the existing singleton*.  Starting from the
0016 % left, property value pairs are applied to the GUI before
0017 % prt_ui_results_ROI_OpeningFcn gets called.  An unrecognized property name
0018 % or invalid value makes property application stop.  All inputs are passed
0019 % to prt_ui_results_ROI_OpeningFcn 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_results_ROI.m 555 2012-06-12 08:44:51Z cphillip $
0030 
0031 % Edit the above text to modify the response to help prt_ui_results_ROI
0032 
0033 % Last Modified by GUIDE v2.5 18-Feb-2013 10:31:01
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_results_ROI_OpeningFcn, ...
0040                    'gui_OutputFcn',  @prt_ui_results_ROI_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_results_ROI is made visible.
0056 function prt_ui_results_ROI_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_results_ROI (see VARARGIN)
0062 
0063 % Choose default command line output for prt_ui_results_ROI
0064 handles.output = hObject;
0065 
0066 %if window already exists, just put it as the current figure
0067 Tag='ResROI';
0068 F = findall(allchild(0),'Flat','Tag',Tag);
0069 if length(F) > 1
0070     % Multiple Graphics windows - close all but most recent
0071     close(F(2:end))
0072     F = F(1);
0073     uistack(F,'top')
0074 elseif length(F)==1
0075     uistack(F,'top')
0076 else
0077     set(handles.figure1,'Tag',Tag)
0078     %build figure when it doesn't exist yet
0079     set(handles.figure1,'Name','PRoNTo :: ROI weights')
0080     %set size of the window, taking screen resolution and platform into account
0081     S0= spm('WinSize','0',1);   %-Screen size (of the current monitor)
0082     if ispc
0083         PF ='MS Sans Serif';
0084     else
0085         PF = spm_platform('fonts');     %-Font names (for this platform)
0086         PF = PF.helvetica;
0087     end
0088     tmp  = [S0(3)/1280 (S0(4))/800];
0089     ratio=min(tmp)*[1 1 1 1];
0090     FS = 1 + 0.85*(min(ratio)-1);  %factor to scale the fonts
0091     x=get(handles.figure1,'Position');
0092     set(handles.figure1,'DefaultTextFontSize',FS*12,...
0093         'DefaultUicontrolFontSize',FS*12,...
0094         'DefaultTextFontName',PF,...
0095         'DefaultAxesFontName',PF,...
0096         'DefaultUicontrolFontName',PF)
0097     set(handles.figure1,'Position',ratio.*x)
0098     set(handles.figure1,'Resize','on')
0099     
0100     % Choose the color of the different backgrounds and figure parameters
0101     color=prt_get_defaults('color');
0102     set(handles.figure1,'Color',color.bg1)
0103     aa=get(handles.figure1,'children');
0104     for i=1:length(aa)
0105         if strcmpi(get(aa(i),'type'),'uipanel')
0106             set(aa(i),'BackgroundColor',color.bg2)
0107             bb=get(aa(i),'children');
0108             if ~isempty(bb)
0109                 for j=1:length(bb)
0110                     if ~isempty(find(strcmpi(get(bb(j),'Style'),{'text',...
0111                             'radiobutton','checkbox'})))
0112                         set(bb(j),'BackgroundColor',color.bg2)
0113                     elseif ~isempty(find(strcmpi(get(bb(j),'Style'),'pushbutton')))
0114                         set(bb(j),'BackgroundColor',color.fr)
0115                     end
0116                     set(bb(j),'FontUnits','pixel')
0117                     xf=get(bb(j),'FontSize');
0118                     set(bb(j),'FontSize',ceil(FS*xf),'FontName',PF,...
0119                         'FontUnits','normalized','Units','normalized')
0120                 end
0121             end
0122         elseif strcmpi(get(aa(i),'type'),'uicontrol')
0123             if ~isempty(find(strcmpi(get(aa(i),'Style'),{'text',...
0124                     'radiobutton','checkbox','listbox'})))
0125                 set(aa(i),'BackgroundColor',color.bg1)
0126             elseif ~isempty(find(strcmpi(get(aa(i),'Style'),'pushbutton')))
0127                 set(aa(i),'BackgroundColor',color.fr)
0128             end
0129         end
0130         set(aa(i),'FontUnits','pixel')
0131         xf=get(aa(i),'FontSize');
0132         set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0133             'Units','normalized')
0134     end
0135     
0136     %fill table with UserData
0137     if ~isempty(varargin) && strcmpi(varargin{1},'UserData')
0138         LR=varargin{2}{1};
0139         pHN=varargin{2}{2};
0140         drwn=varargin{2}{3};
0141         erwn=varargin{2}{4};
0142         SN=varargin{2}{5};
0143         P_oth=varargin{2}{6};
0144         oth_w=varargin{2}{7};
0145     else
0146         f=spm_select(1,'.mat','Select .mat created from atlas weights');
0147         if ~isempty(f)
0148             load(f);
0149             try
0150                 pHN=NW_roi;
0151             catch
0152                 error('PRoNTo:prt_ui_results_ROI:Nodata',...
0153                     'No ROI names or weight values found')
0154             end
0155         else
0156             error('PRoNTo:prt_ui_results_ROI:Nomat',...
0157                  'No file selected')
0158         end
0159         %future: load the saved .mat file
0160     end
0161     szn=length(LR);
0162     dat=cell(szn,4);
0163     for i=1:szn
0164         dat{i,1}=LR{i};
0165         dat{i,2}=pHN(i,end);
0166         dat{i,3}=erwn(i);
0167         dat{i,4}=SN(i,end);
0168     end
0169     handles.LR=LR;
0170     handles.pHN=pHN;
0171     handles.SN=SN;
0172     handles.rwn=erwn;
0173     handles.dat=dat;
0174     set(handles.ROItable,'Data',dat);
0175     set(handles.ROItable,'ColumnName',{'ROI Name','NW_roi (in %)',...
0176         'Ranking','Pos weights (in %)'});
0177     set(handles.ROItable,'ColumnEditable',[false,false,false,false]);
0178     set(handles.ROItable,'ColumnWidth',{130,80,80,80});
0179     set(handles.ROItable,'ColumnFormat',{'char','numeric',...
0180         'numeric','numeric'});
0181     
0182     %Set the values for the 'others' region
0183     handles.P_oth=P_oth;
0184     handles.oth_w=oth_w;
0185     set(handles.vol_oth,'String',num2str(P_oth*100))
0186     set(handles.w_oth,'String',num2str(oth_w))
0187     
0188     %get the number of folds to create the popup menu
0189     handles.nfolds=size(pHN,2)-1;
0190     list=get(handles.foldp,'String');
0191     for ii=1:handles.nfolds
0192         list=[list,{['Fold ',num2str(ii)]}];
0193     end
0194     set(handles.foldp,'String',list)
0195     set(handles.foldp,'Value',1)
0196     
0197     % Update Histogram of weights
0198     set(handles.figure1, 'Currentaxes',handles.axes1)
0199     H1 = bar(1:size(dat,1),pHN(:,end));
0200     set(H1,'BarWidth',0.8)
0201     set(gca,'xlim',[0 size(dat,1)+1])
0202     title('Histogram of normalized weights per region','FontWeight','bold')
0203     set(gca,'XTickLabel',{''})
0204     set(gca,'XTick',0)
0205     legend('NW_{roi}','Location','NorthEast')
0206     
0207     %Update histogram of ranking distances between each fold and the average
0208     set(handles.figure1, 'Currentaxes',handles.axes2)
0209     h=bar(handles.axes2,drwn');
0210     set(get(handles.axes2,'Title'),'String','Ranking distance to average across folds',...
0211         'Fontweight','bold')
0212     xlabel(handles.axes2,'Folds','Fontweight','bold')
0213     set(handles.axes2,'Xtick',1:handles.nfolds)
0214     set(handles.axes2,'XTickLabel',{''})
0215 end
0216 % Update handles structure
0217 guidata(hObject, handles);
0218 
0219 
0220 % --- Outputs from this function are returned to the command line.
0221 function varargout = prt_ui_results_ROI_OutputFcn(hObject, eventdata, handles) 
0222 % varargout  cell array for returning output args (see VARARGOUT);
0223 % hObject    handle to figure
0224 % eventdata  reserved - to be defined in a future version of MATLAB
0225 % handles    structure with handles and user data (see GUIDATA)
0226 
0227 varargout{1} = handles.output;
0228 
0229 
0230 
0231 % --- Executes when entered data in editable cell(s) in ROItable.
0232 function ROItable_CellEditCallback(hObject, eventdata, handles)
0233 % hObject    handle to ROItable (see GCBO)
0234 % eventdata  structure with the following fields (see UITABLE)
0235 %    Indices: row and column indices of the cell(s) edited
0236 %    PreviousData: previous data for the cell(s) edited
0237 %    EditData: string(s) entered by the user
0238 %    NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
0239 %    Error: error string when failed to convert EditData to appropriate value for Data
0240 % handles    structure with handles and user data (see GUIDATA)
0241 
0242 % Update handles structure
0243 guidata(hObject, handles);
0244 
0245 % --- Executes on selection change in foldp.
0246 function foldp_Callback(hObject, eventdata, handles)
0247 % hObject    handle to foldp (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 
0251 % Hints: contents = get(hObject,'String') returns foldp contents as cell array
0252 %        contents{get(hObject,'Value')} returns selected item from foldp
0253 v=get(handles.foldp,'Value');
0254 if v==0 || isempty(v)
0255     v=1;
0256 end
0257 
0258 szn=length(handles.LR);
0259 dat=cell(szn,4);
0260 for i=1:szn
0261     dat{i,1}=handles.LR{i};
0262     if v==1 %dispay the average
0263         dat{i,2}=handles.pHN(i,end);
0264         dat{i,4}=handles.SN(i,end);
0265     else
0266         dat{i,2}=handles.pHN(i,v-1);
0267         dat{i,4}=handles.SN(i,v-1);
0268     end
0269     dat{i,3}=handles.rwn(i);
0270 end
0271 set(handles.ROItable,'Data',dat)
0272 
0273 % Update Histogram of weights
0274 set(handles.figure1, 'Currentaxes',handles.axes1)
0275 H1 = bar(1:size(dat,1),[dat{:,2}]);
0276 set(H1,'BarWidth',0.8)
0277 set(gca,'xlim',[0 size(dat,1)+1])
0278 title('Histogram of normalized weights per region','FontWeight','bold')
0279 set(gca,'XTickLabel',{''})
0280 set(gca,'XTick',0)
0281 legend('NW_{roi}','Location','NorthEast')
0282 
0283 % Update handles structure
0284 guidata(hObject, handles);
0285 
0286 % --- Executes during object creation, after setting all properties.
0287 function foldp_CreateFcn(hObject, eventdata, handles)
0288 % hObject    handle to foldp (see GCBO)
0289 % eventdata  reserved - to be defined in a future version of MATLAB
0290 % handles    empty - handles not created until after all CreateFcns called
0291 
0292 % Hint: popupmenu controls usually have a white background on Windows.
0293 %       See ISPC and COMPUTER.
0294 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0295     set(hObject,'BackgroundColor','white');
0296 end
0297 
0298 
0299 % --- Executes on button press in sortHN.
0300 function sortHN_Callback(hObject, eventdata, handles)
0301 % hObject    handle to sortHN (see GCBO)
0302 % eventdata  reserved - to be defined in a future version of MATLAB
0303 % handles    structure with handles and user data (see GUIDATA)
0304 v=get(handles.foldp,'Value');
0305 if v==0 || isempty(v)
0306     v=1;
0307 end
0308 if v==1
0309     [d1,d2]=sort(handles.pHN(:,end),'descend');
0310 else
0311     [d1,d2]=sort(handles.pHN(:,v-1),'descend');
0312 end
0313 isn=find(isnan(handles.pHN(:,1)));
0314 d3=1:length(isn);
0315 d4=length(isn)+1:size(d1,1);
0316 ihn=[d2(d4,:);d2(d3,:)];
0317 szn=length(handles.LR);
0318 dat=cell(szn,4);
0319 for i=1:szn
0320     dat{i,1}=handles.LR{i};
0321     if v==1 %dispay the average
0322         dat{i,2}=handles.pHN(i,end);
0323         dat{i,4}=handles.SN(i,end);
0324     else
0325         dat{i,2}=handles.pHN(i,v-1);
0326         dat{i,4}=handles.SN(i,v-1);
0327     end
0328     dat{i,3}=handles.rwn(i);
0329 end
0330 dat=dat(ihn,:);
0331 set(handles.ROItable,'Data',dat)
0332 
0333 % Update Histogram of weights
0334 set(handles.figure1, 'Currentaxes',handles.axes1)
0335 H1 = bar(1:size(dat,1),[dat{:,2}]);
0336 set(H1,'BarWidth',0.8)
0337 set(gca,'xlim',[0 size(dat,1)+1])
0338 title('Histogram of normalized weights per region','FontWeight','bold')
0339 set(gca,'XTickLabel',{''})
0340 set(gca,'XTick',0)
0341 legend('NW_{roi}','Location','NorthEast')
0342 
0343 % Update handles structure
0344 guidata(hObject, handles);
0345 
0346 
0347 % --- Executes on button press in quitbutt.
0348 function quitbutt_Callback(hObject, eventdata, handles)
0349 % hObject    handle to quitbutt (see GCBO)
0350 % eventdata  reserved - to be defined in a future version of MATLAB
0351 % handles    structure with handles and user data (see GUIDATA)
0352 % The figure can be deleted now
0353 if isfield(handles,'figure1')
0354     delete(handles.figure1);
0355 end
0356 
0357 
0358 
0359 function vol_oth_Callback(hObject, eventdata, handles)
0360 % hObject    handle to vol_oth (see GCBO)
0361 % eventdata  reserved - to be defined in a future version of MATLAB
0362 % handles    structure with handles and user data (see GUIDATA)
0363 
0364 % Hints: get(hObject,'String') returns contents of vol_oth as text
0365 %        str2double(get(hObject,'String')) returns contents of vol_oth as a
0366 %        double
0367 
0368 
0369 % --- Executes during object creation, after setting all properties.
0370 function vol_oth_CreateFcn(hObject, eventdata, handles)
0371 % hObject    handle to vol_oth (see GCBO)
0372 % eventdata  reserved - to be defined in a future version of MATLAB
0373 % handles    empty - handles not created until after all CreateFcns called
0374 
0375 % Hint: edit controls usually have a white background on Windows.
0376 %       See ISPC and COMPUTER.
0377 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0378     set(hObject,'BackgroundColor','white');
0379 end
0380 
0381 
0382 
0383 function w_oth_Callback(hObject, eventdata, handles)
0384 % hObject    handle to w_oth (see GCBO)
0385 % eventdata  reserved - to be defined in a future version of MATLAB
0386 % handles    structure with handles and user data (see GUIDATA)
0387 
0388 % Hints: get(hObject,'String') returns contents of w_oth as text
0389 %        str2double(get(hObject,'String')) returns contents of w_oth as a double
0390 
0391 
0392 % --- Executes during object creation, after setting all properties.
0393 function w_oth_CreateFcn(hObject, eventdata, handles)
0394 % hObject    handle to w_oth (see GCBO)
0395 % eventdata  reserved - to be defined in a future version of MATLAB
0396 % handles    empty - handles not created until after all CreateFcns called
0397 
0398 % Hint: edit controls usually have a white background on Windows.
0399 %       See ISPC and COMPUTER.
0400 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0401     set(hObject,'BackgroundColor','white');
0402 end

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