Home > . > prt_data_modality.m

prt_data_modality

PURPOSE ^

PRT_DATA_MODALITY M-file for prt_data_modality.fig

SYNOPSIS ^

function varargout = prt_data_modality(varargin)

DESCRIPTION ^

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

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

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

 PRT_DATA_MODALITY('Property','Value',...) creates a new PRT_DATA_MODALITY
 or raises the existing singleton*.  Starting from the left, property value
 pairs are applied to the GUI before prt_data_modality_OpeningFcn gets called.  
 An unrecognized property name or invalid value makes property application
 stop.  All inputs are passed to prt_data_modality_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_data_modality(varargin)
0002 % PRT_DATA_MODALITY M-file for prt_data_modality.fig
0003 %
0004 % PRT_DATA_MODALITY, by itself, creates a new PRT_DATA_MODALITY or raises
0005 % the existing singleton*.
0006 %
0007 % H = PRT_DATA_MODALITY returns the handle to a new PRT_DATA_MODALITY or
0008 % the handle to the existing singleton*.
0009 %
0010 % PRT_DATA_MODALITY('CALLBACK',hObject,eventData,handles,...) calls the local
0011 % function named CALLBACK in PRT_DATA_MODALITY.M with the given input arguments.
0012 %
0013 % PRT_DATA_MODALITY('Property','Value',...) creates a new PRT_DATA_MODALITY
0014 % or raises the existing singleton*.  Starting from the left, property value
0015 % pairs are applied to the GUI before prt_data_modality_OpeningFcn gets called.
0016 % An unrecognized property name or invalid value makes property application
0017 % stop.  All inputs are passed to prt_data_modality_OpeningFcn via varargin.
0018 %
0019 % *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0020 %  instance to run (singleton)".
0021 %
0022 % See also: GUIDE, GUIDATA, GUIHANDLES
0023 %_______________________________________________________________________
0024 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0025 
0026 % Written by J.Schrouff
0027 % $Id: prt_data_modality.m 568 2012-08-07 19:18:34Z schrouff $
0028 
0029 % Edit the above text to modify the response to help prt_data_modality
0030 
0031 % Last Modified by GUIDE v2.5 25-Oct-2011 18:14:12
0032 
0033 % Begin initialization code - DO NOT EDIT
0034 
0035 
0036 gui_Singleton = 1;
0037 gui_State = struct('gui_Name',       mfilename, ...
0038                    'gui_Singleton',  gui_Singleton, ...
0039                    'gui_OpeningFcn', @prt_data_modality_OpeningFcn, ...
0040                    'gui_OutputFcn',  @prt_data_modality_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_data_modality is made visible.
0056 function prt_data_modality_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_data_modality (see VARARGIN)
0062 
0063 % Choose default command line output for prt_data_modality
0064 handles.output = hObject;
0065 
0066 %if window already exists, just put it as the current figure
0067 Tag='DDmod';
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 
0079     set(handles.figure1,'Name','PRoNTo :: Specify modality')
0080     set(handles.design_menu,...
0081             'String',{'Load SPM.mat','Specify design','No design'},...
0082             'Value',3);
0083 
0084     %set size of the window, taking screen resolution and platform into account
0085     S0= spm('WinSize','0',1);   %-Screen size (of the current monitor)
0086     if ispc
0087         PF='MS Sans Serif';
0088     else
0089         PF= spm_platform('fonts');     %-Font names (for this platform)
0090         PF=PF.helvetica;
0091     end
0092     tmp  = [S0(3)/1280 (S0(4))/800];
0093     ratio=min(tmp)*[1 1 1 1];
0094     FS = 1 + 0.85*(min(ratio)-1);  %factor to scale the fonts
0095     x=get(handles.figure1,'Position');
0096     set(handles.figure1,'DefaultTextFontSize',FS*8,...
0097         'DefaultUicontrolFontSize',FS*8,...
0098         'DefaultTextFontName',PF,...
0099         'DefaultAxesFontName',PF,...
0100         'DefaultUicontrolFontName',PF)
0101     set(handles.figure1,'Position',ratio.*x)
0102     set(handles.figure1,'Resize','on') 
0103 
0104     % Choose the color of the different backgrounds and figure parameters
0105     color=prt_get_defaults('color');
0106     set(handles.figure1,'Color',color.bg1)
0107     aa=get(handles.figure1,'children');
0108     for i=1:length(aa)
0109         if strcmpi(get(aa(i),'type'),'uipanel')
0110             set(aa(i),'BackgroundColor',color.bg2)
0111             bb=get(aa(i),'children');
0112             if ~isempty(bb)
0113                 for j=1:length(bb)
0114                     if ~isempty(find(strcmpi(get(bb(j),'Style'),{'text',...
0115                             'radiobutton','checkbox'}))) 
0116                         set(bb(j),'BackgroundColor',color.bg2)
0117                     elseif ~isempty(find(strcmpi(get(bb(j),'Style'),'pushbutton'))) 
0118                         set(bb(j),'BackgroundColor',color.fr)
0119                     end
0120                     set(bb(j),'FontUnits','pixel')
0121                     xf=get(bb(j),'FontSize');
0122                     set(bb(j),'FontSize',ceil(FS*xf),'FontName',PF,...
0123                         'FontUnits','normalized','Units','normalized')
0124                 end
0125             end                    
0126         else
0127             if ~isempty(find(strcmpi(get(aa(i),'Style'),{'text',...
0128                     'radiobutton','checkbox','listbox'})))
0129                 set(aa(i),'BackgroundColor',color.bg1)
0130             elseif ~isempty(find(strcmpi(get(aa(i),'Style'),'pushbutton')))
0131                 set(aa(i),'BackgroundColor',color.fr)
0132             end
0133         end
0134         set(aa(i),'FontUnits','pixel')
0135         xf=get(aa(i),'FontSize');
0136         if ispc
0137             set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0138                 'FontUnits','normalized','Units','normalized')
0139         else
0140             set(aa(i),'FontSize',ceil(FS*xf),'FontName',PF,...
0141                 'Units','normalized')
0142         end
0143     end
0144 
0145 
0146 
0147 
0148     handles.mod=[];
0149     handles.mod.detrend=1;
0150     handles.mod.design=0;
0151     handles.mod.scans=[];
0152     handles.mod.name={};
0153     handles.mod.covar=[];
0154     handles.mod.rt_subj=[];
0155     handles.subj1=0;
0156 
0157     if ~isempty(varargin) && strcmpi(varargin{1},'UserData')
0158         %Particular options if you select by 'scans'
0159         if ~isempty(varargin{2}{2}) && strcmpi(varargin{2}{2}.subj_name,'Scans')
0160             set(handles.design_menu,'Enable','off')
0161             set(handles.edit_regt,'Enable','on')
0162             set(handles.edit_regt,'Visible','on')
0163             set(handles.edit_covar,'Enable','on')
0164             set(handles.edit_covar,'Visible','on')
0165             set(handles.text7,'Visible','on')
0166             set(handles.text6,'Visible','on')
0167         else
0168             set(handles.design_menu,'Enable','on')
0169             set(handles.edit_regt,'Enable','off')
0170             set(handles.edit_regt,'Visible','off')
0171             set(handles.edit_covar,'Enable','off')
0172             set(handles.edit_covar,'Visible','off')
0173             set(handles.text7,'Visible','off')
0174             set(handles.text6,'Visible','off')
0175         end
0176 
0177         if ~isempty(varargin{2}{2}) && isfield(varargin{2}{2},'modality') && ...
0178                 ~isempty(varargin{2}{2}.modality)
0179             handles.subjmod={varargin{2}{2}.modality(:).mod_name};
0180             if length(varargin{2})>=3 && ~isempty(varargin{2}{3})
0181                 nlist=varargin{2}{1};
0182                 modsel=varargin{2}{2}.modality(varargin{2}{3});
0183                 valsel=find(strcmpi(modsel.mod_name,nlist));
0184                 set(handles.modname,'String',nlist);
0185                 set(handles.modname,'Value',valsel);
0186                 handles.mod.detrend=modsel.detrend;
0187                 handles.mod.design=modsel.design;
0188                 if ~isempty(modsel.design)
0189                     set(handles.design_menu,'Value',2)
0190                     handles.desnmenu=2;
0191                 end
0192                 handles.mod.scans=modsel.scans;
0193                 handles.mod.name=modsel.mod_name;
0194                 handles.mod.covar=modsel.covar;
0195                 handles.mod.rt_subj=modsel.rt_subj;
0196             else
0197                 nlist=[varargin{2}{1}, {'Enter new'}];
0198                 set(handles.modname,'String',nlist,'Value',length(nlist));  
0199             end
0200         else
0201             nlist=[varargin{2}{1}, {'Enter new'}];
0202             set(handles.modname,'String',nlist,'Value',length(nlist));  
0203             handles.subjmod={};
0204         end
0205     else
0206         nlist={'Enter new'};
0207         handles.subjmod={};
0208         set(handles.modname,'String',nlist,'Value',1);
0209     end
0210     if length(varargin{2})>=4 && ~isempty(varargin{2}{4})
0211         handles.subj1=varargin{2}{4};
0212     end
0213     if length(varargin{2})==5 && ~isempty(varargin{2}{5})
0214         handles.PRT=varargin{2}{5};
0215     end
0216     warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid')
0217 end
0218 % Update handles structure
0219 guidata(hObject, handles);
0220 
0221 % %UIWAIT makes prt_data_modality wait for user response (see UIRESUME)
0222 uiwait(handles.figure1);
0223 
0224 
0225 % --- Outputs from this function are returned to the command line.
0226 function varargout = prt_data_modality_OutputFcn(hObject, eventdata, handles) 
0227 % varargout  cell array for returning output args (see VARARGOUT);
0228 % hObject    handle to figure
0229 % eventdata  reserved - to be defined in a future version of MATLAB
0230 % handles    structure with handles and user data (see GUIDATA)
0231 
0232 % Get default command line output from handles structure
0233 if isfield(handles,'output') && ~isempty(handles.output)
0234     varargout{1} = handles.output;
0235 else
0236     varargout{1}=[];
0237 end
0238 
0239 % The figure can be deleted now
0240 if isfield(handles,'figure1')
0241     delete(handles.figure1);
0242 end
0243 
0244 
0245 % --- Executes on selection change in modname.
0246 function modname_Callback(hObject, eventdata, handles)
0247 % hObject    handle to modname (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 modname contents as cell array
0252 %        contents{get(hObject,'Value')} returns selected item from modname
0253 warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid')
0254 list=get(handles.modname,'String');
0255 %handle particular bug with matlab(7.10.0499) and mac (OSX 10.6.4)
0256 if length(list)==1
0257     set(handles.modname,'Value',1)
0258 end
0259 
0260 if any(strfind(list{get(handles.modname,'Value')}, 'Enter'))
0261     modname=prt_text_input('Title','Enter modality name');
0262     if isnumeric(modname)
0263         return
0264     end
0265     if ~any(strcmpi(list,modname))
0266         nlist=[list;{modname}];
0267     else
0268         beep
0269         disp('This modality has already been set for the selected subject')
0270         set(handles.modname,'String',list);
0271         valall=strfind(list,'Enter');
0272         for i=1:length(valall)
0273             if ~isempty(valall{i})
0274                 val=i;
0275                 break
0276             end
0277         end
0278         set(handles.modname,'Value',val);
0279         return               
0280     end     
0281     set(handles.modname,'String',nlist);
0282     set(handles.modname,'Value',length(nlist));
0283 else
0284     modname=list{get(handles.modname,'Value')};
0285     if ~isempty(handles.subjmod)
0286         if any(strcmpi(handles.subjmod,modname))
0287             set(handles.modname,'String',list);
0288             valall=strfind(list,'Enter');
0289             if length(valall)==1 && isempty(valall{1}) %case of reviewing the modality
0290                 val=1;
0291                 set(handles.modname,'Value',val);
0292             else    %user tries to give a name he already used
0293                 beep
0294                 disp('This modality has already been set for the selected subject')            
0295                 for i=1:length(valall)
0296                     if ~isempty(valall{i})
0297                         val=i;
0298                         break
0299                     end
0300                 end
0301                 set(handles.modname,'Value',val);
0302                 return
0303             end
0304         end
0305     end         
0306 end
0307 
0308 %if a subject was previously entered, then propose to replicate its design
0309 %if the modality is the same
0310 if isstruct(handles.subj1)
0311     if any(strcmpi(modname, {handles.subj1(:).mod_name}))
0312         handles.indmods1=find(strcmpi(modname, {handles.subj1(:).mod_name}));
0313         list=get(handles.design_menu,'String');
0314         list=[list;{'Replicate design of subject 1'}];
0315         set(handles.design_menu,'String',list);
0316     end
0317 end
0318 handles.mod.name=modname;
0319 % Update handles structure
0320 guidata(hObject, handles);
0321 
0322 
0323 % --- Executes during object creation, after setting all properties.
0324 function modname_CreateFcn(hObject, eventdata, handles)
0325 % hObject    handle to modname (see GCBO)
0326 % eventdata  reserved - to be defined in a future version of MATLAB
0327 % handles    empty - handles not created until after all CreateFcns called
0328 
0329 % Hint: popupmenu controls usually have a white background on Windows.
0330 %       See ISPC and COMPUTER.
0331 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0332     set(hObject,'BackgroundColor','white');
0333 end
0334 
0335 % --- Executes on selection change in design_menu.
0336 function design_menu_Callback(hObject, eventdata, handles)
0337 % hObject    handle to design_menu (see GCBO)
0338 % eventdata  reserved - to be defined in a future version of MATLAB
0339 % handles    structure with handles and user data (see GUIDATA)
0340 
0341 % Hints: contents = get(hObject,'String') returns design_menu contents as cell array
0342 %        contents{get(hObject,'Value')} returns selected item from design_menu
0343 choice=get(handles.design_menu,'Value');
0344 %Mac and Matlab versions strange things with popup menus
0345 if choice==0
0346     choice=handles.desnmenu;
0347     set(handles.design_menu,'Value')
0348 end
0349 if choice==1
0350     desn=spm_select(1,'mat','Select SPM.mat file',[],[],'SPM.mat');
0351     try
0352         load(desn);
0353     catch
0354         beep
0355         disp('Can not load SPM.mat file');
0356         return
0357     end
0358     conds=struct();
0359     list={};
0360     for sspm=1:length(SPM.Sess)
0361         ncond = length(SPM.Sess(sspm).U);
0362         for c = 1:ncond
0363             if sspm==1  %set the conditions
0364                 conds(c).cond_name = SPM.Sess(sspm).U(c).name{1};
0365                 list=[list, {conds(c).cond_name}];
0366                 conds(c).onsets = SPM.Sess(sspm).U(c).ons;
0367                 conds(c).durations = SPM.Sess(sspm).U(c).dur;
0368                 indcond=ncond;
0369             else  %for other sessions, look if the conditions are the same
0370                 name_cond=SPM.Sess(sspm).U(c).name{1};
0371                 itoadd=find(strcmpi(name_cond,list));
0372                 if isempty(itoadd)  % if not, then add condition
0373                     indcond=indcond+1;
0374                     conds(indcond).cond_name = SPM.Sess(sspm).U(c).name{1};
0375                     conds(indcond).onsets = SPM.Sess(sspm).U(c).ons;
0376                     conds(indcond).durations = SPM.Sess(sspm).U(c).dur;
0377                     list=[list, {name_cond}];
0378                 else               %if yes, then add the onsets
0379                     conds(itoadd).onsets    = [conds(itoadd).onsets;SPM.Sess(sspm).U(c).ons];
0380                     conds(itoadd).durations = [conds(itoadd).durations;SPM.Sess(sspm).U(c).dur];
0381                 end
0382             end
0383         end
0384     end    
0385     if strcmpi(SPM.xBF.UNITS,'scans')
0386         units=0;
0387     else
0388         units=1;
0389     end
0390     def=prt_get_defaults('datad');
0391     if isfield(handles.PRT.group,'hrfoverlap')
0392         overl=handles.PRT.group.hrfoverlap;
0393     else
0394         overl=def.hrfw;
0395     end
0396     if isfield(handles.PRT.group,'hrfdelay')
0397         del=handles.PRT.group.hrfdelay;
0398     else
0399         del=def.hrfd;
0400     end
0401     %check that TR is the same for all sessions
0402     if length(unique([SPM.xX.K(:).RT])) ~=1
0403         beep
0404         disp('Differents TR found in SPM.mat, please separate sessions')
0405         return
0406     end
0407     desn=prt_check_design(conds,SPM.xX.K(1).RT,units,overl,del);
0408     desn.covar = [];
0409 elseif choice==2
0410     if isstruct(handles.mod.design)
0411         desn=prt_data_conditions('UserData',{handles.mod.design,handles.PRT});
0412     else
0413         desn=prt_data_conditions;
0414     end
0415 elseif choice ==3
0416     desn=[];
0417 elseif choice==4
0418     desn=handles.subj1(handles.indmods1).design;
0419 end
0420 handles.mod.design=desn;
0421 if isfield(desn,'covar') && ~isempty(desn.covar)
0422     set(handles.edit_covar,'String','Entered');
0423     set(handles.edit_covar,'Visible','on');
0424 end
0425 % Update handles structure
0426 guidata(hObject, handles);
0427 
0428 % --- Executes during object creation, after setting all properties.
0429 function design_menu_CreateFcn(hObject, eventdata, handles)
0430 % hObject    handle to design_menu (see GCBO)
0431 % eventdata  reserved - to be defined in a future version of MATLAB
0432 % handles    empty - handles not created until after all CreateFcns called
0433 
0434 % Hint: popupmenu controls usually have a white background on Windows.
0435 %       See ISPC and COMPUTER.
0436 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0437     set(hObject,'BackgroundColor','white');
0438 end
0439 
0440 % --- Executes on button press in getfiles.
0441 function getfiles_Callback(hObject, eventdata, handles)
0442 % hObject    handle to getfiles (see GCBO)
0443 % eventdata  reserved - to be defined in a future version of MATLAB
0444 % handles    structure with handles and user data (see GUIDATA)
0445 if ~isempty(handles.mod.scans)
0446     sel=cellstr(handles.mod.scans);
0447 else
0448     sel=[];
0449 end
0450 t=spm_select([1 Inf],'image','Select files for the modality',sel);
0451 handles.mod.scans=t;
0452 % Update handles structure
0453 guidata(hObject, handles);
0454 
0455 
0456 function edit_regt_Callback(hObject, eventdata, handles)
0457 % hObject    handle to edit_regt (see GCBO)
0458 % eventdata  reserved - to be defined in a future version of MATLAB
0459 % handles    structure with handles and user data (see GUIDATA)
0460 
0461 % Hints: get(hObject,'String') returns contents of edit_regt as text
0462 %        str2double(get(hObject,'String')) returns contents of edit_regt as a double
0463 
0464 %first option of loading: writing the values
0465 rt=get(handles.edit_regt,'String');
0466 if isempty(rt)
0467     return
0468 end
0469 if ~isnan(str2double(rt(1)))
0470     eval(['rte=[',rt,'];'])
0471 else
0472     try
0473         load(char(rt));
0474     catch
0475         beep
0476         disp('Could not load file or read the regression targets')
0477         disp('Please enter either a .mat file name or enter the values')
0478         return
0479     end
0480     if ~exist('rt_subj','var')
0481         beep
0482         sprintf('Regression targets file must contain ''rt_subj'' variable! ')
0483         disp('Please correct!')
0484         return
0485     else
0486         rte=rt_subj;
0487     end
0488 end
0489 handles.mod.rt_subj=rte;
0490 % Update handles structure
0491 guidata(hObject, handles);
0492 
0493 % --- Executes during object creation, after setting all properties.
0494 function edit_regt_CreateFcn(hObject, eventdata, handles)
0495 % hObject    handle to edit_regt (see GCBO)
0496 % eventdata  reserved - to be defined in a future version of MATLAB
0497 % handles    empty - handles not created until after all CreateFcns called
0498 
0499 % Hint: edit controls usually have a white background on Windows.
0500 %       See ISPC and COMPUTER.
0501 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0502     set(hObject,'BackgroundColor','white');
0503 end
0504 
0505 function edit_covar_Callback(hObject, eventdata, handles)
0506 % hObject    handle to edit_covar (see GCBO)
0507 % eventdata  reserved - to be defined in a future version of MATLAB
0508 % handles    structure with handles and user data (see GUIDATA)
0509 
0510 % Hints: get(hObject,'String') returns contents of edit_covar as text
0511 %        str2double(get(hObject,'String')) returns contents of edit_covar as a double
0512 %first option of loading: writing the values
0513 rt=get(handles.edit_covar,'String');
0514 if isempty(rt)
0515     return
0516 end
0517 if ~isnan(str2double(rt(1)))
0518     eval(['rte=[',rt,'];'])
0519 else
0520    try
0521         load(char(rt));
0522     catch
0523         beep
0524         disp('Could not load file or read the covariate values')
0525         disp('Please enter either a .mat file name or enter the values')
0526         return
0527     end
0528     if ~exist('R','var')
0529         beep
0530         sprintf('Covariates file must contain ''R'' variable! ')
0531         disp('Please correct!')
0532         return
0533     else
0534         rte=R;
0535     end
0536 end
0537 
0538 handles.mod.covar=rte;
0539 % Update handles structure
0540 guidata(hObject, handles);
0541 
0542 % --- Executes during object creation, after setting all properties.
0543 function edit_covar_CreateFcn(hObject, eventdata, handles)
0544 % hObject    handle to edit_covar (see GCBO)
0545 % eventdata  reserved - to be defined in a future version of MATLAB
0546 % handles    empty - handles not created until after all CreateFcns called
0547 
0548 % Hint: edit controls usually have a white background on Windows.
0549 %       See ISPC and COMPUTER.
0550 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0551     set(hObject,'BackgroundColor','white');
0552 end
0553 
0554 
0555 % --- Executes on button press in okbutton.
0556 function okbutton_Callback(hObject, eventdata, handles)
0557 % hObject    handle to okbutton (see GCBO)
0558 % eventdata  reserved - to be defined in a future version of MATLAB
0559 % handles    structure with handles and user data (see GUIDATA)
0560 
0561 %check that the files were selected
0562 if isempty(handles.mod.scans)
0563     beep
0564     disp('Please, select the files before returning')
0565     return
0566 end
0567 
0568 %check that the regression targets have the same number of elements as the
0569 %number of scans
0570 if ~isempty(handles.mod.rt_subj)
0571     szrt=length(handles.mod.rt_subj);
0572     if  size(handles.mod.scans,1)~=szrt
0573         beep
0574         disp('Number of regression targets must be the number of files selected! ')
0575         disp('Please correct!')
0576         return
0577     end
0578 end
0579 %check that the covariates have the same number of elements as the
0580 %number of scans
0581 if ~isempty(handles.mod.covar)
0582     szrt=size(handles.mod.covar);
0583     if  ~any(size(handles.mod.scans,1)==szrt)
0584         beep
0585         disp('Number of covariates must be the number of files selected! ')
0586         disp('Please correct!')
0587         return
0588     end
0589 end
0590         
0591 modprop=handles.mod;
0592 handles.output=modprop;
0593 % Update handles structure
0594 guidata(hObject, handles);
0595 uiresume(handles.figure1);
0596 
0597 
0598 % --- Executes on button press in cancelbutton.
0599 function cancelbutton_Callback(hObject, eventdata, handles)
0600 % hObject    handle to cancelbutton (see GCBO)
0601 % eventdata  reserved - to be defined in a future version of MATLAB
0602 % handles    structure with handles and user data (see GUIDATA)
0603 uiresume(handles.figure1);

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