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,'Resize','on'); set(frame,'Units','normalized'); set(frame,'Color','y'); task = struct; model = struct; model.txtBaseDir = createLabel(frame,[0 0.97 0.8 0.03],''); set(model.txtBaseDir,'BackgroundColor','w'); set(model.txtBaseDir,'ForegroundColor','b'); model.txtStudyID = createLabel(frame,[0.8 0.97 0.2 0.03],''); set(model.txtStudyID,'BackgroundColor','w'); set(model.txtStudyID,'ForegroundColor','r'); 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'); model = createFirstStepPanel(model,task.preprocessing); % CLASSIFICATION task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]); set(task.classification,'BackgroundColor','w'); model = createSecondStepPanel(model,task.classification); % PLOT task.plot = uipanel(frame,'Title','Plot','Position',[0 0.0 1 TASK_HEIGHT]); set(task.plot,'BackgroundColor','w'); model = createVisualStepPanel(model,task.plot); % TASK SWITCH BUTTONS task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]); % controlls togglebuttons 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}); 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}); 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}); set(btnSwitchPlot,'Enable','on'); % MENUS savemenu = uimenu(frame,'Label','Save ...','Enable','on'); uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on'); studySelectMenu = uimenu(frame,'Label','Study ...','Enable','on'); uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model}); fillStudyMenu(studySelectMenu,model); updateMenu = uimenu(frame,'Label','update ...','Enable','on'); uimenu(updateMenu,'Label','rescan subject dir','Callback',{@mcb_update_subjects,model}); uimenu(updateMenu,'Label','rescan images','Callback',{@mcb_update_imagebase,model}); % newStudyMenu = uimenu(frame,'Label','new Study','Enable','on'); load_study([getPreviousStudyID '.mat'],model); cbSwitchTask(0,0,'PRE',task); set(frame,'Visible','on'); end %%%%% ui elements function model = createFirstStepPanel(model,parent) norm1Model = {'none','mean','minmax'}; roiGroupMethods = {'none','mean','max','median'}; 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.1 0.5 0.6]; % 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'); % subjectNames = listDirNames(getBaseDir(model)); model.subjectSelector = uicontrol(pSubject,'Style','listbox',... 'Min',1, 'Max',3,... '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('