Browse code

gui finished. callbacks still missing

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@129 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on 12/02/2009 17:41:08
Showing 1 changed files
... ...
@@ -12,7 +12,8 @@ DEFAULT.frameshiftend   = 35;
12 12
 DEFAULT.frameshiftdur   = 0;
13 13
 DEFAULT.classdefstring  = 'left,\t[9,11,13]\nright,\t[10,12,14]';
14 14
 DEFAULT.voxelstring     = 'SPL l + [ 0, 0, 0] \nSPL r + [ 0, 0, 0]\n';
15
-DEFAULT.svmoptstring    = '-s 0 -t 0 -v 6 -c 1';
15
+DEFAULT.svmoptstring    = '-s 0 -t 0 -c 1';
16
+DEFAULT.svmnfold        = '6';
16 17
 DEFAULT.searchlightradius = 3;
17 18
 
18 19
 %  Initialize and hide the GUI as it is being constructed.
... ...
@@ -25,10 +26,10 @@ DEFAULT.searchlightradius = 3;
25 26
     set(frame,'NumberTitle','off');
26 27
     set(frame,'MenuBar','none');
27 28
     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
28
-    set(frame,'Resize','off');
29
+    set(frame,'Resize','on');
29 30
     set(frame,'Units','normalized');
30 31
 
31
-    pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.4 1 0.6]);
32
+    pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.3 1 0.7]);
32 33
     set(pFirstStep,'BackgroundColor','w');
33 34
     set(pFirstStep,'Units','normalized');
34 35
     
... ...
@@ -37,43 +38,81 @@ DEFAULT.searchlightradius = 3;
37 38
     assignin('base','model',model);
38 39
     
39 40
     %Classification Step
40
-    secondStepBaseColor = [0.7 0.7 0.0 ];
41
-    pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.4]);
41
+    secondStepBaseColor = 'w';
42
+    pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.3]);
42 43
     set(pSecondStep,'BackgroundColor',secondStepBaseColor);
43 44
 
44 45
     
45
-    model2 = createSecondStepPanel(pSecondStep,DEFAULT,secondStepBaseColor);
46
+    model2 = createSecondStepPanel(pSecondStep,DEFAULT,model,secondStepBaseColor);
46 47
     assignin('base','model2',model2);
47 48
 
48 49
     set(frame,'Visible','on');
49 50
 end
50 51
 
51
-function model = createSecondStepPanel(parent,DEFAULT,basecolor)
52
-pSVM = uipanel(parent,'Units','normalized','Position',[0 0 0.5 0.9]);
52
+function model = createSecondStepPanel(parent,DEFAULT,model1,basecolor)
53
+    
54
+pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.5 1]);
53 55
     set(pSVM,'Title','SVM Classification');
54 56
     set(pSVM,'BackgroundColor',basecolor);
55 57
 
56
-    model.txtSVMopts = createTextField(pSVM,[0 0.9 1 0.1],DEFAULT.svmoptstring);
57
-    set(model.txtSVMopts,'Enable','on'); %inactive
58
+    model.txtSVMopts = createTextField(pSVM,[0 0.75 1 0.25],DEFAULT.svmoptstring);
58 59
     set(model.txtSVMopts,'HorizontalAlignment','left');
60
+    
61
+    model.txtSVMnfold = createTextField(pSVM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold);
62
+    createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
63
+
59 64
 
60 65
     
61
-pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0 0.5 0.9]);
62
-    set(pSOM,'Title','SVM Classification');
66
+pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 1]);
67
+    set(pSOM,'Title','SOM Classification');
63 68
     set(pSOM,'BackgroundColor',basecolor);
69
+
70
+    model.txtSOMopts = createTextField(pSOM,[0 0.75 1 0.25],'4x3 rect');
71
+    set(model.txtSOMopts,'HorizontalAlignment','left');
72
+        set(model.txtSOMopts,'Enable','off');
73
+
74
+    model.txtSOMnfold = createTextField(pSOM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold);
75
+        set(model.txtSOMnfold,'Enable','off');
76
+    createLabel(pSOM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
77
+
78
+
79
+    
80
+    
81
+    btnRunSVM = uicontrol(pSVM,'String','run SVM Crossvalidation',...
82
+        'Units','normalized',...
83
+        'Position',[0 0.25 1 0.25]);
84
+    set(btnRunSVM,'Callback',{@cbRunSVM,model1,model}); % set here, because of model.
85
+    
86
+    btnRunXSVM = uicontrol(pSVM,'String','run SVM X-Subject validation',...
87
+        'Units','normalized',...
88
+        'Position',[0 0.0 1 0.25]);
89
+    set(btnRunXSVM,'Callback',{@cbRunXSVM,model1,model}); % set here, because of model.
90
+    set(btnRunXSVM,'Enable','off');
91
+    
92
+    btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',...
93
+        'Units','normalized',...
94
+    'Position',[0.0 0.25 1 0.25]);
95
+    set(btnRunSOM,'Callback',{@cbRunSOM,model1,model}); % set here, because of model.
96
+    set(btnRunSOM,'Enable','off');
97
+
98
+    btnRunXSOM = uicontrol(pSOM,'String','run SOM X-Subject validation',...
99
+        'Units','normalized',...
100
+        'Position',[0.0 0.0 1 0.25]);
101
+    set(btnRunXSOM,'Callback',{@cbRunXSOM,model1,model}); % set here, because of model.
102
+    set(btnRunXSOM,'Enable','off');
64 103
 end
65 104
 
66 105
 function model = createFirstStepPanel(parent,DEFAULT)
67 106
 
68
-    x1 = 0;
69
-    x2 = 0.4;
70
-    x3 = 1;
107
+    main_grid = cell(2,4);
108
+    main_grid{1,1} = [0 0.7 0.4 0.3];
109
+    main_grid{1,2} = [0 0.5 0.5 0.2];
110
+    main_grid{1,3} = [0 0.1 0.5 0.4];
111
+    main_grid{1,4} = [0 0.0 1.0 0.1];
71 112
     
72
-    y1 = 1;
73
-    y2 = 0.6;
74
-    y3 = 0.4;
75
-    y4 = 0.2;
76
-    y5 = 0;
113
+    main_grid{2,1} = [0.4 0.7 0.6 0.3];
114
+    main_grid{2,2} = [0.5 0.5 0.5 0.2];
115
+    main_grid{2,3} = [0.5 0.1 0.5 0.4];
77 116
     
78 117
     %Subjects
79 118
     subjectList = {'Subj1','Subj2','Subj3','Subj4'};
... ...
@@ -82,11 +121,11 @@ function model = createFirstStepPanel(parent,DEFAULT)
82 121
                     'String',subjectList,...
83 122
                     'UserData',subjectList,...
84 123
                     'Units','normalized',...
85
-                    'Position',[x1 y2 x2-x1 y1-y2]);
86
-    set(model.subjectSelector,'BackgroundColor','y');
124
+                    'Position',cell2mat(main_grid(1,1)));
125
+    set(model.subjectSelector,'BackgroundColor','w');
87 126
     
88 127
     %Classes
89
-    pClasses = uipanel(parent,'Units','normalized','Position',[x1 y3 0.5 0.2]);
128
+    pClasses = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,2)));
90 129
     set(pClasses,'Title','Class Definitions');
91 130
     set(pClasses,'BackgroundColor','w');
92 131
         lClassDef = uicontrol(pClasses,...
... ...
@@ -105,11 +144,11 @@ function model = createFirstStepPanel(parent,DEFAULT)
105 144
         set(model.txtClassDef,'Max',20);
106 145
         set(model.txtClassDef,'Min',0);
107 146
         set(model.txtClassDef, 'FontName', 'FixedWidth');
108
-        set(model.txtClassDef, 'BackgroundColor', 'y');
147
+        set(model.txtClassDef, 'BackgroundColor', 'w');
109 148
 
110 149
 
111 150
     %Timeline
112
-    pPSTH        = uipanel(parent,'Title','PSTH Options','Position',[0.5 y2 0.5 y1-y2]);
151
+    pPSTH        = uipanel(parent,'Title','PSTH Options','Position',cell2mat(main_grid(2,1)));
113 152
     set(pPSTH,'BackgroundColor','w');
114 153
         
115 154
         grid_h = 0.16;
... ...
@@ -159,7 +198,7 @@ function model = createFirstStepPanel(parent,DEFAULT)
159 198
         model.txtSearchlightRadius = createTextField(pPSTH,cell2mat(grid(2,6)),DEFAULT.searchlightradius);
160 199
         
161 200
         % images
162
-        pImage = uipanel(parent,'Title','Image Options','Position',[0.5 0.4 0.5 0.2]);
201
+        pImage = uipanel(parent,'Title','Image Options','Position',cell2mat(main_grid(2,2)));
163 202
         set(pImage,'BackgroundColor','w');
164 203
 
165 204
         createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base');
... ...
@@ -175,7 +214,7 @@ function model = createFirstStepPanel(parent,DEFAULT)
175 214
         
176 215
         
177 216
         % coordinate Table
178
-        pVoxel = uipanel(parent,'Title','ROI','Position',[0.0 0.0 0.5 0.4]);
217
+        pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
179 218
         set(pVoxel,'BackgroundColor','w');
180 219
         lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name>+[offset];');
181 220
         model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],...
... ...
@@ -185,30 +224,61 @@ function model = createFirstStepPanel(parent,DEFAULT)
185 224
         set(model.txtVoxelDef,'Min',0);
186 225
         set(model.txtVoxelDef, 'FontName', 'FixedWidth');
187 226
         
188
-        pButtons = uipanel(parent,'Position',[0.5 0.0 0.5 0.4]);
189
-        set(pButtons,'BackgroundColor','b');
227
+        %normalizations
228
+        pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3)));
229
+        set(pNorm,'BackgroundColor','w');
230
+        
231
+        createLabel(pNorm,[0 0.75 1 0.25],'PST Normalization');
232
+        norm1Model = {'norm A','norm B'};
233
+        model.selNormPST = uicontrol(pNorm,'Style','popupmenu',...
234
+            'Units','normalized',...
235
+            'Position',[0.0 0.5 1 0.25],...
236
+            'String',norm1Model,...
237
+            'UserData',norm1Model,...
238
+            'Value',1);
239
+         set(model.selNormPST,'BackgroundColor','w');   
240
+        
241
+        createLabel(pNorm,[0 0.25 1 0.25],'Class-Grouping Normalization');
242
+        norm2Model = {'norm X','norm Y'};
243
+        model.selNormClass = uicontrol(pNorm,'Style','popupmenu',...
244
+            'Units','normalized',...
245
+            'Position',[0.0 0.0 1 0.25],...
246
+            'String',norm2Model,...
247
+            'UserData',norm2Model,...
248
+            'Value',1);
249
+         set(model.selNormClass,'BackgroundColor','w');   
250
+        
251
+        %buttons
252
+        pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
253
+        set(pButtons,'BackgroundColor','w');
190 254
         
191
-        btnRunButton1 = uicontrol(pButtons,'String','run coord-Table','Units','normalized','Position',[0 0.75 1 0.2]);
255
+        btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
256
+            'Units','normalized','Position',[0 0 0.33 1]);
192 257
         set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model.    
193 258
         
194
-        btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight','Units','normalized','Position',[0 0.5 1 0.2]);
259
+        btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight',...
260
+            'Units','normalized','Position',[0.33 0 0.33 1]);
195 261
         set(btnRunButton2,'Callback',{@cbRunFBS,model}); % set here, because of model.    
196 262
         
197
-        btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing','Units','normalized','Position',[0 0.25 1 0.2]);
263
+        btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
264
+            'Units','normalized','Position',[0.66 0 0.33 1]);
198 265
         set(btnRunButton2,'Callback',{@cbRunROIImage,model}); % set here, because of model.    
199 266
         set(btnRunButton3,'Enable','off');
200 267
 end
201 268
 
202 269
 function cbRunCoordTable(src,evnt,model)
203 270
     display('RUN Coord-Table Mode');
271
+    assignin('base','model1',model);
204 272
     main('COORD-LOOKUP-TABLE',model);
205 273
 end
206 274
 function cbRunROIImage(src,evnt,model)
207 275
     display('RUN Image-Mask Mode');
276
+    assignin('base','model1',model);
208 277
     main('ROI-IMAGE-MASK', model);
209 278
 end
210 279
 function cbRunFBS(src,evnt,model)
211 280
     display('RUN Full Brain Searchlight Mode');
281
+    assignin('base','model1',model);
212 282
     display('not implemented.');
213 283
 end
214 284
 
... ...
@@ -220,7 +290,8 @@ function label = createLabel(parent,  pos, labelText)
220 290
 end
221 291
 
222 292
 function txt = createTextField(parent,pos,model)
223
-    textfieldcolor = [0.9 0.9 0.0];
293
+%     textfieldcolor = [0.9 0.9 0.0];
294
+    textfieldcolor = 'w';
224 295
     txt = uicontrol(parent,'Style','edit','Units','normalized','String',model,'Position',pos);
225 296
     set(txt,'BackgroundColor',textfieldcolor);
226 297
 end