291ee33de61fc5cd44c4afa4a86ca3bc077532b8
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');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

39)     
40)     model.txtSmoothed = createTextField(pSubject,[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'0');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

41) 
42)     % PSTH
43)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

44)     secondColumn = 0.33*frameWidth;
45)     thirdColumn  = 0.66*frameWidth;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

51)     fourthRow   = 2.5*controlElementHeight;
52)     fifthRow    = 1.0*controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

53)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

60)     
61)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

74)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

75)     firstRow    = (nClassRows-0.5)*controlElementHeight;
76)     secondRow   = (nClassRows-4.5)*controlElementHeight;
77) 
78)     lClassDef = createLabel(pCLASS, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;');
79)     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;'));
80)     set(model.txtClassDef,'HorizontalAlignment','left');
81)     set(model.txtClassDef,'Max',20);
82)     set(model.txtClassDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

84)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

85)     %Voxel
86)     nVoxelRows = 8;
87)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

88)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

94)         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

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

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

99)                 
100)     % SVM
101)     firstColumn  =  5.00;
102)     firstRow     =  1.00 * controlElementHeight;
103) 
104)     model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-t 0 -s 0 -v 6');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

105)     set(model.txtSVMopts,'Enable','on'); %inactive
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

106)     set(model.txtSVMopts,'HorizontalAlignment','left');
107) 
108)     set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

109)     set(frame,'Visible','on');
110) end
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

111)     
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

142) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

144) 
145)     % TODO test parameter values
146)     
147)     if isSane(model)
148)         set(0,'userdata',model);
149) %         set(src,'Enable','off');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

151)         classify(model)