c1c9c7d7f58359465f3e5b002f7b4ef8e0d5e747
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

1) function spm_SVMCrossVal
2) 
3) 
4) %  Initialize and hide the GUI as it is being constructed.
5)     frameWidth=450;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

6)     frameHeight=600;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

7)     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
8)     movegui(frame,'west'); % get this thing visible on smaller displays.
9)     
10)     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
11)     set(frame,'NumberTitle','off');
12)     set(frame,'MenuBar','none');
13)     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
14)     set(frame,'Resize','off');
15)     set(frame,'Units','normalize');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

16)     
17)     
18)     model.subjectMap = SubjectRoiMapping;
19)     nElementRows = 24;
20)     optionLineHeight = 1.0/nElementRows;
21)     controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
22)     pSubject     = uipanel(frame,'Title','Subject',          'Position',[0 optionLineHeight*22 frameWidth optionLineHeight*2]);
23)     pPSTH        = uipanel(frame,'Title','PSTH Options',     'Position',[0 optionLineHeight*17 frameWidth optionLineHeight*5]); 
24)     pCLASS       = uipanel(frame,'Title','Class Definitions','Position',[0 optionLineHeight*11 frameWidth optionLineHeight*6]); 
25)     pVOXEL       = uipanel(frame,'Title','Voxel Selector',   'Position',[0 optionLineHeight*3  frameWidth optionLineHeight*8]); 
26)     pSVM         = uipanel(frame,'Title','SVM Options',      'Position',[0 optionLineHeight*1  frameWidth optionLineHeight*2]); 
27)     btnRunButton = uicontrol(frame,'Tag','run','String','run decode-performance visualiser','Position',[2 optionLineHeight*0  frameWidth controlElementHeight*1.6]);
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

28) 
29) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

30)     % Subject
31)     firstColumn  =  5.00;
32)     firstRow     =  1.00 * controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

33)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

34)     model.subjectSelector = uicontrol(pSubject,'Style','popupmenu',...
35)                     'String',getSubjectCellList(model.subjectMap),...
36)                     'Value',5,...
37)                     'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight]);
38)     set(model.subjectSelector,'BackgroundColor','w');
39) 
40)     % PSTH
41)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

42)     secondColumn = 0.33*frameWidth;
43)     thirdColumn  = 0.66*frameWidth;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

44) %     fourthColumn = 0.84*frameWidth;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

45)     
46)     firstRow    = 5.5*controlElementHeight;
47)     secondRow   = 4.5*controlElementHeight;
48)     thirdRow    = 3.5*controlElementHeight;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

49)     fourthRow   = 2.5*controlElementHeight;
50)     fifthRow    = 1.0*controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

51)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

52)     lStart      = createLabel(pPSTH, [secondColumn firstRow  0.33*frameWidth controlElementHeight],'Start [sec]');
53)     lEnd        = createLabel(pPSTH, [thirdColumn  firstRow  0.33*frameWidth controlElementHeight],'End [sec]');
54)     lPSTH       = createLabel(pPSTH, [firstColumn  secondRow 0.33*frameWidth controlElementHeight],'PSTH Range');
55)     lBaseline   = createLabel(pPSTH, [firstColumn  thirdRow  0.33*frameWidth controlElementHeight],'Baseline');
56)     lFrameShift = createLabel(pPSTH, [firstColumn  fourthRow 0.33*frameWidth controlElementHeight],'SVM Frame Shift');
57)     lFramsSize  = createLabel(pPSTH, [firstColumn  fifthRow  0.33*frameWidth controlElementHeight],'SVM Frame Size');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

58)     
59)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

60)     model.txtBaselineStart   = createTextField(pPSTH,[secondColumn thirdRow  0.25*frameWidth controlElementHeight],'-22.0');
61)     model.txtBaselineEnd     = createTextField(pPSTH,[thirdColumn  thirdRow  0.25*frameWidth controlElementHeight],'-20.0');
62)     model.txtPSTHStart       = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],'-25.0');
63)     model.txtPSTHEnd         = createTextField(pPSTH,[thirdColumn  secondRow 0.25*frameWidth controlElementHeight],' 20.0');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

64)     model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],'-20.0');
65)     model.txtFrameShiftEnd   = createTextField(pPSTH,[thirdColumn  fourthRow 0.25*frameWidth controlElementHeight],' 15.0');
66)     model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],' 0');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

67) 
68)                 
69)     %Classes
70)     nClassRows = 6;
71)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

72)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

73)     firstRow    = (nClassRows-0.5)*controlElementHeight;
74)     secondRow   = (nClassRows-4.5)*controlElementHeight;
75) 
76)     lClassDef = createLabel(pCLASS, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;');
77)     model.txtClassDef = createTextField(pCLASS,[firstColumn secondRow 0.98*frameWidth 4*controlElementHeight],sprintf('<,\t[ 9,11,13],\t-2 ;\n>,\t[10,12,14],\t-1;'));
78)     set(model.txtClassDef,'HorizontalAlignment','left');
79)     set(model.txtClassDef,'Max',20);
80)     set(model.txtClassDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

81)     set(model.txtClassDef, 'FontName', 'FixedWidth')
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

82)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

83)     %Voxel
84)     nVoxelRows = 8;
85)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

86)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

87)     firstRow    = (nVoxelRows-0.5)*controlElementHeight;
88)     secondRow   = (nVoxelRows-7.5)*controlElementHeight;
89) 
90)     lVoxelDef = createLabel(pVOXEL, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<ROI Name>,<ROI Modifier>;');
91)     model.txtVoxelDef = createTextField(pVOXEL,[firstColumn secondRow 0.98*frameWidth 6*controlElementHeight],...
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

92)         sprintf('M1 l,\t[ 0, 0, 0];\nM1 l,\t[ 1, 0, 0];\nM1 l,\t[ 0, 1, 0];\nM1 l,\t[ 0, 0, 1];\n'));
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

93)     set(model.txtVoxelDef,'HorizontalAlignment','left');
94)     set(model.txtVoxelDef,'Max',20);
95)     set(model.txtVoxelDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

96)     set(model.txtVoxelDef, 'FontName', 'FixedWidth')
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

97)                 
98)     % SVM
99)     firstColumn  =  5.00;
100)     firstRow     =  1.00 * controlElementHeight;
101) 
102)     model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-t 0 -s 0 -v 6');
103)     set(model.txtSVMopts,'Enable','inactive');
104)     set(model.txtSVMopts,'HorizontalAlignment','left');
105) 
106)     set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

107)     set(frame,'Visible','on');
108) end
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

109)     
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

110) function label = createLabel(parent,  pos, labelText)
111)     label = uicontrol(parent,'Style','text','String',labelText,'Position',pos);
112)     set(label,'HorizontalAlignment','left');
113)     set(label,'Units','characters');
114) %     set(label,'BackgroundColor','r');
115) end
116) 
117) function btn = createButton(parent,pos,tag,labelText,cbArgs)
118)     btn = uicontrol(parent,'Position',pos,'String',labelText,'tag',tag);
119)      set(btn,'Callback',{@cbParseVariable,cbArgs});
120) %     set(btn,'BackgroundColor','b');
121) end
122) 
123) function txt = createTextField(parent,pos,model)
124)     txt = uicontrol(parent,'Style','edit','String',model,'Position',pos);
125)     set(txt,'BackgroundColor','w');
126) end
127) 
128) function drpField = createDropDown(parent,pos,selectionModel)
129)  drpField = uicontrol(parent,'Style','popupmenu','Position',pos);
130)   set(drpField,'String',selectionModel.Strings);
131)   set(drpField,'BackgroundColor','w');
132) end
133) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

134) function sane = isSane(model)
135)     sane = 1;
136) end
137) 
138) 
139) function cbRunSVM(src,evnt,model)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

140) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

141)     display('RUN');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

142) 
143)     % TODO test parameter values
144)     
145)     if isSane(model)
146)         set(0,'userdata',model);
147) %         set(src,'Enable','off');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

148)         assignin('base','guiParams',model);
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

149)         classify(model)