Browse code

add trajectory plot

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

Christoph Budziszewski authored on14/10/2009 14:45:40
Showing1 changed files
... ...
@@ -436,16 +436,22 @@ end
436 436
 
437 437
 function model = createVisualStepPanel(model,parent)
438 438
 
439
-    grid_h = 0.25;
439
+    grid_h = 0.125;
440 440
     grid_w = 0.5;
441
-    plot_grid = cell([3 3]);
441
+    plot_grid = cell([3 8]);
442 442
     plot_grid{1,1} = [0.0 0.63 grid_w grid_h];
443 443
     plot_grid{1,2} = [0.0 0.33 grid_w grid_h];
444 444
     plot_grid{1,3} = [0.0 0.03 grid_w grid_h];
445
-    plot_grid{2,1} = [0.25 0.63 grid_w grid_h];
446
-    plot_grid{2,2} = [0.25 0.33 grid_w grid_h];
447
-    plot_grid{2,3} = [0.25 0.03 grid_w grid_h];
445
+    plot_grid{2,1} = [0.25 (1-1*grid_h) grid_w grid_h];
446
+    plot_grid{2,2} = [0.25 (1-2*grid_h) grid_w grid_h];
447
+    plot_grid{2,3} = [0.25 (1-3*grid_h) grid_w grid_h];
448
+    plot_grid{2,4} = [0.25 (1-4*grid_h) grid_w grid_h];
449
+    plot_grid{2,5} = [0.25 (1-5*grid_h) grid_w grid_h];
450
+    plot_grid{2,6} = [0.25 (1-6*grid_h) grid_w grid_h];
451
+    plot_grid{2,7} = [0.25 (1-7*grid_h) grid_w grid_h];
452
+    plot_grid{2,8} = [0.25 (1-8*grid_h) grid_w grid_h];
448 453
 
454
+    
449 455
     pButtonPane = uipanel(parent,'Units','normalized','Position',[0 0.5 1 0.5]);
450 456
 %     set(pButtonPane,'Title','Plot');
451 457
     set(pButtonPane,'BackgroundColor','w');
... ...
@@ -468,7 +474,17 @@ function model = createVisualStepPanel(model,parent)
468 474
     set(btnPlot02,'Callback',{@cbPlot,model,'x-subject-val'});
469 475
     set(btnPlot02,'Enable','on');
470 476
 
471
-    
477
+    btnPlotT1 = uicontrol(pButtonPane,'String','Plot Trajectory (t vs A vs B)',...
478
+        'Units','normalized',...
479
+        'Position',cell2mat(plot_grid(2,4)));
480
+    set(btnPlotT1,'Callback',{@cbPlot,model,'trajectory'});
481
+    set(btnPlotT1,'Enable','on');
482
+
483
+    btnPlotT2 = uicontrol(pButtonPane,'String','Plot Trajectory (A vs B vs C)',...
484
+        'Units','normalized',...
485
+        'Position',cell2mat(plot_grid(2,5)));
486
+    set(btnPlotT2,'Callback',{@cbPlot,model,'trajectory3'});
487
+    set(btnPlotT2,'Enable','on');
472 488
 end
473 489
 
474 490
 %%%%% ui callbacks
Browse code

basic available ROI display

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

Christoph Budziszewski authored on07/08/2009 17:45:42
Showing1 changed files
... ...
@@ -271,7 +271,7 @@ function model = createFirstStepPanel(model,parent)
271 271
         
272 272
         btnROIlist = uicontrol(pVoxel,'String','show available ROIs','Units','normalized',...
273 273
             'Position',[0 0 1 0.15]);
274
-        set(btnROIlist,'Enable','off');
274
+        set(btnROIlist,'Enable','on');
275 275
         
276 276
         %buttons
277 277
         pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
... ...
@@ -287,9 +287,9 @@ function model = createFirstStepPanel(model,parent)
287 287
         
288 288
         
289 289
         set(btnRunButton1,'Callback',{@cbRunPreprocessing,model,'COORD'}); % set here, because of model.
290
-        set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'}); % set here, because of model.  
291
-        set(btnRunButton3,'Callback',{@cbRunPreprocessing,model,'ROI'}); % set here, because of model.    
292
-%         set(btnROIlist,'Callback',); % set here, because of model.  
290
+        set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'});   % set here, because of model.  
291
+        set(btnRunButton3,'Callback',{@cbRunPreprocessing,model,'ROI'});   % set here, because of model.    
292
+        set(btnROIlist,   'Callback',{@cbShowAvailableROIs,model});        % set here, because of model.  
293 293
    
294 294
 end
295 295
 
... ...
@@ -473,6 +473,10 @@ end
473 473
 
474 474
 %%%%% ui callbacks
475 475
 
476
+function cbShowAvailableROIs(src,evtl,model)
477
+    ui_showAvailableROIs(model);
478
+end
479
+
476 480
 function cbSwitchTask(src,evnt,task,taskpanel)
477 481
 set(taskpanel.preprocessing,'Visible','off');
478 482
 set(taskpanel.classification,'Visible','off');
Browse code

new labels, some cleanup

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

Christoph Budziszewski authored on07/08/2009 17:23:37
Showing1 changed files
... ...
@@ -6,7 +6,7 @@ function ui_main(varargin)
6 6
     
7 7
     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
8 8
     movegui(frame,'center'); % get this thing visible on smaller displays.
9
-    set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
9
+    set(frame,'Name','NODalyze');
10 10
     set(frame,'NumberTitle','off');
11 11
     set(frame,'MenuBar','none');
12 12
     set(frame,'Resize','on');
... ...
@@ -50,7 +50,7 @@ function ui_main(varargin)
50 50
         set(task.taskSwitch,'Units','normalized');
51 51
     
52 52
         btnSwitchPreprocessing = uicontrol(task.taskSwitch,'Style','pushbutton',...
53
-            'String','ImageProcessing',...
53
+            'String','Image Processing',...
54 54
             'Units','normalized','Position',[0.0 0.0 0.33 1]);
55 55
         set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task}); 
56 56
         set(btnSwitchPreprocessing,'Enable','on');
... ...
@@ -81,7 +81,7 @@ function ui_main(varargin)
81 81
         uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model});
82 82
         fillStudyMenu(studySelectMenu,model);
83 83
         
84
-    updateMenu = uimenu(frame,'Label','update ...','Enable','on');
84
+    updateMenu = uimenu(frame,'Label','Update ...','Enable','on');
85 85
         uimenu(updateMenu,'Label','rescan subject dir','Callback',{@mcb_update_subjects,model});
86 86
         uimenu(updateMenu,'Label','rescan images','Callback',{@mcb_update_imagebase,model});
87 87
         
... ...
@@ -147,7 +147,7 @@ function model = createFirstStepPanel(model,parent)
147 147
 
148 148
 
149 149
     %Timeline
150
-    pPSTH        = uipanel(parent,'Title','PSTH Options','Position',cell2mat(main_grid(2,1)));
150
+    pPSTH        = uipanel(parent,'Title','PST Options','Position',cell2mat(main_grid(2,1)));
151 151
     set(pPSTH,'BackgroundColor','w');
152 152
         
153 153
         grid_h = 0.16;
... ...
@@ -180,9 +180,10 @@ function model = createFirstStepPanel(model,parent)
180 180
 
181 181
         lStart      = createLabel(pPSTH, cell2mat(tl_grid(2,1)) ,'Start [sec]');
182 182
         lEnd        = createLabel(pPSTH, cell2mat(tl_grid(3,1)) ,'End [sec]');
183
-        lPSTH       = createLabel(pPSTH, cell2mat(tl_grid(1,2)) ,'PSTH Range');
183
+        lPSTH       = createLabel(pPSTH, cell2mat(tl_grid(1,2)) ,'PST Range');
184 184
         lBaseline   = createLabel(pPSTH, cell2mat(tl_grid(1,3)) ,'Baseline');
185 185
         lTRF        = createLabel(pPSTH, cell2mat(tl_grid(1,5)) ,'TR Factor');
186
+        lTRSec      = createLabel(pPSTH, cell2mat(tl_grid(3,4)) ,'TR [sec]');
186 187
 
187 188
         model.txtPSTHStart         = createTextField(pPSTH,cell2mat(tl_grid(2,2)),'');
188 189
         model.txtPSTHEnd           = createTextField(pPSTH,cell2mat(tl_grid(3,2)),'');
... ...
@@ -203,14 +204,14 @@ function model = createFirstStepPanel(model,parent)
203 204
         optGrid{1,2} = [0.0 0.66 grid_wl grid_h];
204 205
         optGrid{2,2} = [0.4 0.66 grid_wo grid_h];
205 206
 
206
-        optGrid{1,3} = [0.0 0.5 grid_wl grid_h];
207
-        optGrid{2,3} = [0.4 0.5 grid_wo grid_h];
207
+        optGrid{1,3} = [0.0 0.5 1.0 grid_h];
208
+%         optGrid{2,3} = [0.4 0.5 grid_wo grid_h];
208 209
         
209 210
         optGrid{1,4} = [0.0 0.33 grid_wl grid_h];
210 211
         optGrid{2,4} = [0.4 0.33 grid_wo grid_h];
211 212
 
212
-        optGrid{1,5} = [0.0 0.16 grid_wl grid_h];
213
-        optGrid{2,5} = [0.4 0.16 grid_wo grid_h];
213
+        optGrid{1,5} = [0.0 0.16 1.0 grid_h];
214
+%         optGrid{2,5} = [0.4 0.16 grid_wo grid_h];
214 215
         
215 216
         optGrid{1,6} = [0.0 0.0 grid_wl grid_h];
216 217
         optGrid{2,6} = [0.4 0.0 grid_wo grid_h];
... ...
@@ -227,7 +228,7 @@ function model = createFirstStepPanel(model,parent)
227 228
         
228 229
         %Options:normalizations
229 230
         
230
-        createLabel(pOptions,cell2mat(optGrid(1,2)),'psth norm4SVM');
231
+        createLabel(pOptions,cell2mat(optGrid(1,2)),'PST normalization');
231 232
         model.selNormPST = uicontrol(pOptions,'Style','popupmenu',...
232 233
             'Units','normalized',...
233 234
             'Position',cell2mat(optGrid(2,2)),...
... ...
@@ -237,49 +238,59 @@ function model = createFirstStepPanel(model,parent)
237 238
         
238 239
         model.chkColBias = uicontrol(pOptions,'Style','checkbox',...
239 240
             'Units','normalized',...
240
-            'Position',cell2mat(optGrid(2,3)),...
241
-            'String','column Bias removal',...
241
+            'Position',cell2mat(optGrid(1,3)),...
242
+            'String','Remove Column Bias within class',...
242 243
             'Enable','on');
243 244
          set(model.chkColBias,'BackgroundColor','w');   
244 245
          
245 246
          %Options:spatialGrouping
246 247
 
247
-         createLabel(pOptions,cell2mat(optGrid(1,4)),'ROI Grouping');
248
+         createLabel(pOptions,cell2mat(optGrid(1,4)),'Spatial Grouping');
248 249
          model.selRoiGrouping = uicontrol(pOptions,'Style','popupmenu',...
249 250
                 'Units','normalized',...
250 251
                 'Position',cell2mat(optGrid(2,4)),...
251 252
                 'String',roiGroupMethodNames,...
252 253
                 'UserData',roiGroupMethodFunctions);
253 254
          set(model.selRoiGrouping,'BackgroundColor','w');
255
+         
256
+         %Options:VOI selection for FBS
257
+         btnRunButton2 = uicontrol(pOptions,'String',sprintf('load VOI for Searchlight'),...
258
+             'Units','normalized','Position',cell2mat(optGrid(1,5)));
259
+         set(btnRunButton2,'Enable','on');
260
+ 
254 261
         
255 262
         % COORD TABLE
256
-        pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
263
+        pVoxel = uipanel(parent,'Title','Select ROIs','Position',cell2mat(main_grid(1,3)));
257 264
         set(pVoxel,'BackgroundColor','w');
258 265
         lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];');
259
-        model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],'');
266
+        model.txtVoxelDef = createTextField(pVoxel,[0 0.15 1 0.75],'');
260 267
         set(model.txtVoxelDef,'HorizontalAlignment','left');
261 268
         set(model.txtVoxelDef,'Max',20);
262 269
         set(model.txtVoxelDef,'Min',0);
263 270
         set(model.txtVoxelDef, 'FontName', 'FixedWidth');
264 271
         
272
+        btnROIlist = uicontrol(pVoxel,'String','show available ROIs','Units','normalized',...
273
+            'Position',[0 0 1 0.15]);
274
+        set(btnROIlist,'Enable','off');
275
+        
265 276
         %buttons
266 277
         pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
267 278
         set(pButtons,'BackgroundColor','w');
268 279
         
269
-        btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
280
+        btnRunButton1 = uicontrol(pButtons,'String','start ROI-List processing',...
270 281
             'Units','normalized','Position',[0 0 0.33 1]);
271
-        set(btnRunButton1,'Callback',{@cbRunPreprocessing,model,'COORD'}); % set here, because of model.    
272 282
         set(btnRunButton1,'Enable','on');
283
+
284
+        btnRunButton3 = uicontrol(pButtons,'String','start ROI-Image processing',...
285
+            'Units','normalized','Position',[0.66 0 0.33 1]);
286
+        set(btnRunButton3,'Enable','on');
273 287
         
274
-        btnRunButton2 = uicontrol(pButtons,'String',sprintf('load ROI for FBS'),...
275
-            'Units','normalized','Position',[0.33 0 0.33 1]);
276
-        set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'}); % set here, because of model.  
277
-        set(btnRunButton2,'Enable','on');
278 288
         
279
-        btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
280
-            'Units','normalized','Position',[0.66 0 0.33 1]);
289
+        set(btnRunButton1,'Callback',{@cbRunPreprocessing,model,'COORD'}); % set here, because of model.
290
+        set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'}); % set here, because of model.  
281 291
         set(btnRunButton3,'Callback',{@cbRunPreprocessing,model,'ROI'}); % set here, because of model.    
282
-        set(btnRunButton3,'Enable','on');
292
+%         set(btnROIlist,'Callback',); % set here, because of model.  
293
+   
283 294
 end
284 295
 
285 296
 function model = createSecondStepPanel(model,parent)
... ...
@@ -289,7 +300,7 @@ TimeframeGroupingStrings = {'none','mean'};%,'sum,'max','median'};
289 300
 TimeframeGroupingFunctions = {@(in)in,@(in)nanmean(in,2)};%,'sum',','max','median'};
290 301
 
291 302
 pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
292
-    set(pTime,'Title','Decode Timeframe Options');
303
+    set(pTime,'Title','Decode Timerange Options');
293 304
     set(pTime,'BackgroundColor',basecolor);
294 305
     grid_h = 0.25;
295 306
     grid_w = 0.3;
... ...
@@ -309,9 +320,9 @@ pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
309 320
     
310 321
     lStart      = createLabel(pTime, cell2mat(time_grid(2,1)) ,'Start [sec]');
311 322
     lEnd        = createLabel(pTime, cell2mat(time_grid(3,1)) ,'End [sec]');
312
-    lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Frame Shift');
313
-    lFramsSize  = createLabel(pTime, cell2mat(time_grid(1,3)),'Frame Size');
314
-    lFramegroup = createLabel(pTime, cell2mat(time_grid(1,4)),'Timeframe Grouping');
323
+    lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Time Range');
324
+    lFramsSize  = createLabel(pTime, cell2mat(time_grid(1,3)),'Shifting Time Frame [sec]');
325
+    lFramegroup = createLabel(pTime, cell2mat(time_grid(1,4)),'Time Frame Grouping');
315 326
     
316 327
     model.txtFrameShiftStart   = createTextField(pTime,cell2mat(time_grid(2,2)),'');
317 328
     model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),'');
... ...
@@ -326,33 +337,57 @@ pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
326 337
         'UserData',TimeframeGroupingFunctions);
327 338
     set(model.selTimeframeGrouping,'Enable','on');
328 339
     
329
-pSVM = uipanel(parent,'Units','normalized','Position',[0 0.3 0.5 0.4]);
330
-    set(pSVM,'Title','SVM Classification');
340
+pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.499 0.7]);
341
+    set(pSVM,'Title','SVM Classification (libSVM)');
331 342
     set(pSVM,'BackgroundColor',basecolor);
332 343
 
333
-    model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],'');
334
-    set(model.txtSVMopts,'HorizontalAlignment','left');
344
+    grid_h = 0.125;
345
+
346
+    svmgrid = cell([2 8]);
347
+    svmgrid{1,1} = [0.0 0.875 1.0 grid_h];
348
+    svmgrid{1,2} = [0.0 0.750 0.5 grid_h];
349
+    svmgrid{2,2} = [0.5 0.750 0.5 grid_h];
350
+    svmgrid{1,3} = [0.0 0.625 1   grid_h];
351
+    svmgrid{1,4} = [0.0 0.5   1   grid_h];
352
+    svmgrid{1,5} = [0.0 0.375 1   grid_h];
353
+    svmgrid{1,6} = [0.0 0.250 0.5 grid_h];
354
+    svmgrid{2,6} = [0.5 0.250 0.5 grid_h];
355
+    svmgrid{1,7} = [0.0 0.125 0.5 grid_h];
356
+    svmgrid{2,7} = [0.5 0.125 0.5 grid_h];
357
+    svmgrid{1,8} = [0.0 0.0   1   grid_h];
335 358
     
336
-    model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],'');
337
-    createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
338 359
     
339
-    model.chkSVMrnd = uicontrol(pSVM,'Style','checkbox','Units','normalized','Position',[0.1 0.50 0.9 0.16]);
340
-    set(model.chkSVMrnd,'String','Randomize Datapoints');
341
-    set(model.chkSVMrnd,'BackgroundColor','w');
342
-%     set(model.chkSVMrnd,'Value',StudyArgs.svmrnd);
360
+    model.txtSVMopts = createTextField(pSVM,cell2mat(svmgrid(1,1)),'');
361
+    set(model.txtSVMopts,'HorizontalAlignment','left');
343 362
     
344
-    btnRunSVM = uicontrol(pSVM,'String','run batchmode SVM Crossvalidation',...
363
+    model.txtSVMnfold = createTextField(pSVM,cell2mat(svmgrid(1,2)),'');
364
+    createLabel(pSVM,cell2mat(svmgrid(2,2)),'-Fold CrossVal');
365
+    
366
+    btnRunSVM = uicontrol(pSVM,'String','run SVM within-Subject crossvalidation',...
345 367
         'Units','normalized',...
346
-        'Position',[0 0.25 1 0.25]);
368
+        'Position',cell2mat(svmgrid(1,3)));
347 369
     set(btnRunSVM,'Enable','on');
348 370
     
349
-    btnRunXSVM = uicontrol(pSVM,'String','run SVM X-Subject validation',...
371
+    btnRunXSVM = uicontrol(pSVM,'String','run SVM across-Subject crossvalidation',...
350 372
         'Units','normalized',...
351
-        'Position',[0 0.0 1 0.25]);
373
+        'Position',cell2mat(svmgrid(1,4)));
352 374
     set(btnRunXSVM,'Enable','on');
353 375
     
354
-pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.3 0.5 0.4]);
355
-    set(pSOM,'Title','SOM Classification');
376
+    lSearchligh = createLabel(pSVM, cell2mat(svmgrid(1,6)),'Searchlight Radius (mm)');
377
+    model.txtSearchlightRadius = createTextField(pSVM,cell2mat(svmgrid(2,6)),'');
378
+    
379
+    lFBSTiming = createLabel(pSVM, cell2mat(svmgrid(1,7)),'Timepoints [sec] (opt.)');
380
+    set(lFBSTiming,'TooltipString','e.g. ''-5 0 5 10 15''');
381
+    model.txtSearchlightTimeline = createTextField(pSVM,cell2mat(svmgrid(2,7)),'');
382
+
383
+    btnRunFBS = uicontrol(pSVM,'String','run Searchlight',...
384
+        'Units','normalized',...
385
+        'Position',cell2mat(svmgrid(1,8)));
386
+    set(btnRunFBS,'Enable','on');
387
+    
388
+    
389
+pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.3 0.499 0.4]);
390
+    set(pSOM,'Title','SOM Classification (somtoolbox2)');
356 391
     set(pSOM,'BackgroundColor',basecolor);
357 392
 
358 393
     createLabel(pSOM,[0 0.75 0.3 0.20],'Size:');
... ...
@@ -369,35 +404,27 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.3 0.5 0.4]);
369 404
     set(model.selSomLattice,'BackgroundColor','w');
370 405
 
371 406
     model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.16],'');
372
-%     set(model.txtSOMnfold,'Enable','off');
373 407
     createLabel(pSOM,[0.75 0.5 0.25 0.16 ],'-Fold CrossVal');
374
-       
375 408
 
376
-    btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',...
409
+    btnRunSOM = uicontrol(pSOM,'String','run SOM within-Subject crossvalidation',...
377 410
         'Units','normalized',...
378 411
         'Position',[0.0 0.25 1 0.25]);
379 412
     set(btnRunSOM,'Enable','on');
380 413
 
381
-    btnRunXSOM = uicontrol(pSOM,'String','run SOM X-Subject validation',...
414
+    btnRunXSOM = uicontrol(pSOM,'String','run SOM across-Subject crossvalidation',...
382 415
         'Units','normalized',...
383 416
         'Position',[0.0 0.0 1 0.25]);
384 417
     set(btnRunXSOM,'Enable','on');
385 418
     
386
-pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.0 0.5 0.3]);
387
-    set(pSearchlight,'Title','Spatiotemporal FB classification');
388
-    set(pSearchlight,'BackgroundColor',basecolor);
389
-    
390
-    lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius (mm)');
391
-    model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],'');
419
+% OPTIONS
420
+pOptions = uipanel(parent,'Units','normalized','Position',[0.5 0 0.5 0.3]);
421
+    set(pOptions,'Title','Other Options');
422
+    set(pOptions,'BackgroundColor',basecolor);
392 423
     
393
-    lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')');
394
-    model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],'');
424
+    model.chkSVMrnd = uicontrol(pOptions,'Style','checkbox','Units','normalized','Position',[0 0.66 1 0.33]);
425
+    set(model.chkSVMrnd,'String','Randomize Trial Order');
426
+    set(model.chkSVMrnd,'BackgroundColor','w');
395 427
 
396
-    btnRunFBS = uicontrol(pSearchlight,'String','run Spatiotemporal FB classification',...
397
-        'Units','normalized',...
398
-        'Position',[0.0 0.0 1 0.3]);
399
-    set(btnRunFBS,'Enable','on');
400
-    
401 428
 
402 429
 % button callbacks set here, because of model.
403 430
     set(btnRunSVM, 'Callback',{@cbRunDecode,model,'SVM'}); 
... ...
@@ -423,19 +450,19 @@ function model = createVisualStepPanel(model,parent)
423 450
 %     set(pButtonPane,'Title','Plot');
424 451
     set(pButtonPane,'BackgroundColor','w');
425 452
     
426
-    btnPlot03 = uicontrol(pButtonPane,'String','plot PSTH',...
453
+    btnPlot03 = uicontrol(pButtonPane,'String','Plot PSTH',...
427 454
         'Units','normalized',...
428 455
         'Position',cell2mat(plot_grid(2,1)));
429 456
     set(btnPlot03,'Callback',{@cbPlot,model,'psth'}); 
430 457
     set(btnPlot03,'Enable','on');
431 458
   
432
-    btnPlot01 = uicontrol(pButtonPane,'String','plot performance and SE',...
459
+    btnPlot01 = uicontrol(pButtonPane,'String','Plot Decode Performance +/- SE',...
433 460
         'Units','normalized',...
434 461
         'Position',cell2mat(plot_grid(2,2)));
435 462
     set(btnPlot01,'Callback',{@cbPlot,model,'simple'});
436 463
     set(btnPlot01,'Enable','on');
437 464
     
438
-    btnPlot02 = uicontrol(pButtonPane,'String','plot subject performance and mean with SE',...
465
+    btnPlot02 = uicontrol(pButtonPane,'String','Plot Individual Performance and Mean +/- SE',...
439 466
         'Units','normalized',...
440 467
         'Position',cell2mat(plot_grid(2,3)));
441 468
     set(btnPlot02,'Callback',{@cbPlot,model,'x-subject-val'});
Browse code

preliminary confidence intervall plot data save+load

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

Christoph Budziszewski authored on05/08/2009 14:12:52
Showing1 changed files
... ...
@@ -71,7 +71,11 @@ function ui_main(varargin)
71 71
     % MENUS
72 72
 
73 73
     savemenu = uimenu(frame,'Label','Save ...','Enable','on');
74
-        uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on');
74
+        uimenu(savemenu,'Label','Save Parameter','Callback',{@mcb_save,'PARAMS',model},'Enable','on');
75
+        uimenu(savemenu,'Label','Save ImageProcesseding Data','Callback',{@mcb_save,'IMAGEPROCESSING',model},'Enable','on');
76
+        uimenu(savemenu,'Label','Load ImageProcesseding Data','Callback',{@mcb_load,'IMAGEPROCESSING',model},'Enable','on');
77
+        uimenu(savemenu,'Label','Save Decode Data','Callback',{@mcb_save,'DECODE',model},'Enable','on');
78
+        uimenu(savemenu,'Label','Load Decode Data','Callback',{@mcb_load,'DECODE',model},'Enable','on');
75 79
         
76 80
     studySelectMenu = uimenu(frame,'Label','Study ...','Enable','on');
77 81
         uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model});
... ...
@@ -473,9 +477,47 @@ end
473 477
 
474 478
 %%%%%%%%%% menu callbacks
475 479
 
476
-function mcb_save(src,evnt,model)
477
-studyID = get(model.txtStudyID,'String');
478
-saveStudy(studyID,model);
480
+function mcb_save(src,evnt,token,model)
481
+switch token
482
+    case 'PARAMS'
483
+        studyID = get(model.txtStudyID,'String');
484
+        saveStudy(studyID,model);
485
+    case 'IMAGEPROCESSING'
486
+        disp('save img data..');
487
+        [FileName,PathName,FilterIndex] = uiputfile('*.mat','Save ImageProcessing Data') ;
488
+        if(~strcmp(FileName,''))
489
+            evalin('base', sprintf('save(''%s'',''%s'')',fullfile(PathName,FileName),'preprocessedData'));
490
+            disp('saved');
491
+        end
492
+%         [FileName,PathName,FilterIndex] = uigetfile('*.mat','Load ImageProcessing Data') 
493
+%         evalin('base', sprintf('load(%s,%s)',fullfile(PathName,FileName),'preprocessedData'));
494
+    case 'DECODE'
495
+        disp('save decode data..');
496
+        [FileName,PathName,FilterIndex] = uiputfile('*.mat','Save Decode Data') ;
497
+        if(~strcmp(FileName,''))
498
+            evalin('base', sprintf('save(''%s'',''%s'')',fullfile(PathName,FileName),'decode'));
499
+            disp('saved');
500
+        end
501
+end
502
+end
503
+
504
+function mcb_load(src,evnt,token,model)
505
+switch token
506
+    case 'IMAGEPROCESSING'
507
+        disp('load img data..');
508
+        [FileName,PathName,FilterIndex] = uigetfile('*.mat','Load ImageProcessing Data') ;
509
+        if(~strcmp(FileName,''))
510
+            evalin('base', sprintf('load(''%s'',''%s'')',fullfile(PathName,FileName),'preprocessedData'));
511
+            disp('done');
512
+        end
513
+    case 'DECODE'
514
+        disp('load decode data..');
515
+        [FileName,PathName,FilterIndex] = uigetfile('*.mat','Load Decode Data') ;
516
+        if(~strcmp(FileName,''))
517
+            evalin('base', sprintf('load(''%s'',''%s'')',fullfile(PathName,FileName),'decode'));
518
+            disp('done');
519
+        end
520
+end
479 521
 end
480 522
 
481 523
 function mcb_update_subjects(src,evnt,model)
Browse code

spatial and temporal grouping functionality

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

Christoph Budziszewski authored on03/08/2009 16:18:15
Showing1 changed files
... ...
@@ -5,7 +5,7 @@ function ui_main(varargin)
5 5
     frameHeight=450;
6 6
     
7 7
     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
8
-    movegui(frame,'west'); % get this thing visible on smaller displays.
8
+    movegui(frame,'center'); % get this thing visible on smaller displays.
9 9
     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
10 10
     set(frame,'NumberTitle','off');
11 11
     set(frame,'MenuBar','none');
... ...
@@ -92,7 +92,8 @@ end
92 92
 %%%%% ui elements
93 93
 function model = createFirstStepPanel(model,parent)
94 94
     norm1Model = {'none','mean','minmax'};
95
-    roiGroupMethods = {'none','mean','max','median'};
95
+    roiGroupMethodNames = {'none','mean','max','median'};
96
+    roiGroupMethodFunctions = {@(in)in, @(in)nanmean(in),@(in)nanmax(in),@(in)nanmedian(in)};
96 97
 
97 98
     main_grid = cell(2,4);
98 99
     main_grid{1,1} = [0 0.7 0.4 0.3];
... ...
@@ -243,10 +244,9 @@ function model = createFirstStepPanel(model,parent)
243 244
          model.selRoiGrouping = uicontrol(pOptions,'Style','popupmenu',...
244 245
                 'Units','normalized',...
245 246
                 'Position',cell2mat(optGrid(2,4)),...
246
-                'String',roiGroupMethods,...
247
-                'UserData',roiGroupMethods);
247
+                'String',roiGroupMethodNames,...
248
+                'UserData',roiGroupMethodFunctions);
248 249
          set(model.selRoiGrouping,'BackgroundColor','w');
249
-         
250 250
         
251 251
         % COORD TABLE
252 252
         pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
... ...
@@ -281,6 +281,9 @@ end
281 281
 function model = createSecondStepPanel(model,parent)
282 282
 basecolor = 'w';
283 283
 
284
+TimeframeGroupingStrings = {'none','mean'};%,'sum,'max','median'};
285
+TimeframeGroupingFunctions = {@(in)in,@(in)nanmean(in,2)};%,'sum',','max','median'};
286
+
284 287
 pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
285 288
     set(pTime,'Title','Decode Timeframe Options');
286 289
     set(pTime,'BackgroundColor',basecolor);
... ...
@@ -310,14 +313,14 @@ pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
310 313
     model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),'');
311 314
     model.txtFrameShiftDur     = createTextField(pTime,cell2mat(time_grid(2,3)),'');
312 315
     
313
-    TimeframeGroupingOptions = {'none','sum','mean','max','median'};
316
+
314 317
     
315 318
     model.selTimeframeGrouping = uicontrol(pTime,'Style','popupmenu',...
316 319
         'Units','normalized',...
317 320
         'Position',cell2mat(time_grid(2,4)),...
318
-        'String',TimeframeGroupingOptions,...
319
-        'UserData',TimeframeGroupingOptions);
320
-    set(model.selTimeframeGrouping,'Enable','off');
321
+        'String',TimeframeGroupingStrings,...
322
+        'UserData',TimeframeGroupingFunctions);
323
+    set(model.selTimeframeGrouping,'Enable','on');
321 324
     
322 325
 pSVM = uipanel(parent,'Units','normalized','Position',[0 0.3 0.5 0.4]);
323 326
     set(pSVM,'Title','SVM Classification');
... ...
@@ -515,6 +518,3 @@ end
515 518
 
516 519
 
517 520
 
518
-
519
-
520
-
Browse code

studychange works. added gui elements for spatial and temporal grouping

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

Christoph Budziszewski authored on30/07/2009 20:05:36
Showing1 changed files
... ...
@@ -91,6 +91,8 @@ end
91 91
 
92 92
 %%%%% ui elements
93 93
 function model = createFirstStepPanel(model,parent)
94
+    norm1Model = {'none','mean','minmax'};
95
+    roiGroupMethods = {'none','mean','max','median'};
94 96
 
95 97
     main_grid = cell(2,4);
96 98
     main_grid{1,1} = [0 0.7 0.4 0.3];
... ...
@@ -99,8 +101,8 @@ function model = createFirstStepPanel(model,parent)
99 101
     main_grid{1,4} = [0 0.0 1.0 0.1];
100 102
     
101 103
     main_grid{2,1} = [0.4 0.7 0.6 0.3];
102
-    main_grid{2,2} = [0.5 0.5 0.5 0.2];
103
-    main_grid{2,3} = [0.5 0.1 0.5 0.4];
104
+    main_grid{2,2} = [0.5 0.1 0.5 0.6];
105
+%     main_grid{2,3} = [0.5 0.1 0.5 0.4];
104 106
     
105 107
     %Subjects
106 108
     pSubject = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,1)));
... ...
@@ -184,50 +186,77 @@ function model = createFirstStepPanel(model,parent)
184 186
         model.txtTrFactor          = createTextField(pPSTH,cell2mat(tl_grid(2,5)),'');
185 187
         model.labelTR              = createTextField(pPSTH,cell2mat(tl_grid(3,5)),'');
186 188
         
187
-        % images
188
-        pImage = uipanel(parent,'Title','Image Options','Position',cell2mat(main_grid(2,2)));
189
-        set(pImage,'BackgroundColor','w');
190
-
191
-        createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base');
192
-        
193
-        model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',...
194
-        'Units','normalized',...
195
-        'Position',[0.0 0.0 1 0.5]);
196
-        set(model.imageTypeSelection,'BackgroundColor','w');
197
-        
198
-        % coordinate Table
199
-        pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
200
-        set(pVoxel,'BackgroundColor','w');
201
-        lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];');
202
-        model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],'');
203
-        set(model.txtVoxelDef,'HorizontalAlignment','left');
204
-        set(model.txtVoxelDef,'Max',20);
205
-        set(model.txtVoxelDef,'Min',0);
206
-        set(model.txtVoxelDef, 'FontName', 'FixedWidth');
189
+        % OPTIONS
190
+        grid_h = 0.16;
191
+        grid_wl = 0.4;
192
+        grid_wo = 0.6;
207 193
         
208
-        %normalizations
209
-        pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3)));
210
-        set(pNorm,'BackgroundColor','w');
194
+        optGrid = cell([3 6]);
195
+        optGrid{1,1} = [0.0 0.83 grid_wl grid_h];
196
+        optGrid{2,1} = [0.4 0.83 grid_wo grid_h];
211 197
         
212
-        createLabel(pNorm,[0 0.75 1 0.25],'psth norm4SVM');
198
+        optGrid{1,2} = [0.0 0.66 grid_wl grid_h];
199
+        optGrid{2,2} = [0.4 0.66 grid_wo grid_h];
200
+
201
+        optGrid{1,3} = [0.0 0.5 grid_wl grid_h];
202
+        optGrid{2,3} = [0.4 0.5 grid_wo grid_h];
213 203
         
204
+        optGrid{1,4} = [0.0 0.33 grid_wl grid_h];
205
+        optGrid{2,4} = [0.4 0.33 grid_wo grid_h];
206
+
207
+        optGrid{1,5} = [0.0 0.16 grid_wl grid_h];
208
+        optGrid{2,5} = [0.4 0.16 grid_wo grid_h];
214 209
         
215
-        norm1Model = {'none','mean','minmax'};
210
+        optGrid{1,6} = [0.0 0.0 grid_wl grid_h];
211
+        optGrid{2,6} = [0.4 0.0 grid_wo grid_h];
216 212
 
213
+        % Options:Imagebase
214
+        pOptions = uipanel(parent,'Title','Options','Position',cell2mat(main_grid(2,2)));
215
+        set(pOptions,'BackgroundColor','w');
216
+
217
+        createLabel(pOptions,cell2mat(optGrid(1,1)),'Image Base');
218
+        model.imageTypeSelection = uicontrol(pOptions,'Style','popupmenu',...
219
+        'Units','normalized',...
220
+        'Position',cell2mat(optGrid(2,1)));
221
+        set(model.imageTypeSelection,'BackgroundColor','w');
222
+        
223
+        %Options:normalizations
217 224
         
218
-        model.selNormPST = uicontrol(pNorm,'Style','popupmenu',...
225
+        createLabel(pOptions,cell2mat(optGrid(1,2)),'psth norm4SVM');
226
+        model.selNormPST = uicontrol(pOptions,'Style','popupmenu',...
219 227
             'Units','normalized',...
220
-            'Position',[0.0 0.5 1 0.25],...
228
+            'Position',cell2mat(optGrid(2,2)),...
221 229
             'String',norm1Model,...
222 230
             'UserData',norm1Model);
223 231
          set(model.selNormPST,'BackgroundColor','w');   
224 232
         
225
-        model.chkColBias = uicontrol(pNorm,'Style','checkbox',...
233
+        model.chkColBias = uicontrol(pOptions,'Style','checkbox',...
226 234
             'Units','normalized',...
227
-            'Position',[0.0 0.1 1 0.25],...
235
+            'Position',cell2mat(optGrid(2,3)),...
228 236
             'String','column Bias removal',...
229 237
             'Enable','on');
230 238
          set(model.chkColBias,'BackgroundColor','w');   
239
+         
240
+         %Options:spatialGrouping
241
+
242
+         createLabel(pOptions,cell2mat(optGrid(1,4)),'ROI Grouping');
243
+         model.selRoiGrouping = uicontrol(pOptions,'Style','popupmenu',...
244
+                'Units','normalized',...
245
+                'Position',cell2mat(optGrid(2,4)),...
246
+                'String',roiGroupMethods,...
247
+                'UserData',roiGroupMethods);
248
+         set(model.selRoiGrouping,'BackgroundColor','w');
249
+         
250
+        
251
+        % COORD TABLE
252
+        pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
253
+        set(pVoxel,'BackgroundColor','w');
254
+        lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];');
255
+        model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],'');
256
+        set(model.txtVoxelDef,'HorizontalAlignment','left');
257
+        set(model.txtVoxelDef,'Max',20);
258
+        set(model.txtVoxelDef,'Min',0);
259
+        set(model.txtVoxelDef, 'FontName', 'FixedWidth');
231 260
         
232 261
         %buttons
233 262
         pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
... ...
@@ -252,33 +281,45 @@ end
252 281
 function model = createSecondStepPanel(model,parent)
253 282
 basecolor = 'w';
254 283
 
255
-pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]);
284
+pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.7 1 0.3]);
256 285
     set(pTime,'Title','Decode Timeframe Options');
257 286
     set(pTime,'BackgroundColor',basecolor);
258
-    grid_h = 0.3;
287
+    grid_h = 0.25;
259 288
     grid_w = 0.3;
260
-    time_grid = cell([3 3]);
261
-    time_grid{1,1} = [0.0 0.63 grid_w grid_h];
262
-    time_grid{2,1} = [0.4 0.63 grid_w grid_h];
263
-    time_grid{3,1} = [0.7 0.63 grid_w grid_h];
264
-    time_grid{1,2} = [0.0 0.33 grid_w grid_h];
265
-    time_grid{2,2} = [0.4 0.33 grid_w grid_h];
266
-    time_grid{3,2} = [0.7 0.33 grid_w grid_h];
267
-    time_grid{1,3} = [0.0 0.03 grid_w grid_h];
268
-    time_grid{2,3} = [0.4 0.03 grid_w grid_h];
269
-    time_grid{3,3} = [0.7 0.03 grid_w grid_h];
270
-
289
+    time_grid = cell([3 4]);
290
+    time_grid{1,1} = [0.0 0.75 grid_w grid_h];
291
+    time_grid{2,1} = [0.4 0.75 grid_w grid_h];
292
+    time_grid{3,1} = [0.7 0.75 grid_w grid_h];
293
+    time_grid{1,2} = [0.0 0.50 grid_w grid_h];
294
+    time_grid{2,2} = [0.4 0.50 grid_w grid_h];
295
+    time_grid{3,2} = [0.7 0.50 grid_w grid_h];
296
+    time_grid{1,3} = [0.0 0.25 grid_w grid_h];
297
+    time_grid{2,3} = [0.4 0.25 grid_w grid_h];
298
+    time_grid{3,3} = [0.7 0.0 grid_w grid_h];
299
+    time_grid{1,4} = [0.0 0.0 grid_w grid_h];
300
+    time_grid{2,4} = [0.4 0.0 grid_w grid_h];
301
+    time_grid{3,4} = [0.7 0.0 grid_w grid_h];
302
+    
271 303
     lStart      = createLabel(pTime, cell2mat(time_grid(2,1)) ,'Start [sec]');
272 304
     lEnd        = createLabel(pTime, cell2mat(time_grid(3,1)) ,'End [sec]');
273 305
     lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Frame Shift');
274 306
     lFramsSize  = createLabel(pTime, cell2mat(time_grid(1,3)),'Frame Size');
307
+    lFramegroup = createLabel(pTime, cell2mat(time_grid(1,4)),'Timeframe Grouping');
275 308
     
276 309
     model.txtFrameShiftStart   = createTextField(pTime,cell2mat(time_grid(2,2)),'');
277 310
     model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),'');
278 311
     model.txtFrameShiftDur     = createTextField(pTime,cell2mat(time_grid(2,3)),'');
279
-
280 312
     
281
-pSVM = uipanel(parent,'Units','normalized','Position',[0 0.4 0.5 0.4]);
313
+    TimeframeGroupingOptions = {'none','sum','mean','max','median'};
314
+    
315
+    model.selTimeframeGrouping = uicontrol(pTime,'Style','popupmenu',...
316
+        'Units','normalized',...
317
+        'Position',cell2mat(time_grid(2,4)),...
318
+        'String',TimeframeGroupingOptions,...
319
+        'UserData',TimeframeGroupingOptions);
320
+    set(model.selTimeframeGrouping,'Enable','off');
321
+    
322
+pSVM = uipanel(parent,'Units','normalized','Position',[0 0.3 0.5 0.4]);
282 323
     set(pSVM,'Title','SVM Classification');
283 324
     set(pSVM,'BackgroundColor',basecolor);
284 325
 
... ...
@@ -303,26 +344,26 @@ pSVM = uipanel(parent,'Units','normalized','Position',[0 0.4 0.5 0.4]);
303 344
         'Position',[0 0.0 1 0.25]);
304 345
     set(btnRunXSVM,'Enable','on');
305 346
     
306
-pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]);
347
+pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.3 0.5 0.4]);
307 348
     set(pSOM,'Title','SOM Classification');
308 349
     set(pSOM,'BackgroundColor',basecolor);
309 350
 
310 351
     createLabel(pSOM,[0 0.75 0.3 0.20],'Size:');
311
-    model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],'');
312
-    somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.20],'x');
352
+    model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.16],'');
353
+    somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.16],'x');
313 354
     set(somsizemal,'HorizontalAlignment','center');
314
-    model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],'');
355
+    model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.16],'');
315 356
     latticeModel = {'rect','hexa'};
316 357
     model.selSomLattice = uicontrol(pSOM,'Style','popupmenu',...
317 358
         'Units','normalized',...
318
-        'Position',[0.0 0.5 0.3 0.20],...
359
+        'Position',[0.0 0.5 0.3 0.16],...
319 360
         'String',latticeModel,...
320 361
         'UserData',latticeModel);
321 362
     set(model.selSomLattice,'BackgroundColor','w');
322 363
 
323
-    model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],'');
364
+    model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.16],'');
324 365
 %     set(model.txtSOMnfold,'Enable','off');
325
-    createLabel(pSOM,[0.75 0.5 0.25 0.20 ],'-Fold CrossVal');
366
+    createLabel(pSOM,[0.75 0.5 0.25 0.16 ],'-Fold CrossVal');
326 367
        
327 368
 
328 369
     btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',...
... ...
@@ -335,7 +376,7 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]);
335 376
         'Position',[0.0 0.0 1 0.25]);
336 377
     set(btnRunXSOM,'Enable','on');
337 378
     
338
-pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3]);
379
+pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.0 0.5 0.3]);
339 380
     set(pSearchlight,'Title','Spatiotemporal FB classification');
340 381
     set(pSearchlight,'BackgroundColor',basecolor);
341 382
     
Browse code

almost all "change study" features implemented. needs testing.

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

Christoph Budziszewski authored on30/07/2009 18:46:52
Showing1 changed files
... ...
@@ -14,10 +14,6 @@ function ui_main(varargin)
14 14
     set(frame,'Color','y');
15 15
 
16 16
     task = struct;
17
-    
18
-%     studyID = getPreviousStudyID();
19
-    
20
-%     StudyArgs = load_study(studyID);
21 17
 
22 18
     model = struct;
23 19
     
... ...
@@ -35,12 +31,8 @@ function ui_main(varargin)
35 31
     task.preprocessing   = uipanel(frame,'Title','Preprocessing','Position',[0 0.0 1 TASK_HEIGHT]);
36 32
     set(task.preprocessing,'BackgroundColor','w');
37 33
     set(task.preprocessing,'Units','normalized');
38
-    
39 34
     model = createFirstStepPanel(model,task.preprocessing);
40 35
     
41
-    % fill with data
42
-%     model = scanDirs(model);
43
-    
44 36
     % CLASSIFICATION
45 37
     task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]);
46 38
     set(task.classification,'BackgroundColor','w');
... ...
@@ -51,7 +43,7 @@ function ui_main(varargin)
51 43
     set(task.plot,'BackgroundColor','w');
52 44
     model = createVisualStepPanel(model,task.plot);
53 45
     
54
-    % TASK
46
+    % TASK SWITCH BUTTONS
55 47
     task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]);
56 48
     % controlls togglebuttons
57 49
         set(task.taskSwitch,'BackgroundColor','w');
... ...
@@ -76,7 +68,7 @@ function ui_main(varargin)
76 68
         set(btnSwitchPlot,'Enable','on');
77 69
 
78 70
 
79
-    % menus
71
+    % MENUS
80 72
 
81 73
     savemenu = uimenu(frame,'Label','Save ...','Enable','on');
82 74
         uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on');
... ...
@@ -85,8 +77,9 @@ function ui_main(varargin)
85 77
         uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model});
86 78
         fillStudyMenu(studySelectMenu,model);
87 79
         
88
-    updateMenu = uimenu(frame,'Label','update ...','Enable','off');
89
-        uimenu(updateMenu,'Label','scan dirs','Callback',{@ssss,studySelectMenu});
80
+    updateMenu = uimenu(frame,'Label','update ...','Enable','on');
81
+        uimenu(updateMenu,'Label','rescan subject dir','Callback',{@mcb_update_subjects,model});
82
+        uimenu(updateMenu,'Label','rescan images','Callback',{@mcb_update_imagebase,model});
90 83
         
91 84
 %     newStudyMenu = uimenu(frame,'Label','new Study','Enable','on');
92 85
 
... ...
@@ -346,7 +339,7 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3])
346 339
     set(pSearchlight,'Title','Spatiotemporal FB classification');
347 340
     set(pSearchlight,'BackgroundColor',basecolor);
348 341
     
349
-    lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius');
342
+    lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius (mm)');
350 343
     model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],'');
351 344
     
352 345
     lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')');
... ...
@@ -441,7 +434,37 @@ studyID = get(model.txtStudyID,'String');
441 434
 saveStudy(studyID,model);
442 435
 end
443 436
 
437
+function mcb_update_subjects(src,evnt,model)
438
+studyID = get(model.txtStudyID,'String');
439
+baseDir = getBaseDir(model);
440
+subjectNames = listDirNames(baseDir);
441
+
442
+set(model.subjectSelector,'String',subjectNames);
443
+set(model.subjectSelector,'UserData',subjectNames);
444
+set(model.subjectSelector,'Value',1);
445
+
446
+saveStudy(studyID,model);
447
+end
448
+
449
+function mcb_update_imagebase(src,evnt,model)
450
+studyID = get(model.txtStudyID,'String');
451
+
452
+subjectNames = getSubjectCellList(model);
453
+imageDir = fullfile(getBaseDir(model),cell2mat(subjectNames(1)));
454
+imageMask = imageMaskNames(imageDir);
455
+
456
+set(model.imageTypeSelection,'String',imageMask);
457
+set(model.imageTypeSelection,'UserData',imageMask);
458
+set(model.imageTypeSelection,'Value',1);
459
+
460
+saveStudy(studyID,model);
461
+end
462
+
463
+
444 464
 function mcb_new_study(src,evnt,studymenu,uimodel)
465
+studyID = get(uimodel.txtStudyID,'String');
466
+saveStudy(studyID,uimodel);
467
+
445 468
 display('CREATE STUDY');
446 469
     ui_createStudy(studymenu,uimodel);
447 470
 end
Browse code

first eventually working study switch functionality

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

Christoph Budziszewski authored on29/07/2009 15:51:21
Showing1 changed files
... ...
@@ -9,22 +9,26 @@ function ui_main(varargin)
9 9
     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
10 10
     set(frame,'NumberTitle','off');
11 11
     set(frame,'MenuBar','none');
12
-%     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
13 12
     set(frame,'Resize','on');
14 13
     set(frame,'Units','normalized');
15 14
     set(frame,'Color','y');
16 15
 
17 16
     task = struct;
18 17
     
19
-    DEFAULT = mcb_load_study(0,0,fullfile(getTbxPath,'study/stimolos.mat'));
18
+%     studyID = getPreviousStudyID();
20 19
     
21
-    model1 = struct;
22
-    model1.baseDir = DEFAULT.wd;
20
+%     StudyArgs = load_study(studyID);
23 21
 
24
-    model1.txtBaseDir = createLabel(frame,[0 0.97 1 0.03],model1.baseDir);
25
-    set(model1.txtBaseDir,'BackgroundColor','w');
26
-    set(model1.txtBaseDir,'ForegroundColor','b');
22
+    model = struct;
27 23
     
24
+    model.txtBaseDir = createLabel(frame,[0 0.97 0.8 0.03],'');
25
+    set(model.txtBaseDir,'BackgroundColor','w');
26
+    set(model.txtBaseDir,'ForegroundColor','b');
27
+    
28
+    model.txtStudyID = createLabel(frame,[0.8 0.97 0.2 0.03],'');
29
+    set(model.txtStudyID,'BackgroundColor','w');
30
+    set(model.txtStudyID,'ForegroundColor','r');    
31
+
28 32
     TASK_HEIGHT = 1-0.13;
29 33
     
30 34
     % PREPROCESSING
... ...
@@ -32,80 +36,68 @@ function ui_main(varargin)
32 36
     set(task.preprocessing,'BackgroundColor','w');
33 37
     set(task.preprocessing,'Units','normalized');
34 38
     
35
-    model1.selectedSubject = DEFAULT.selectedSubject;
36
-    model1 = createFirstStepPanel(model1,task.preprocessing,DEFAULT);
39
+    model = createFirstStepPanel(model,task.preprocessing);
37 40
     
38 41
     % fill with data
39
-    model1 = scanDirs(model1);
42
+%     model = scanDirs(model);
40 43
     
41 44
     % CLASSIFICATION
42
-    model2 = struct;
43
-    
44 45
     task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]);
45 46
     set(task.classification,'BackgroundColor','w');
46
-    model2 = createSecondStepPanel(model2,task.classification,DEFAULT);
47
+    model = createSecondStepPanel(model,task.classification);
47 48
     
48 49
     % PLOT
49
-    model3 = struct;
50 50
     task.plot = uipanel(frame,'Title','Plot','Position',[0 0.0 1 TASK_HEIGHT]);
51 51
     set(task.plot,'BackgroundColor','w');
52
-    model3 = createVisualStepPanel(model3,task.plot,DEFAULT);
52
+    model = createVisualStepPanel(model,task.plot);
53 53
     
54 54
     % TASK
55 55
     task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]);
56 56
     % controlls togglebuttons
57
-%         set(task.taskSwitch,'Title','TASK');
58 57
         set(task.taskSwitch,'BackgroundColor','w');
59 58
         set(task.taskSwitch,'Units','normalized');
60 59
     
61 60
         btnSwitchPreprocessing = uicontrol(task.taskSwitch,'Style','pushbutton',...
62 61
             'String','ImageProcessing',...
63 62
             'Units','normalized','Position',[0.0 0.0 0.33 1]);
64
-        set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task,model1}); 
63
+        set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task}); 
65 64
         set(btnSwitchPreprocessing,'Enable','on');
66 65
 
67 66
         btnSwitchClassify = uicontrol(task.taskSwitch,'Style','pushbutton',...
68 67
             'String','Decode',...
69 68
             'Units','normalized','Position',[0.33 0.0 0.33 1]);
70
-        set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task,model2}); 
69
+        set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task}); 
71 70
         set(btnSwitchClassify,'Enable','on');
72 71
 
73 72
         btnSwitchPlot = uicontrol(task.taskSwitch,'Style','pushbutton',...
74 73
             'String','Plot',...
75 74
             'Units','normalized','Position',[0.66 0.0 0.33 1]);
76
-        set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task,model3}); 
75
+        set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task}); 
77 76
         set(btnSwitchPlot,'Enable','on');
78 77
 
79
-    % menu
80
-    
81
-    savemenu = uimenu(frame,'Label','Save/Load','Enable','off');
82
-        uimenu(savemenu,'Label','Save Preprocessing Parameter','Callback',{@mcb_save,model1},'Enable','off');
83
-        uimenu(savemenu,'Label','Load Preprocessing Parameter','Callback',{@mcb_load,model1},'Enable','off');
84
-        uimenu(savemenu,'Label','Save Decode Parameter','Callback',{@mcb_save,model2},'Enable','off');
85
-        uimenu(savemenu,'Label','Load Decode Parameter','Callback',{@mcb_load,model2},'Enable','off');
86
-        uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model1},'Enable','off');
87
-        uimenu(savemenu,'Label','Load All','Callback',{@mcb_load,model1},'Enable','off');
78
+
79
+    % menus
80
+
81
+    savemenu = uimenu(frame,'Label','Save ...','Enable','on');
82
+        uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on');
88 83
         
89
-    studymenu = uimenu(frame,'Label','change Study','Enable','on');
90
-        fillStudyMenu(studymenu);
91
-    
92
-    cbSwitchTask(0,0,'PRE',task,model1);
84
+    studySelectMenu = uimenu(frame,'Label','Study ...','Enable','on');
85
+        uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model});
86
+        fillStudyMenu(studySelectMenu,model);
87
+        
88
+    updateMenu = uimenu(frame,'Label','update ...','Enable','off');
89
+        uimenu(updateMenu,'Label','scan dirs','Callback',{@ssss,studySelectMenu});
90
+        
91
+%     newStudyMenu = uimenu(frame,'Label','new Study','Enable','on');
93 92
 
93
+    load_study([getPreviousStudyID '.mat'],model);
94
+    cbSwitchTask(0,0,'PRE',task);
94 95
     set(frame,'Visible','on');
95 96
 
96 97
 end
97 98
 
98
-function fillStudyMenu(studymenu)
99
-    studydir = fullfile(getTbxPath,'study');
100
-    files = dir(studydir);
101
-    for fileidx = 1: numel(files)
102
-        if ~files(fileidx).isdir
103
-            uimenu(studymenu,'Label',files(fileidx).name,'Callback',{@mcb_load_study,fullfile(studydir,files(fileidx).name)});
104
-        end
105
-    end
106
-end
107
-
108
-function model = createFirstStepPanel(model,parent,DEFAULT)
99
+%%%%% ui elements
100
+function model = createFirstStepPanel(model,parent)
109 101
 
110 102
     main_grid = cell(2,4);
111 103
     main_grid{1,1} = [0 0.7 0.4 0.3];
... ...
@@ -122,16 +114,15 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
122 114
     set(pSubject,'Title','Subjects');
123 115
     set(pSubject,'BackgroundColor','w');
124 116
     
125
-    subjectList = {'DUMMY Subj1','DUMMY Subj2','DUMMY Subj3','DUMMY Subj4'};
117
+%     subjectNames = listDirNames(getBaseDir(model));
126 118
     model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
127 119
                     'Min',1, 'Max',3,...
128
-                    'String',subjectList,...
129
-                    'UserData',subjectList,...
130 120
                     'Units','normalized',...
131 121
                     'Position',[0 0 1 1]);
132 122
     set(model.subjectSelector, 'FontName', 'FixedWidth');
133 123
     set(model.subjectSelector,'BackgroundColor','w');
134
-    
124
+
125
+  
135 126
     %Classes
136 127
     pClasses = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,2)));
137 128
     set(pClasses,'Title','Class Definitions');
... ...
@@ -143,9 +134,9 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
143 134
             'Position',[0 0.8 1 0.2]);
144 135
         set(lClassDef,'BackgroundColor','w');
145 136
         set(lClassDef,'HorizontalAlignment','left');
137
+
146 138
         
147 139
         model.txtClassDef = uicontrol(pClasses,'Style','edit',...
148
-            'String',sprintf(DEFAULT.classdefstring),...
149 140
             'Units','normalized',...
150 141
             'Position',[0 0 1 0.8]);
151 142
         set(model.txtClassDef,'HorizontalAlignment','left');
... ...
@@ -189,16 +180,16 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
189 180
 
190 181
         lStart      = createLabel(pPSTH, cell2mat(tl_grid(2,1)) ,'Start [sec]');
191 182
         lEnd        = createLabel(pPSTH, cell2mat(tl_grid(3,1)) ,'End [sec]');
192
-        lPSTH       = createLabel(pPSTH, cell2mat(tl_grid(1,2)),'PSTH Range');
193
-        lBaseline   = createLabel(pPSTH, cell2mat(tl_grid(1,3)),'Baseline');
194
-        lTRF        = createLabel(pPSTH, cell2mat(tl_grid(1,5)),'TR Factor');
195
-
196
-        model.txtPSTHStart         = createTextField(pPSTH,cell2mat(tl_grid(2,2)),DEFAULT.pststart);
197
-        model.txtPSTHEnd           = createTextField(pPSTH,cell2mat(tl_grid(3,2)),DEFAULT.pstend);
198
-        model.txtBaselineStart     = createTextField(pPSTH,cell2mat(tl_grid(2,3)),DEFAULT.baselinestart);
199
-        model.txtBaselineEnd       = createTextField(pPSTH,cell2mat(tl_grid(3,3)),DEFAULT.baselineend);
200
-        model.txtTrFactor          = createTextField(pPSTH,cell2mat(tl_grid(2,5)),DEFAULT.trfactor);
201
-        model.labelTR              = createTextField(pPSTH, cell2mat(tl_grid(3,5)),'');
183
+        lPSTH       = createLabel(pPSTH, cell2mat(tl_grid(1,2)) ,'PSTH Range');
184
+        lBaseline   = createLabel(pPSTH, cell2mat(tl_grid(1,3)) ,'Baseline');
185
+        lTRF        = createLabel(pPSTH, cell2mat(tl_grid(1,5)) ,'TR Factor');
186
+
187
+        model.txtPSTHStart         = createTextField(pPSTH,cell2mat(tl_grid(2,2)),'');
188
+        model.txtPSTHEnd           = createTextField(pPSTH,cell2mat(tl_grid(3,2)),'');
189
+        model.txtBaselineStart     = createTextField(pPSTH,cell2mat(tl_grid(2,3)),'');
190
+        model.txtBaselineEnd       = createTextField(pPSTH,cell2mat(tl_grid(3,3)),'');
191
+        model.txtTrFactor          = createTextField(pPSTH,cell2mat(tl_grid(2,5)),'');
192
+        model.labelTR              = createTextField(pPSTH,cell2mat(tl_grid(3,5)),'');
202 193
         
203 194
         % images
204 195
         pImage = uipanel(parent,'Title','Image Options','Position',cell2mat(main_grid(2,2)));
... ...
@@ -206,22 +197,16 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
206 197
 
207 198
         createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base');
208 199
         
209
-        imageRegExList = {'DUMMY f*.IMG','DUMMY swrf*.IMG','DUMMY wrf*.IMG'};
210 200
         model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',...
211 201
         'Units','normalized',...
212
-        'Position',[0.0 0.0 1 0.5],...
213
-        'String',imageRegExList,...
214
-        'UserData',imageRegExList,...
215
-        'Value',1);
202
+        'Position',[0.0 0.0 1 0.5]);
216 203
         set(model.imageTypeSelection,'BackgroundColor','w');
217 204
         
218
-        
219 205
         % coordinate Table
220 206
         pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
221 207
         set(pVoxel,'BackgroundColor','w');
222 208
         lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];');
223
-        model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],...
224
-            sprintf(DEFAULT.voxelstring));
209
+        model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],'');
225 210
         set(model.txtVoxelDef,'HorizontalAlignment','left');
226 211
         set(model.txtVoxelDef,'Max',20);
227 212
         set(model.txtVoxelDef,'Min',0);
... ...
@@ -232,23 +217,23 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
232 217
         set(pNorm,'BackgroundColor','w');
233 218
         
234 219
         createLabel(pNorm,[0 0.75 1 0.25],'psth norm4SVM');
220
+        
221
+        
235 222
         norm1Model = {'none','mean','minmax'};
223
+
224
+        
236 225
         model.selNormPST = uicontrol(pNorm,'Style','popupmenu',...
237 226
             'Units','normalized',...
238 227
             'Position',[0.0 0.5 1 0.25],...
239 228
             'String',norm1Model,...
240
-            'UserData',norm1Model,...
241
-            'Value',2);
229
+            'UserData',norm1Model);
242 230
          set(model.selNormPST,'BackgroundColor','w');   
243 231
         
244
-%         createLabel(pNorm,[0 0.25 1 0.25],'Col Bias removal');
245
-%         norm2Model = {'on','off'};
246 232
         model.chkColBias = uicontrol(pNorm,'Style','checkbox',...
247 233
             'Units','normalized',...
248 234
             'Position',[0.0 0.1 1 0.25],...
249 235
             'String','column Bias removal',...
250
-            'Enable','on',...
251
-            'Value',1);
236
+            'Enable','on');
252 237
          set(model.chkColBias,'BackgroundColor','w');   
253 238
         
254 239
         %buttons
... ...
@@ -271,7 +256,7 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
271 256
         set(btnRunButton3,'Enable','on');
272 257
 end
273 258
 
274
-function model = createSecondStepPanel(model,parent,DEFAULT)
259
+function model = createSecondStepPanel(model,parent)
275 260
 basecolor = 'w';
276 261
 
277 262
 pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]);
... ...
@@ -295,25 +280,25 @@ pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]);
295 280
     lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Frame Shift');
296 281
     lFramsSize  = createLabel(pTime, cell2mat(time_grid(1,3)),'Frame Size');
297 282
     
298
-    model.txtFrameShiftStart   = createTextField(pTime,cell2mat(time_grid(2,2)),DEFAULT.frameshiftstart);
299
-    model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),DEFAULT.frameshiftend);
300
-    model.txtFrameShiftDur     = createTextField(pTime,cell2mat(time_grid(2,3)),DEFAULT.frameshiftdur);
283
+    model.txtFrameShiftStart   = createTextField(pTime,cell2mat(time_grid(2,2)),'');
284
+    model.txtFrameShiftEnd     = createTextField(pTime,cell2mat(time_grid(3,2)),'');
285
+    model.txtFrameShiftDur     = createTextField(pTime,cell2mat(time_grid(2,3)),'');
301 286
 
302 287
     
303 288
 pSVM = uipanel(parent,'Units','normalized','Position',[0 0.4 0.5 0.4]);
304 289
     set(pSVM,'Title','SVM Classification');
305 290
     set(pSVM,'BackgroundColor',basecolor);
306 291
 
307
-    model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],DEFAULT.svmoptstring);
292
+    model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],'');
308 293
     set(model.txtSVMopts,'HorizontalAlignment','left');
309 294
     
310
-    model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],DEFAULT.svmnfold);
295
+    model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],'');
311 296
     createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
312 297
     
313 298
     model.chkSVMrnd = uicontrol(pSVM,'Style','checkbox','Units','normalized','Position',[0.1 0.50 0.9 0.16]);
314 299
     set(model.chkSVMrnd,'String','Randomize Datapoints');
315 300
     set(model.chkSVMrnd,'BackgroundColor','w');
316
-    set(model.chkSVMrnd,'Value',DEFAULT.svmrnd);
301
+%     set(model.chkSVMrnd,'Value',StudyArgs.svmrnd);
317 302
     
318 303
     btnRunSVM = uicontrol(pSVM,'String','run batchmode SVM Crossvalidation',...
319 304
         'Units','normalized',...
... ...
@@ -330,21 +315,19 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]);
330 315
     set(pSOM,'BackgroundColor',basecolor);
331 316
 
332 317
     createLabel(pSOM,[0 0.75 0.3 0.20],'Size:');
333
-    model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],DEFAULT.somM);
318
+    model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],'');
334 319
     somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.20],'x');
335 320
     set(somsizemal,'HorizontalAlignment','center');
336
-    model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],DEFAULT.somN);
337
- 
321
+    model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],'');
338 322
     latticeModel = {'rect','hexa'};
339 323
     model.selSomLattice = uicontrol(pSOM,'Style','popupmenu',...
340 324
         'Units','normalized',...
341 325
         'Position',[0.0 0.5 0.3 0.20],...
342 326
         'String',latticeModel,...
343
-        'UserData',latticeModel,...
344
-        'Value',1);
327
+        'UserData',latticeModel);
345 328
     set(model.selSomLattice,'BackgroundColor','w');
346 329
 
347
-    model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],DEFAULT.svmnfold);
330
+    model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],'');
348 331
 %     set(model.txtSOMnfold,'Enable','off');
349 332
     createLabel(pSOM,[0.75 0.5 0.25 0.20 ],'-Fold CrossVal');
350 333
        
... ...
@@ -364,10 +347,10 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3])
364 347
     set(pSearchlight,'BackgroundColor',basecolor);
365 348
     
366 349
     lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius');
367
-    model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],DEFAULT.searchlightradius);
350
+    model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],'');
368 351
     
369 352
     lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')');
370
-    model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],DEFAULT.searchlightTimeline);
353
+    model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],'');
371 354
 
372 355
     btnRunFBS = uicontrol(pSearchlight,'String','run Spatiotemporal FB classification',...
373 356
         'Units','normalized',...
... ...
@@ -383,7 +366,7 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3])
383 366
     set(btnRunFBS, 'Callback',{@cbRunDecode,model,'FBS'});
384 367
 end
385 368
 
386
-function model = createVisualStepPanel(model,parent,DEFAULT)
369
+function model = createVisualStepPanel(model,parent)
387 370
 
388 371
     grid_h = 0.25;
389 372
     grid_w = 0.5;
... ...
@@ -420,30 +403,25 @@ function model = createVisualStepPanel(model,parent,DEFAULT)
420 403
     
421 404
 end
422 405
 
406
+%%%%% ui callbacks
423 407
 
424
-function cbSwitchTask(src,evnt,task,taskpanel,model)
408
+function cbSwitchTask(src,evnt,task,taskpanel)
425 409
 set(taskpanel.preprocessing,'Visible','off');
426 410
 set(taskpanel.classification,'Visible','off');
427 411
 set(taskpanel.plot,'Visible','off');
428
-
429 412
 switch task
430 413
     case 'PRE'
431 414
         set(taskpanel.preprocessing,'Visible','on');
432 415
 
433
-
434 416
     case 'CLASSIFY'
435 417
         set(taskpanel.classification,'Visible','on');
436 418
 
437 419
     case 'PLOT'
438 420
         set(taskpanel.plot,'Visible','on');
439
-        
440 421
 end
441
-
442
-assignin('base','model',model);
443
-
422
+% assignin('base','model',model);
444 423
 end
445 424
 
446
-
447 425
 function cbRunPreprocessing(src,evnt,model,task)
448 426
 main(model,'pre',task);
449 427
 end
... ...
@@ -456,51 +434,23 @@ function cbPlot(src,evnt,model,type)
456 434
 main(model,'plot',type);
457 435
 end
458 436
 
459
-function default = mcb_load_study(src,evnt,studyfile)
460
-    default = load(studyfile);
461
-end
437
+%%%%%%%%%% menu callbacks
462 438
 
463
-function model = mcb_cd(src,evnt,model)
464
-disp('CD');
465
-directory_name = uigetdir(model.baseDir,'Select Study Base Directory ...');
466
-model.baseDir = directory_name;
467
-model = scanDirs(model);
439
+function mcb_save(src,evnt,model)
440
+studyID = get(model.txtStudyID,'String');
441
+saveStudy(studyID,model);
468 442
 end
469 443
 
470
-function mcb_save(src,evnt,model)
471
-disp('SAVE');
472
-baseDir  = model.baseDir;
473
-timeLine = getTimeLineParams(model);
474
-classDefString = getClassDefString(model);
475
-coordDefString = getCoordDefString(model);
476
-
477
-[file path] = uiputfile('*.mat','Save current Params ...',model.baseDir);
478
-save( fullfile(path,file),'baseDir','timeLine','classDefString','coordDefString') ;
444
+function mcb_new_study(src,evnt,studymenu,uimodel)
445
+display('CREATE STUDY');
446
+    ui_createStudy(studymenu,uimodel);
479 447
 end
480 448
 
481
-function model = mcb_load(src,evnt,model)
482
-disp('LOAD');
483
-[file path] = uigetfile('*.mat','Load Params ...',model.baseDir);
484
-l = load(fullfile(path,file));
485
-% assignin('base','l',l);
486
-model = setTimeLineParams(model,l.timeLine);
487
-model = setClassDefString(model,l.classDefString);
488
-model = setCoordDefString(model,l.coordDefString);
489
-model.baseDir = l.baseDir;
490
-model = scanDirs(model);
491 449
 
492
-end
493 450
 
494
-function label = createLabel(parent,  pos, labelText)
495
-    label = uicontrol(parent,'Style','text','Units','normalized','String',labelText,'Position',pos);
496
-    set(label,'HorizontalAlignment','left');
497
-    set(label,'BackgroundColor','w');
498
-end
499 451
 
500
-function txt = createTextField(parent,pos,model)
501
-%     textfieldcolor = [0.9 0.9 0.0];
502
-    textfieldcolor = 'w';
503
-    txt = uicontrol(parent,'Style','edit','Units','normalized','String',model,'Position',pos);
504
-    set(txt,'BackgroundColor',textfieldcolor);
505
-end
452
+
453
+
454
+
455
+
506 456
 
Browse code

works with toolbox

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

Christoph Budziszewski authored on22/05/2009 11:27:08
Showing1 changed files
... ...
@@ -16,7 +16,7 @@ function ui_main(varargin)
16 16
 
17 17
     task = struct;
18 18
     
19
-    DEFAULT = mcb_load_study(0,0,'study/stimolos.mat');
19
+    DEFAULT = mcb_load_study(0,0,fullfile(getTbxPath,'study/stimolos.mat'));
20 20
     
21 21
     model1 = struct;
22 22
     model1.baseDir = DEFAULT.wd;
Browse code

spm2 compatibility, start change study

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

Christoph Budziszewski authored on22/05/2009 11:16:41
Showing1 changed files
... ...
@@ -1,31 +1,5 @@
1 1
 function ui_main(varargin)
2 2
 
3
-DEFAULT.selectedSubject = [1];
4
-
5
-DEFAULT.pststart        = -5;
6
-DEFAULT.pstend          = 40;
7
-DEFAULT.baselinestart   = 0;
8
-DEFAULT.baselineend     = 0;
9
-DEFAULT.trfactor        = 0.5;
10
-DEFAULT.frameshiftstart = -5;
11
-DEFAULT.frameshiftend   = 15;
12
-DEFAULT.frameshiftdur   = 0;
13
-DEFAULT.classdefstring  = 'A,\t[9,11]\nB,\t[13,14]';
14
-DEFAULT.voxelstring     = 'SPL l + 3 \nSPL r + 3\n';
15
-DEFAULT.svmoptstring    = '-s 0 -t 0 -c 1';
16
-DEFAULT.svmnfold        = '6';
17
-DEFAULT.svmrnd          = 1;
18
-DEFAULT.searchlightradius = 3;
19
-DEFAULT.searchlightTimeline = '';
20
-DEFAULT.somM = 3;
21
-DEFAULT.somN = 3;
22
-DEFAULT.somLattice = 1;
23
-
24
-
25
-DEFAULT.wd  = fullfile('d:','Analyze','Stimolos');
26
-% DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
27
-% DEFAULT.wd  = fullfile('/','media','fMRI');
28
-
29 3
 %  Initialize and hide the GUI as it is being constructed.
30 4
     frameWidth=450;
31 5
     frameHeight=450;
... ...
@@ -42,6 +16,8 @@ DEFAULT.wd  = fullfile('d:','Analyze','Stimolos');
42 16
 
43 17
     task = struct;
44 18
     
19
+    DEFAULT = mcb_load_study(0,0,'study/stimolos.mat');
20
+    
45 21
     model1 = struct;
46 22
     model1.baseDir = DEFAULT.wd;
47 23
 
... ...
@@ -110,15 +86,25 @@ DEFAULT.wd  = fullfile('d:','Analyze','Stimolos');
110 86
         uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model1},'Enable','off');
111 87
         uimenu(savemenu,'Label','Load All','Callback',{@mcb_load,model1},'Enable','off');
112 88
         
113
-    uimenu(frame,'Label','change Study','Callback',{@mcb_cd,model1},'Enable','off');
89
+    studymenu = uimenu(frame,'Label','change Study','Enable','on');
90
+        fillStudyMenu(studymenu);
114 91
     
115 92
     cbSwitchTask(0,0,'PRE',task,model1);
116 93
 
117
-
118 94
     set(frame,'Visible','on');
119 95
 
120 96
 end
121 97
 
98
+function fillStudyMenu(studymenu)
99
+    studydir = fullfile(getTbxPath,'study');
100
+    files = dir(studydir);
101
+    for fileidx = 1: numel(files)
102
+        if ~files(fileidx).isdir
103
+            uimenu(studymenu,'Label',files(fileidx).name,'Callback',{@mcb_load_study,fullfile(studydir,files(fileidx).name)});
104
+        end
105
+    end
106
+end
107
+
122 108
 function model = createFirstStepPanel(model,parent,DEFAULT)
123 109
 
124 110
     main_grid = cell(2,4);
... ...
@@ -470,6 +456,9 @@ function cbPlot(src,evnt,model,type)
470 456
 main(model,'plot',type);
471 457
 end
472 458
 
459
+function default = mcb_load_study(src,evnt,studyfile)
460
+    default = load(studyfile);
461
+end
473 462