function ui_main(varargin) % Initialize and hide the GUI as it is being constructed. frameWidth=450; frameHeight=450; 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'); % set(frame,'Color',get(0,'defaultUicontrolBackgroundColor')); set(frame,'Resize','on'); set(frame,'Units','normalized'); set(frame,'Color','y'); task = struct; DEFAULT = mcb_load_study(0,0,fullfile(getTbxPath,'study/stimolos.mat')); model1 = struct; model1.baseDir = DEFAULT.wd; model1.txtBaseDir = createLabel(frame,[0 0.97 1 0.03],model1.baseDir); set(model1.txtBaseDir,'BackgroundColor','w'); set(model1.txtBaseDir,'ForegroundColor','b'); 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'); model1.selectedSubject = DEFAULT.selectedSubject; model1 = createFirstStepPanel(model1,task.preprocessing,DEFAULT); % fill with data model1 = scanDirs(model1); % CLASSIFICATION model2 = struct; task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]); set(task.classification,'BackgroundColor','w'); model2 = createSecondStepPanel(model2,task.classification,DEFAULT); % PLOT model3 = struct; task.plot = uipanel(frame,'Title','Plot','Position',[0 0.0 1 TASK_HEIGHT]); set(task.plot,'BackgroundColor','w'); model3 = createVisualStepPanel(model3,task.plot,DEFAULT); % TASK task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]); % controlls togglebuttons % set(task.taskSwitch,'Title','TASK'); set(task.taskSwitch,'BackgroundColor','w'); set(task.taskSwitch,'Units','normalized'); btnSwitchPreprocessing = uicontrol(task.taskSwitch,'Style','pushbutton',... 'String','ImageProcessing',... 'Units','normalized','Position',[0.0 0.0 0.33 1]); set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task,model1}); set(btnSwitchPreprocessing,'Enable','on'); btnSwitchClassify = uicontrol(task.taskSwitch,'Style','pushbutton',... 'String','Decode',... 'Units','normalized','Position',[0.33 0.0 0.33 1]); set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task,model2}); set(btnSwitchClassify,'Enable','on'); btnSwitchPlot = uicontrol(task.taskSwitch,'Style','pushbutton',... 'String','Plot',... 'Units','normalized','Position',[0.66 0.0 0.33 1]); set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task,model3}); set(btnSwitchPlot,'Enable','on'); % menu savemenu = uimenu(frame,'Label','Save/Load','Enable','off'); uimenu(savemenu,'Label','Save Preprocessing Parameter','Callback',{@mcb_save,model1},'Enable','off'); uimenu(savemenu,'Label','Load Preprocessing Parameter','Callback',{@mcb_load,model1},'Enable','off'); 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'); studymenu = uimenu(frame,'Label','change Study','Enable','on'); fillStudyMenu(studymenu); cbSwitchTask(0,0,'PRE',task,model1); set(frame,'Visible','on'); end 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 function model = createFirstStepPanel(model,parent,DEFAULT) 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]; 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]; %Subjects 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',... 'Min',1, 'Max',3,... 'String',subjectList,... 'UserData',subjectList,... 'Units','normalized',... 'Position',[0 0 1 1]); set(model.subjectSelector, 'FontName', 'FixedWidth'); set(model.subjectSelector,'BackgroundColor','w'); %Classes pClasses = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,2))); set(pClasses,'Title','Class Definitions'); set(pClasses,'BackgroundColor','w'); lClassDef = uicontrol(pClasses,... 'Style','text',... 'String',sprintf('