git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
46b4e21
Branches
Tags
master
SVMCrossVal.git
private
ui_main.m
new GUI. Only Layout. Backend missing.
Christoph Budziszewski
commited
46b4e21
at 2009-02-11 16:49:37
ui_main.m
Blame
History
Raw
function ui_main(varargin) DEFAULT.selectedSubject = 1; DEFAULT.smoothed = 1; DEFAULT.multisubject = 'single'; DEFAULT.pststart = -15; DEFAULT.pstend = 40; DEFAULT.baselinestart = -3; DEFAULT.baselineend = -1; DEFAULT.frameshiftstart = -5; DEFAULT.frameshiftend = 35; DEFAULT.frameshiftdur = 0; DEFAULT.classdefstring = 'left,\t[9,11,13]\nright,\t[10,12,14]'; DEFAULT.voxelstring = 'SPL l + [ 0, 0, 0] \nSPL r + [ 0, 0, 0]\n'; DEFAULT.svmoptstring = '-s 0 -t 0 -v 6 -c 1'; DEFAULT.searchlightradius = 3; % Initialize and hide the GUI as it is being constructed. frameWidth=450; frameHeight=600; 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','off'); set(frame,'Units','normalized'); pFirstStep = uipanel(frame,'Title','Preprocessing','Position',[0 0.4 1 0.6]); set(pFirstStep,'BackgroundColor','w'); set(pFirstStep,'Units','normalized'); model = createFirstStepPanel(pFirstStep,DEFAULT); assignin('base','model',model); %Classification Step secondStepBaseColor = [0.7 0.7 0.0 ]; pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.4]); set(pSecondStep,'BackgroundColor',secondStepBaseColor); model2 = createSecondStepPanel(pSecondStep,DEFAULT,secondStepBaseColor); assignin('base','model2',model2); set(frame,'Visible','on'); end function model = createSecondStepPanel(parent,DEFAULT,basecolor) pSVM = uipanel(parent,'Units','normalized','Position',[0 0 0.5 0.9]); set(pSVM,'Title','SVM Classification'); set(pSVM,'BackgroundColor',basecolor); model.txtSVMopts = createTextField(pSVM,[0 0.9 1 0.1],DEFAULT.svmoptstring); set(model.txtSVMopts,'Enable','on'); %inactive set(model.txtSVMopts,'HorizontalAlignment','left'); pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0 0.5 0.9]); set(pSOM,'Title','SVM Classification'); set(pSOM,'BackgroundColor',basecolor); end function model = createFirstStepPanel(parent,DEFAULT) x1 = 0; x2 = 0.4; x3 = 1; y1 = 1; y2 = 0.6; y3 = 0.4; y4 = 0.2; y5 = 0; %Subjects subjectList = {'Subj1','Subj2','Subj3','Subj4'}; model.subjectSelector = uicontrol(parent,'Style','listbox',... 'Min',1, 'Max',3,... 'String',subjectList,... 'UserData',subjectList,... 'Units','normalized',... 'Position',[x1 y2 x2-x1 y1-y2]); set(model.subjectSelector,'BackgroundColor','y'); %Classes pClasses = uipanel(parent,'Units','normalized','Position',[x1 y3 0.5 0.2]); 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'); set(model.txtClassDef, 'BackgroundColor', 'y'); %Timeline pPSTH = uipanel(parent,'Title','PSTH Options','Position',[0.5 y2 0.5 y1-y2]); set(pPSTH,'BackgroundColor','w'); grid_h = 0.16; grid_w = 0.3; grid = cell([3 6]); grid{2,1} = [0.0 0.83 grid_w grid_h]; grid{2,1} = [0.4 0.83 grid_w grid_h]; grid{3,1} = [0.7 0.83 grid_w grid_h]; grid{1,2} = [0.0 0.66 grid_w grid_h]; grid{2,2} = [0.4 0.66 grid_w grid_h]; grid{3,2} = [0.7 0.66 grid_w grid_h]; grid{1,3} = [0.0 0.5 grid_w grid_h]; grid{2,3} = [0.4 0.5 grid_w grid_h]; grid{3,3} = [0.7 0.5 grid_w grid_h]; grid{1,4} = [0.0 0.33 grid_w grid_h]; grid{2,4} = [0.4 0.33 grid_w grid_h]; grid{3,4} = [0.7 0.33 grid_w grid_h]; grid{1,5} = [0.0 0.16 0.5 grid_h]; grid{2,5} = [0.5 0.16 grid_w grid_h]; grid{3,5} = [0.75 0.16 grid_w grid_h]; grid{1,6} = [0.0 0.0 0.5 grid_h]; grid{2,6} = [0.5 0.0 grid_w grid_h]; grid{3,6} = [0.75 0.0 grid_w grid_h]; lStart = createLabel(pPSTH, cell2mat(grid(2,1)) ,'Start [sec]'); lEnd = createLabel(pPSTH, cell2mat(grid(3,1)) ,'End [sec]'); lPSTH = createLabel(pPSTH, cell2mat(grid(1,2)),'PSTH Range'); lBaseline = createLabel(pPSTH, cell2mat(grid(1,3)),'Baseline'); lFrameShift = createLabel(pPSTH, cell2mat(grid(1,4)),'Frame Shift'); lFramsSize = createLabel(pPSTH, cell2mat(grid(1,5)),'Frame Size'); lSearchligh = createLabel(pPSTH, cell2mat(grid(1,6)),'Searchlight Radius'); model.txtPSTHStart = createTextField(pPSTH,cell2mat(grid(2,2)),DEFAULT.pststart); model.txtPSTHEnd = createTextField(pPSTH,cell2mat(grid(3,2)),DEFAULT.pstend); model.txtBaselineStart = createTextField(pPSTH,cell2mat(grid(2,3)),DEFAULT.baselinestart); model.txtBaselineEnd = createTextField(pPSTH,cell2mat(grid(3,3)),DEFAULT.baselineend); model.txtFrameShiftStart = createTextField(pPSTH,cell2mat(grid(2,4)),DEFAULT.frameshiftstart); model.txtFrameShiftEnd = createTextField(pPSTH,cell2mat(grid(3,4)),DEFAULT.frameshiftend); model.txtFrameShiftDur = createTextField(pPSTH,cell2mat(grid(2,5)),DEFAULT.frameshiftdur); model.txtSearchlightRadius = createTextField(pPSTH,cell2mat(grid(2,6)),DEFAULT.searchlightradius); % images pImage = uipanel(parent,'Title','Image Options','Position',[0.5 0.4 0.5 0.2]); set(pImage,'BackgroundColor','w'); createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base'); imageRegExList = {'swrf*.IMG','wrf*.IMG'}; model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',... 'Units','normalized',... 'Position',[0.0 0.0 1 0.5],... 'String',imageRegExList,... 'UserData',imageRegExList,... 'Value',1); set(model.imageTypeSelection,'BackgroundColor','w'); % coordinate Table pVoxel = uipanel(parent,'Title','ROI','Position',[0.0 0.0 0.5 0.4]); set(pVoxel,'BackgroundColor','w'); lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name>+[offset];'); 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'); pButtons = uipanel(parent,'Position',[0.5 0.0 0.5 0.4]); set(pButtons,'BackgroundColor','b'); btnRunButton1 = uicontrol(pButtons,'String','run coord-Table','Units','normalized','Position',[0 0.75 1 0.2]); set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model. btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight','Units','normalized','Position',[0 0.5 1 0.2]); set(btnRunButton2,'Callback',{@cbRunFBS,model}); % set here, because of model. btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing','Units','normalized','Position',[0 0.25 1 0.2]); set(btnRunButton2,'Callback',{@cbRunROIImage,model}); % set here, because of model. set(btnRunButton3,'Enable','off'); end function cbRunCoordTable(src,evnt,model) display('RUN Coord-Table Mode'); main('COORD-LOOKUP-TABLE',model); end function cbRunROIImage(src,evnt,model) display('RUN Image-Mask Mode'); main('ROI-IMAGE-MASK', model); end function cbRunFBS(src,evnt,model) display('RUN Full Brain Searchlight Mode'); display('not implemented.'); end 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) textfieldcolor = [0.9 0.9 0.0]; txt = uicontrol(parent,'Style','edit','Units','normalized','String',model,'Position',pos); set(txt,'BackgroundColor',textfieldcolor); end