3d9198f07ebf7ba05ad0012c22097f08b1567de0
Christoph Budziszewski project chooser: close window

Christoph Budziszewski authored 15 years ago

1) function spm_SVMCrossVal(varargin)
2) 
3) switch nargin
4) case 0
5) 	project_UI();
6) case 1
7) 	main_UI(varargin);
8) otherwise
9) error('spm_SVMCrossVal:main','wrong nargin');
10) 
11) end
12) end
13) 
14) function project_UI(args)
15)     frameWidth=450;
16)     frameHeight=200;
17)     model.frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
18)     movegui(model.frame,'west'); % get this thing visible on smaller displays.
19) 
20)     set(model.frame,'Name','SVM CrossVal Decode Performance 4 SPM, Projectchooser');
21)     set(model.frame,'NumberTitle','off');
22)     set(model.frame,'MenuBar','none');
23)     set(model.frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
24)     set(model.frame,'Resize','off');
25)     set(model.frame,'Units','normalize');
26) 
Christoph Budziszewski zwischenspeicherung

Christoph Budziszewski authored 15 years ago

27)     newProjectMenu = uimenu(model.frame,'Label','Define New Project');
28)     set(newProjectMenu,'Enable','off');
29) 
30) 
Christoph Budziszewski project chooser: close window

Christoph Budziszewski authored 15 years ago

31)     btnSelectButton = uicontrol(model.frame,'Tag','select','String','continue','Position',[2 0  frameWidth 40]);
32)     
33) %    model.projectSelector = 
34) 
35) 	model.val = 1;
36) 
37)     set(btnSelectButton,'Callback',{@cbChooseProject,model}); % set here, because of model.    
38)     set(model.frame,'Visible','on');
39) end
40) 
41) function cbChooseProject(src,evnts,args)
42) 
43) 	spm_SVMCrossVal(args);
44) 	display(args);
45) 	close(args.frame)
46) end
47) 
48) function main_UI(args)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

49) 
50) 
51) %  Initialize and hide the GUI as it is being constructed.
52)     frameWidth=450;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

53)     frameHeight=600;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

54)     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
55)     movegui(frame,'west'); % get this thing visible on smaller displays.
56)     
57)     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
58)     set(frame,'NumberTitle','off');
59)     set(frame,'MenuBar','none');
60)     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
61)     set(frame,'Resize','off');
62)     set(frame,'Units','normalize');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

63)     
64)     
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

65)     savemenu = uimenu(frame,'Label','Save/Load');
66)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

67)     model.subjectMap = SubjectRoiMapping;
68)     nElementRows = 24;
69)     optionLineHeight = 1.0/nElementRows;
70)     controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

71)     pSubject     = uipanel(frame,'Title','Subject',          'Position',[0 optionLineHeight*19 frameWidth optionLineHeight*5]);
72)     pPSTH        = uipanel(frame,'Title','PSTH Options',     'Position',[0 optionLineHeight*14 frameWidth optionLineHeight*5]); 
73)     pCLASS       = uipanel(frame,'Title','Class Definitions','Position',[0 optionLineHeight*9  frameWidth optionLineHeight*5]); 
74)     pVOXEL       = uipanel(frame,'Title','Voxel Selector',   'Position',[0 optionLineHeight*3  frameWidth optionLineHeight*6]); 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

75)     pSVM         = uipanel(frame,'Title','SVM Options',      'Position',[0 optionLineHeight*1  frameWidth optionLineHeight*2]); 
76)     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

77) 
78) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

79)     % Subject
80)     firstColumn  =  5.00;
81)     firstRow     =  1.00 * controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

82)     
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

83)     model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
84)                     'Min',1, 'Max',3,...
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

85)                     'String',getSubjectCellList(model.subjectMap),...
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

86)                     'Value',5,...  % default selected item
87)                     'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

88)     set(model.subjectSelector,'BackgroundColor','w');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

89)     
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

90)     model.txtSmoothed     = createTextField(pSubject,[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'1');
91)     model.txtMultisubject = createTextField(pSubject,[0.68*frameWidth firstRow*2  0.25*frameWidth controlElementHeight],'single');
92)     set(model.txtMultisubject,'enable','off');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

93) 
94)     % PSTH
95)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

96)     secondColumn = 0.33*frameWidth;
97)     thirdColumn  = 0.66*frameWidth;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

99)     
100)     firstRow    = 5.5*controlElementHeight;
101)     secondRow   = 4.5*controlElementHeight;
102)     thirdRow    = 3.5*controlElementHeight;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

103)     fourthRow   = 2.5*controlElementHeight;
104)     fifthRow    = 1.0*controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

105)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

106)     lStart      = createLabel(pPSTH, [secondColumn firstRow  0.33*frameWidth controlElementHeight],'Start [sec]');
107)     lEnd        = createLabel(pPSTH, [thirdColumn  firstRow  0.33*frameWidth controlElementHeight],'End [sec]');
108)     lPSTH       = createLabel(pPSTH, [firstColumn  secondRow 0.33*frameWidth controlElementHeight],'PSTH Range');
109)     lBaseline   = createLabel(pPSTH, [firstColumn  thirdRow  0.33*frameWidth controlElementHeight],'Baseline');
110)     lFrameShift = createLabel(pPSTH, [firstColumn  fourthRow 0.33*frameWidth controlElementHeight],'SVM Frame Shift');
111)     lFramsSize  = createLabel(pPSTH, [firstColumn  fifthRow  0.33*frameWidth controlElementHeight],'SVM Frame Size');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

112)     
113)     
Axel Lindner plot optimiert. normalisier...

Axel Lindner authored 15 years ago

114)     model.txtPSTHStart       = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],'-10.0');
115)     model.txtPSTHEnd         = createTextField(pPSTH,[thirdColumn  secondRow 0.25*frameWidth controlElementHeight],' 40.0');
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

116)     model.txtBaselineStart   = createTextField(pPSTH,[secondColumn thirdRow  0.25*frameWidth controlElementHeight],'-3.0');
117)     model.txtBaselineEnd     = createTextField(pPSTH,[thirdColumn  thirdRow  0.25*frameWidth controlElementHeight],'-1.0');
118)     model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],'-5.0');
Axel Lindner plot optimiert. normalisier...

Axel Lindner authored 15 years ago

119)     model.txtFrameShiftEnd   = createTextField(pPSTH,[thirdColumn  fourthRow 0.25*frameWidth controlElementHeight],' 35.0');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

120)     model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],' 0');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

121) 
122)                 
123)     %Classes
124)     nClassRows = 6;
125)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

126)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

127)     firstRow    = (nClassRows-0.5)*controlElementHeight;
128)     secondRow   = (nClassRows-4.5)*controlElementHeight;
129) 
130)     lClassDef = createLabel(pCLASS, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;');
Axel Lindner plot optimiert. normalisier...

Axel Lindner authored 15 years ago

131)     model.txtClassDef = createTextField(pCLASS,[firstColumn secondRow 0.98*frameWidth 4*controlElementHeight],sprintf('DRT,\t[9,10],\t-2 ;\nM2ST,\t[11,12],\t-1;'));
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

132)     set(model.txtClassDef,'HorizontalAlignment','left');
133)     set(model.txtClassDef,'Max',20);
134)     set(model.txtClassDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

136)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

137)     %Voxel
138)     nVoxelRows = 8;
139)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

140)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

141)     firstRow    = (nVoxelRows-0.5)*controlElementHeight;
142)     secondRow   = (nVoxelRows-7.5)*controlElementHeight;
143) 
144)     lVoxelDef = createLabel(pVOXEL, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<ROI Name>,<ROI Modifier>;');
145)     model.txtVoxelDef = createTextField(pVOXEL,[firstColumn secondRow 0.98*frameWidth 6*controlElementHeight],...
Axel Lindner plot optimiert. normalisier...

Axel Lindner authored 15 years ago

146)         sprintf('SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n'));
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

147)     set(model.txtVoxelDef,'HorizontalAlignment','left');
148)     set(model.txtVoxelDef,'Max',20);
149)     set(model.txtVoxelDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

151)                 
152)     % SVM
153)     firstColumn  =  5.00;
154)     firstRow     =  1.00 * controlElementHeight;
155) 
Axel Lindner plot optimiert. normalisier...

Axel Lindner authored 15 years ago

156)     model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-s 0 -t 0 -v 6 -c 1');
157)     %model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-s 0 -t 2 -v 6 -c 10 -g .1');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

159)     set(model.txtSVMopts,'HorizontalAlignment','left');
160) 
161)     set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

162)     uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
163)     uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
164) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

165)     set(frame,'Visible','on');
166) end
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

167) 
168) function mcb_save(src,event,model)
169) display('SAVE');
170) 
171) end
172) 
173) function mcb_load(src,event,model)
174) display('LOAD');
175) end
176) 
177) function sane = isSane(model)
178) % TODO
179) sane = 1;
180) end
181) 
182) function cbRunSVM(src,evnt,model)
183)     display('RUN');
184)     if isSane(model)
185)         classify(model)
186)     else
187)         error('spmtoolbox:SVMCrossVal:paramcheck','please verify all parameters');
188)     end
189) end
190) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

191)