private/ui_main.m
46b4e211
 function ui_main(varargin)
 
 %  Initialize and hide the GUI as it is being constructed.
     frameWidth=450;
2de68580
     frameHeight=450;
46b4e211
     
     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
     movegui(frame,'west'); % get this thing visible on smaller displays.
     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
     set(frame,'NumberTitle','off');
     set(frame,'MenuBar','none');
accd38ff
 %     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
4ac11e20
     set(frame,'Resize','on');
46b4e211
     set(frame,'Units','normalized');
f7802160
     set(frame,'Color','y');
46b4e211
 
2de68580
     task = struct;
     
4b81e19c
     DEFAULT = mcb_load_study(0,0,'study/stimolos.mat');
     
9760fd2f
     model1 = struct;
     model1.baseDir = DEFAULT.wd;
accd38ff
 
9760fd2f
     model1.txtBaseDir = createLabel(frame,[0 0.97 1 0.03],model1.baseDir);
     set(model1.txtBaseDir,'BackgroundColor','w');
     set(model1.txtBaseDir,'ForegroundColor','b');
accd38ff
     
2de68580
     TASK_HEIGHT = 1-0.13;
     
     % PREPROCESSING
     task.preprocessing   = uipanel(frame,'Title','Preprocessing','Position',[0 0.0 1 TASK_HEIGHT]);
     set(task.preprocessing,'BackgroundColor','w');
     set(task.preprocessing,'Units','normalized');
46b4e211
     
9760fd2f
     model1.selectedSubject = DEFAULT.selectedSubject;
     model1 = createFirstStepPanel(model1,task.preprocessing,DEFAULT);
259bc793
     
9760fd2f
     % fill with data
     model1 = scanDirs(model1);
46b4e211
     
2de68580
     % CLASSIFICATION
9760fd2f
     model2 = struct;
     
2de68580
     task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]);
     set(task.classification,'BackgroundColor','w');
9760fd2f
     model2 = createSecondStepPanel(model2,task.classification,DEFAULT);
2de68580
     
feeb21e9
     % PLOT
9760fd2f
     model3 = struct;
feeb21e9
     task.plot = uipanel(frame,'Title','Plot','Position',[0 0.0 1 TASK_HEIGHT]);
     set(task.plot,'BackgroundColor','w');
9760fd2f
     model3 = createVisualStepPanel(model3,task.plot,DEFAULT);
feeb21e9
     
2de68580
     % TASK
fb860baf
     task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]);
     % controlls togglebuttons
2de68580
 %         set(task.taskSwitch,'Title','TASK');
         set(task.taskSwitch,'BackgroundColor','w');
         set(task.taskSwitch,'Units','normalized');
     
fb860baf
         btnSwitchPreprocessing = uicontrol(task.taskSwitch,'Style','pushbutton',...
             'String','ImageProcessing',...
2de68580
             'Units','normalized','Position',[0.0 0.0 0.33 1]);
4801799b
         set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task,model1}); 
2de68580
         set(btnSwitchPreprocessing,'Enable','on');
 
fb860baf
         btnSwitchClassify = uicontrol(task.taskSwitch,'Style','pushbutton',...
             'String','Decode',...
2de68580
             'Units','normalized','Position',[0.33 0.0 0.33 1]);
4801799b
         set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task,model2}); 
2de68580
         set(btnSwitchClassify,'Enable','on');
 
fb860baf
         btnSwitchPlot = uicontrol(task.taskSwitch,'Style','pushbutton',...
             'String','Plot',...
2de68580
             'Units','normalized','Position',[0.66 0.0 0.33 1]);
4801799b
         set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task,model3}); 
2de68580
         set(btnSwitchPlot,'Enable','on');
 
     % menu
     
9b240b57
     savemenu = uimenu(frame,'Label','Save/Load','Enable','off');
d41a69b6
         uimenu(savemenu,'Label','Save Preprocessing Parameter','Callback',{@mcb_save,model1},'Enable','off');
         uimenu(savemenu,'Label','Load Preprocessing Parameter','Callback',{@mcb_load,model1},'Enable','off');
9760fd2f
         uimenu(savemenu,'Label','Save Decode Parameter','Callback',{@mcb_save,model2},'Enable','off');
         uimenu(savemenu,'Label','Load Decode Parameter','Callback',{@mcb_load,model2},'Enable','off');
         uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model1},'Enable','off');
         uimenu(savemenu,'Label','Load All','Callback',{@mcb_load,model1},'Enable','off');
         
4b81e19c
     studymenu = uimenu(frame,'Label','change Study','Enable','on');
         fillStudyMenu(studymenu);
85b70938
     
4801799b
     cbSwitchTask(0,0,'PRE',task,model1);
259bc793
 
2de68580
     set(frame,'Visible','on');
 
85b70938
 end
259bc793
 
4b81e19c
 function fillStudyMenu(studymenu)
     studydir = fullfile(getTbxPath,'study');
     files = dir(studydir);
     for fileidx = 1: numel(files)
         if ~files(fileidx).isdir
             uimenu(studymenu,'Label',files(fileidx).name,'Callback',{@mcb_load_study,fullfile(studydir,files(fileidx).name)});
         end
     end
 end
 
259bc793
 function model = createFirstStepPanel(model,parent,DEFAULT)
46b4e211
 
4ac11e20
     main_grid = cell(2,4);
     main_grid{1,1} = [0 0.7 0.4 0.3];
     main_grid{1,2} = [0 0.5 0.5 0.2];
     main_grid{1,3} = [0 0.1 0.5 0.4];
     main_grid{1,4} = [0 0.0 1.0 0.1];
46b4e211
     
4ac11e20
     main_grid{2,1} = [0.4 0.7 0.6 0.3];
     main_grid{2,2} = [0.5 0.5 0.5 0.2];
     main_grid{2,3} = [0.5 0.1 0.5 0.4];
46b4e211
     
     %Subjects
259bc793
     pSubject = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,1)));
     set(pSubject,'Title','Subjects');
     set(pSubject,'BackgroundColor','w');
     
     subjectList = {'DUMMY Subj1','DUMMY Subj2','DUMMY Subj3','DUMMY Subj4'};
     model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
46b4e211
                     'Min',1, 'Max',3,...
                     'String',subjectList,...
                     'UserData',subjectList,...
                     'Units','normalized',...
259bc793
                     'Position',[0 0 1 1]);
feeb21e9
     set(model.subjectSelector, 'FontName', 'FixedWidth');
4ac11e20
     set(model.subjectSelector,'BackgroundColor','w');
46b4e211
     
     %Classes
4ac11e20
     pClasses = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,2)));
46b4e211
     set(pClasses,'Title','Class Definitions');
     set(pClasses,'BackgroundColor','w');
         lClassDef = uicontrol(pClasses,...
             'Style','text',...
             'String',sprintf('<Label>,\t <[Event, Event, ..]>;'),...
             'Units','normalized',...
             'Position',[0 0.8 1 0.2]);
         set(lClassDef,'BackgroundColor','w');
         set(lClassDef,'HorizontalAlignment','left');
         
         model.txtClassDef = uicontrol(pClasses,'Style','edit',...
             'String',sprintf(DEFAULT.classdefstring),...
             'Units','normalized',...
             'Position',[0 0 1 0.8]);
         set(model.txtClassDef,'HorizontalAlignment','left');
         set(model.txtClassDef,'Max',20);
         set(model.txtClassDef,'Min',0);
         set(model.txtClassDef, 'FontName', 'FixedWidth');
4ac11e20
         set(model.txtClassDef, 'BackgroundColor', 'w');
46b4e211
 
 
     %Timeline
4ac11e20
     pPSTH        = uipanel(parent,'Title','PSTH Options','Position',cell2mat(main_grid(2,1)));
46b4e211
     set(pPSTH,'BackgroundColor','w');
         
         grid_h = 0.16;
         grid_w = 0.3;
         
259bc793
         tl_grid = cell([3 6]);
         tl_grid{2,1} = [0.0 0.83 grid_w grid_h];
         tl_grid{2,1} = [0.4 0.83 grid_w grid_h];
         tl_grid{3,1} = [0.7 0.83 grid_w grid_h];
46b4e211
         
259bc793
         tl_grid{1,2} = [0.0 0.66 grid_w grid_h];
         tl_grid{2,2} = [0.4 0.66 grid_w grid_h];
         tl_grid{3,2} = [0.7 0.66 grid_w grid_h];
46b4e211
 
259bc793
         tl_grid{1,3} = [0.0 0.5 grid_w grid_h];
         tl_grid{2,3} = [0.4 0.5 grid_w grid_h];
         tl_grid{3,3} = [0.7 0.5 grid_w grid_h];
46b4e211
         
259bc793
         tl_grid{1,4} = [0.0 0.33 grid_w grid_h];
         tl_grid{2,4} = [0.4 0.33 grid_w grid_h];
         tl_grid{3,4} = [0.7 0.33 grid_w grid_h];
46b4e211
 
f625db4f
         tl_grid{1,5} = [0.0 0.16 grid_w grid_h];
         tl_grid{2,5} = [0.4 0.16 grid_w grid_h];
         tl_grid{3,5} = [0.7 0.16 grid_w grid_h];
46b4e211
         
259bc793
         tl_grid{1,6} = [0.0 0.0 0.5 grid_h];
         tl_grid{2,6} = [0.5 0.0 grid_w grid_h];
         tl_grid{3,6} = [0.75 0.0 grid_w grid_h];
 
         lStart      = createLabel(pPSTH, cell2mat(tl_grid(2,1)) ,'Start [sec]');
         lEnd        = createLabel(pPSTH, cell2mat(tl_grid(3,1)) ,'End [sec]');
         lPSTH       = createLabel(pPSTH, cell2mat(tl_grid(1,2)),'PSTH Range');
         lBaseline   = createLabel(pPSTH, cell2mat(tl_grid(1,3)),'Baseline');
f625db4f
         lTRF        = createLabel(pPSTH, cell2mat(tl_grid(1,5)),'TR Factor');
feeb21e9
 
259bc793
         model.txtPSTHStart         = createTextField(pPSTH,cell2mat(tl_grid(2,2)),DEFAULT.pststart);
         model.txtPSTHEnd           = createTextField(pPSTH,cell2mat(tl_grid(3,2)),DEFAULT.pstend);
         model.txtBaselineStart     = createTextField(pPSTH,cell2mat(tl_grid(2,3)),DEFAULT.baselinestart);
         model.txtBaselineEnd       = createTextField(pPSTH,cell2mat(tl_grid(3,3)),DEFAULT.baselineend);
f625db4f
         model.txtTrFactor          = createTextField(pPSTH,cell2mat(tl_grid(2,5)),DEFAULT.trfactor);
         model.labelTR              = createTextField(pPSTH, cell2mat(tl_grid(3,5)),'');
46b4e211
         
         % images
4ac11e20
         pImage = uipanel(parent,'Title','Image Options','Position',cell2mat(main_grid(2,2)));
46b4e211
         set(pImage,'BackgroundColor','w');
 
         createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base');
         
7a4d3666
         imageRegExList = {'DUMMY f*.IMG','DUMMY swrf*.IMG','DUMMY wrf*.IMG'};
46b4e211
         model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',...
         'Units','normalized',...
         'Position',[0.0 0.0 1 0.5],...
         'String',imageRegExList,...
         'UserData',imageRegExList,...
55ebec12
         'Value',1);
46b4e211
         set(model.imageTypeSelection,'BackgroundColor','w');
         
         
         % coordinate Table
4ac11e20
         pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
46b4e211
         set(pVoxel,'BackgroundColor','w');
aa21d53b
         lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];');
46b4e211
         model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],...
             sprintf(DEFAULT.voxelstring));
         set(model.txtVoxelDef,'HorizontalAlignment','left');
         set(model.txtVoxelDef,'Max',20);
         set(model.txtVoxelDef,'Min',0);
         set(model.txtVoxelDef, 'FontName', 'FixedWidth');
         
4ac11e20
         %normalizations
         pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3)));
         set(pNorm,'BackgroundColor','w');
         
e0049736
         createLabel(pNorm,[0 0.75 1 0.25],'psth norm4SVM');
         norm1Model = {'none','mean','minmax'};
4ac11e20
         model.selNormPST = uicontrol(pNorm,'Style','popupmenu',...
             'Units','normalized',...
             'Position',[0.0 0.5 1 0.25],...
             'String',norm1Model,...
             'UserData',norm1Model,...
e0049736
             'Value',2);
4ac11e20
          set(model.selNormPST,'BackgroundColor','w');   
         
fb860baf
 %         createLabel(pNorm,[0 0.25 1 0.25],'Col Bias removal');
 %         norm2Model = {'on','off'};
         model.chkColBias = uicontrol(pNorm,'Style','checkbox',...
4ac11e20
             'Units','normalized',...
fb860baf
             'Position',[0.0 0.1 1 0.25],...
             'String','column Bias removal',...
             'Enable','on',...
4ac11e20
             'Value',1);
fb860baf
          set(model.chkColBias,'BackgroundColor','w');   
4ac11e20
         
         %buttons
         pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
         set(pButtons,'BackgroundColor','w');
46b4e211
         
4ac11e20
         btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
             'Units','normalized','Position',[0 0 0.33 1]);
accd38ff
         set(btnRunButton1,'Callback',{@cbRunPreprocessing,model,'COORD'}); % set here, because of model.    
         set(btnRunButton1,'Enable','on');
46b4e211
         
93eb4bd9
         btnRunButton2 = uicontrol(pButtons,'String',sprintf('load ROI for FBS'),...
4ac11e20
             'Units','normalized','Position',[0.33 0 0.33 1]);
accd38ff
         set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'}); % set here, because of model.  
7614718d
         set(btnRunButton2,'Enable','on');
46b4e211
         
4ac11e20
         btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
             'Units','normalized','Position',[0.66 0 0.33 1]);
85b70938
         set(btnRunButton3,'Callback',{@cbRunPreprocessing,model,'ROI'}); % set here, because of model.    
         set(btnRunButton3,'Enable','on');
 end
 
2de68580
 function model = createSecondStepPanel(model,parent,DEFAULT)
 basecolor = 'w';
 
feeb21e9
 pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]);
     set(pTime,'Title','Decode Timeframe Options');
2de68580
     set(pTime,'BackgroundColor',basecolor);
feeb21e9
     grid_h = 0.3;
     grid_w = 0.3;
     time_grid = cell([3 3]);
     time_grid{1,1} = [0.0 0.63 grid_w grid_h];
     time_grid{2,1} = [0.4 0.63 grid_w grid_h];
     time_grid{3,1} = [0.7 0.63 grid_w grid_h];
     time_grid{1,2} = [0.0 0.33 grid_w grid_h];
     time_grid{2,2} = [0.4 0.33 grid_w grid_h];
     time_grid{3,2} = [0.7 0.33 grid_w grid_h];
     time_grid{1,3} = [0.0 0.03 grid_w grid_h];
     time_grid{2,3} = [0.4 0.03 grid_w grid_h];
     time_grid{3,3} = [0.7 0.03 grid_w grid_h];
 
     lStart      = createLabel(pTime, cell2mat(time_grid(2,1)) ,'Start [sec]');
     lEnd        = createLabel(pTime, cell2mat(time_grid(3,1)) ,'End [sec]');
     lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Frame Shift');
     lFramsSize  = createLabel(pTime, cell2mat(time_grid(1,3)),'Frame Size');
     
     model.txtFrameShiftStart   = createTextField(pTime,cell2mat(time_grid(2,2)),DEFAULT.frameshiftstart);
     model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),DEFAULT.frameshiftend);
     model.txtFrameShiftDur     = createTextField(pTime,cell2mat(time_grid(2,3)),DEFAULT.frameshiftdur);
 
c73e97a6
     
feeb21e9
 pSVM = uipanel(parent,'Units','normalized','Position',[0 0.4 0.5 0.4]);
c73e97a6
     set(pSVM,'Title','SVM Classification');
     set(pSVM,'BackgroundColor',basecolor);
 
7984c76d
     model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],DEFAULT.svmoptstring);
c73e97a6
     set(model.txtSVMopts,'HorizontalAlignment','left');
     
7984c76d
     model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],DEFAULT.svmnfold);
c73e97a6
     createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
     
22335072
     model.chkSVMrnd = uicontrol(pSVM,'Style','checkbox','Units','normalized','Position',[0.1 0.50 0.9 0.16]);
7984c76d
     set(model.chkSVMrnd,'String','Randomize Datapoints');
     set(model.chkSVMrnd,'BackgroundColor','w');
     set(model.chkSVMrnd,'Value',DEFAULT.svmrnd);
     
22335072
     btnRunSVM = uicontrol(pSVM,'String','run batchmode SVM Crossvalidation',...
         'Units','normalized',...
         'Position',[0 0.25 1 0.25]);
     set(btnRunSVM,'Enable','on');
     
     btnRunXSVM = uicontrol(pSVM,'String','run SVM X-Subject validation',...
         'Units','normalized',...
         'Position',[0 0.0 1 0.25]);
     set(btnRunXSVM,'Enable','on');
7984c76d
     
feeb21e9
 pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]);
c73e97a6
     set(pSOM,'Title','SOM Classification');
     set(pSOM,'BackgroundColor',basecolor);
 
17910a1f
     createLabel(pSOM,[0 0.75 0.3 0.20],'Size:');
     model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],DEFAULT.somM);
     somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.20],'x');
     set(somsizemal,'HorizontalAlignment','center');
     model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],DEFAULT.somN);
  
     latticeModel = {'rect','hexa'};
     model.selSomLattice = uicontrol(pSOM,'Style','popupmenu',...
         'Units','normalized',...
         'Position',[0.0 0.5 0.3 0.20],...
         'String',latticeModel,...
         'UserData',latticeModel,...
         'Value',1);
     set(model.selSomLattice,'BackgroundColor','w');
c73e97a6
 
17910a1f
     model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],DEFAULT.svmnfold);
 %     set(model.txtSOMnfold,'Enable','off');
     createLabel(pSOM,[0.75 0.5 0.25 0.20 ],'-Fold CrossVal');
        
c73e97a6
 
     btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',...
         'Units','normalized',...
22335072
         'Position',[0.0 0.25 1 0.25]);
916fe4f9
     set(btnRunSOM,'Enable','on');
c73e97a6
 
     btnRunXSOM = uicontrol(pSOM,'String','run SOM X-Subject validation',...
         'Units','normalized',...
         'Position',[0.0 0.0 1 0.25]);
b0a2dbf1
     set(btnRunXSOM,'Enable','on');
aa21d53b
     
17910a1f
 pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3]);
aa21d53b
     set(pSearchlight,'Title','Spatiotemporal FB classification');
     set(pSearchlight,'BackgroundColor',basecolor);
     
     lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius');
     model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],DEFAULT.searchlightradius);
     
17910a1f
     lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')');
07e45407
     model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],DEFAULT.searchlightTimeline);
 
aa21d53b
     btnRunFBS = uicontrol(pSearchlight,'String','run Spatiotemporal FB classification',...
         'Units','normalized',...
         'Position',[0.0 0.0 1 0.3]);
7614718d
     set(btnRunFBS,'Enable','on');
aa21d53b
     
22335072
 
 % button callbacks set here, because of model.
     set(btnRunSVM, 'Callback',{@cbRunDecode,model,'SVM'}); 
     set(btnRunXSVM,'Callback',{@cbRunDecode,model,'XSVM'}); 
     set(btnRunSOM, 'Callback',{@cbRunDecode,model,'SOM'});
aa21d53b
     set(btnRunXSOM,'Callback',{@cbRunDecode,model,'XSOM'});
18bc821f
     set(btnRunFBS, 'Callback',{@cbRunDecode,model,'FBS'});
c73e97a6
 end
 
feeb21e9
 function model = createVisualStepPanel(model,parent,DEFAULT)
18bc821f
 
     grid_h = 0.25;
     grid_w = 0.5;
     plot_grid = cell([3 3]);
     plot_grid{1,1} = [0.0 0.63 grid_w grid_h];
     plot_grid{1,2} = [0.0 0.33 grid_w grid_h];
     plot_grid{1,3} = [0.0 0.03 grid_w grid_h];
17910a1f
     plot_grid{2,1} = [0.25 0.63 grid_w grid_h];
     plot_grid{2,2} = [0.25 0.33 grid_w grid_h];
     plot_grid{2,3} = [0.25 0.03 grid_w grid_h];
18bc821f
 
27ebd4d9
     pButtonPane = uipanel(parent,'Units','normalized','Position',[0 0.5 1 0.5]);
feeb21e9
 %     set(pButtonPane,'Title','Plot');
     set(pButtonPane,'BackgroundColor','w');
17910a1f
     
     btnPlot03 = uicontrol(pButtonPane,'String','plot PSTH',...
         'Units','normalized',...
         'Position',cell2mat(plot_grid(2,1)));
     set(btnPlot03,'Callback',{@cbPlot,model,'psth'}); 
     set(btnPlot03,'Enable','on');
   
27ebd4d9
     btnPlot01 = uicontrol(pButtonPane,'String','plot performance and SE',...
feeb21e9
         'Units','normalized',...
17910a1f
         'Position',cell2mat(plot_grid(2,2)));
27ebd4d9
     set(btnPlot01,'Callback',{@cbPlot,model,'simple'});
feeb21e9
     set(btnPlot01,'Enable','on');
27ebd4d9
     
     btnPlot02 = uicontrol(pButtonPane,'String','plot subject performance and mean with SE',...
         'Units','normalized',...
18bc821f
         'Position',cell2mat(plot_grid(2,3)));
27ebd4d9
     set(btnPlot02,'Callback',{@cbPlot,model,'x-subject-val'});
     set(btnPlot02,'Enable','on');
 
     
feeb21e9
 end
 
c73e97a6
 
4801799b
 function cbSwitchTask(src,evnt,task,taskpanel,model)
2de68580
 set(taskpanel.preprocessing,'Visible','off');
 set(taskpanel.classification,'Visible','off');
feeb21e9
 set(taskpanel.plot,'Visible','off');
2de68580
 
 switch task
     case 'PRE'
         set(taskpanel.preprocessing,'Visible','on');
4801799b
 
 
2de68580
     case 'CLASSIFY'
         set(taskpanel.classification,'Visible','on');
4801799b
 
2de68580
     case 'PLOT'
feeb21e9
         set(taskpanel.plot,'Visible','on');
4801799b
         
2de68580
 end
4801799b
 
 assignin('base','model',model);
 
2de68580
 end
 
c73e97a6
 
85b70938
 function cbRunPreprocessing(src,evnt,model,task)
aaaeb6c5
 main(model,'pre',task);
 end
 
 function cbRunDecode(src,evnt,model,task)
 main(model,'decode',task);
85b70938
 end
 
feeb21e9
 function cbPlot(src,evnt,model,type)
 main(model,'plot',type);
 end
 
4b81e19c
 function default = mcb_load_study(src,evnt,studyfile)
     default = load(studyfile);
 end
feeb21e9
 
c73e97a6
 function model = mcb_cd(src,evnt,model)
 disp('CD');
 directory_name = uigetdir(model.baseDir,'Select Study Base Directory ...');
 model.baseDir = directory_name;
 model = scanDirs(model);
 end
 
 function mcb_save(src,evnt,model)
 disp('SAVE');
 baseDir  = model.baseDir;
 timeLine = getTimeLineParams(model);
 classDefString = getClassDefString(model);
 coordDefString = getCoordDefString(model);
 
 [file path] = uiputfile('*.mat','Save current Params ...',model.baseDir);
 save( fullfile(path,file),'baseDir','timeLine','classDefString','coordDefString') ;
 end
 
 function model = mcb_load(src,evnt,model)
 disp('LOAD');
 [file path] = uigetfile('*.mat','Load Params ...',model.baseDir);
 l = load(fullfile(path,file));
 % assignin('base','l',l);
 model = setTimeLineParams(model,l.timeLine);
 model = setClassDefString(model,l.classDefString);
 model = setCoordDefString(model,l.coordDefString);
 model.baseDir = l.baseDir;
 model = scanDirs(model);
 
 end
 
46b4e211
 function label = createLabel(parent,  pos, labelText)
     label = uicontrol(parent,'Style','text','Units','normalized','String',labelText,'Position',pos);
     set(label,'HorizontalAlignment','left');
     set(label,'BackgroundColor','w');
 end
 
 function txt = createTextField(parent,pos,model)
4ac11e20
 %     textfieldcolor = [0.9 0.9 0.0];
     textfieldcolor = 'w';
46b4e211
     txt = uicontrol(parent,'Style','edit','Units','normalized','String',model,'Position',pos);
     set(txt,'BackgroundColor',textfieldcolor);
 end