GUI Task Switch: selfmade TabbedPanel
Christoph Budziszewski

Christoph Budziszewski commited on 2009-03-16 16:03:31
Zeige 5 geänderte Dateien mit 66 Einfügungen und 26 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@152 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -138,7 +138,6 @@ function pst = calculatePST(timeline,pstopts,data)
138 138
             for ze=1:evntcol % Even COL
139 139
                 if ze==1 || (ze>1 && eventList(zr,ze)~=eventList(zr,ze-1))
140 140
                     n_col=n_col+1;
141
-                    tmp_index=[];
142 141
                     tmp_index=find(pstevnt{zr}(:)==eventList(zr,ze));
143 142
                     % Calculate Average PST for each COL within ROW
144 143
                     pst4col(n_col,:)=nanmean(pst{zr}(tmp_index,:));
... ...
@@ -154,15 +153,9 @@ function pst = calculatePST(timeline,pstopts,data)
154 153
     end;
155 154
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
156 155
     
157
-            
158
-            
159
-    
160
-    
161
-    
162
-    
163 156
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
164 157
 
165
-    norm4SVM='mean'; %Normalization method for SVM
158
+    norm4SVM='minmax'; %Normalization method for SVM
166 159
     disp(['normalization: ' norm4SVM]);   
167 160
     % none - no normalization
168 161
     % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
... ...
@@ -80,7 +80,7 @@ switch task
80 80
         decode = calculateMultiSubjectDecodePerformance(preprocessedData.header,preprocessedData.subjectdata,svmopts);
81 81
         assignin('base','decode',decode);
82 82
     case 'XSVM'
83
-        disp('not implemented')
83
+        disp('XSVM')
84 84
         svmopts  = getSvmArgs(model,0);
85 85
         decode = xsvm_subject_loop(preprocessedData.header,preprocessedData.subjectdata,svmopts);
86 86
         assignin('base','decode',decode);
... ...
@@ -2,8 +2,8 @@ function plotDecodePerformance(header,decode,subjectData)
2 2
 
3 3
 global SVMCROSSVAL_CROSSVAL_METHOD_DEF;
4 4
 
5
-PSTH_AXIS_MIN = -1;
6
-PSTH_AXIS_MAX = 1;
5
+PSTH_AXIS_MIN = -2;
6
+PSTH_AXIS_MAX = 2;
7 7
 
8 8
 timeline = header.timeline;
9 9
 
... ...
@@ -26,7 +26,6 @@ PLOT_METHOD       = 'x-subject-val';
26 26
     f = figure;
27 27
     subplot(2,1,1);
28 28
     hold on;
29
-    size(psth)
30 29
     if (size(psth) > 0)
31 30
       for voxel = 1:size(psth,2)
32 31
           for label = 1:size(psth{voxel},2)
... ...
@@ -19,7 +19,7 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
19 19
 
20 20
 %  Initialize and hide the GUI as it is being constructed.
21 21
     frameWidth=450;
22
-    frameHeight=600;
22
+    frameHeight=450;
23 23
     
24 24
     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
25 25
     movegui(frame,'west'); % get this thing visible on smaller displays.
... ...
@@ -31,6 +31,8 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
31 31
     set(frame,'Units','normalized');
32 32
     set(frame,'Color','y');
33 33
 
34
+    task = struct;
35
+    
34 36
     model = struct;
35 37
     model.baseDir = DEFAULT.wd;
36 38
 
... ...
@@ -38,20 +40,44 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
38 40
     set(model.txtBaseDir,'BackgroundColor','w');
39 41
     set(model.txtBaseDir,'ForegroundColor','b');
40 42
     
41
-    pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.36 1 0.610]);
42
-    set(pFirstStep,'BackgroundColor','w');
43
-    set(pFirstStep,'Units','normalized');
43
+    TASK_HEIGHT = 1-0.13;
44
+    
45
+    % PREPROCESSING
46
+    task.preprocessing   = uipanel(frame,'Title','Preprocessing','Position',[0 0.0 1 TASK_HEIGHT]);
47
+    set(task.preprocessing,'BackgroundColor','w');
48
+    set(task.preprocessing,'Units','normalized');
44 49
     
45 50
     model.selectedSubject = DEFAULT.selectedSubject;
46
-    model = createFirstStepPanel(model,pFirstStep,DEFAULT);
51
+    model = createFirstStepPanel(model,task.preprocessing,DEFAULT);
52
+    
53
+    
54
+    % CLASSIFICATION
55
+    task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]);
56
+    set(task.classification,'BackgroundColor','w');
57
+    model = createSecondStepPanel(model,task.classification,DEFAULT);
47 58
     
48
-    %Classification Step
49
-    secondStepBaseColor = 'w';
50
-    pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0.1 1 0.25]);
51
-    set(pSecondStep,'BackgroundColor',secondStepBaseColor);
59
+    % TASK
60
+    task.taskSwitch = uipanel(frame,'Position',[0 1-0.13 1 0.10]);
61
+%         set(task.taskSwitch,'Title','TASK');
62
+        set(task.taskSwitch,'BackgroundColor','w');
63
+        set(task.taskSwitch,'Units','normalized');
52 64
     
65
+        btnSwitchPreprocessing = uicontrol(task.taskSwitch,'String','ImageProcessing',...
66
+            'Units','normalized','Position',[0.0 0.0 0.33 1]);
67
+        set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task}); 
68
+        set(btnSwitchPreprocessing,'Enable','on');
53 69
 
54
-    model = createSecondStepPanel(model,pSecondStep,DEFAULT,secondStepBaseColor);
70
+        btnSwitchClassify = uicontrol(task.taskSwitch,'String','Decode',...
71
+            'Units','normalized','Position',[0.33 0.0 0.33 1]);
72
+        set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task}); 
73
+        set(btnSwitchClassify,'Enable','on');
74
+
75
+        btnSwitchPlot = uicontrol(task.taskSwitch,'String','Plot',...
76
+            'Units','normalized','Position',[0.66 0.0 0.33 1]);
77
+        set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task}); 
78
+        set(btnSwitchPlot,'Enable','on');
79
+
80
+    % menu
55 81
     
56 82
     savemenu = uimenu(frame,'Label','Save/Load');
57 83
         uimenu(savemenu,'Label','Save Preprocessing Parameter','Callback',{@mcb_save,model});
... ...
@@ -59,10 +85,12 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
59 85
 
60 86
     uimenu(frame,'Label','change Study','Callback',{@mcb_cd,model},'Enable','off');
61 87
     
62
-    set(frame,'Visible','on');
88
+    cbSwitchTask(0,0,'PRE',task);
63 89
 
64 90
     % fill with data
65 91
     model = scanDirs(model);
92
+    set(frame,'Visible','on');
93
+
66 94
     assignin('base','model',model);
67 95
 end
68 96
 
... ...
@@ -236,9 +264,14 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
236 264
         set(btnRunButton3,'Enable','on');
237 265
 end
238 266
 
239
-function model = createSecondStepPanel(model,parent,DEFAULT,basecolor)
267
+function model = createSecondStepPanel(model,parent,DEFAULT)
268
+basecolor = 'w';
240 269
 
241
-pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.5 1]);
270
+pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.3]);
271
+%     set(pTime,'Title','Frameshift Opts');
272
+    set(pTime,'BackgroundColor',basecolor);
273
+    
274
+pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.5 0.7]);
242 275
     set(pSVM,'Title','SVM Classification');
243 276
     set(pSVM,'BackgroundColor',basecolor);
244 277
 
... ...
@@ -248,7 +281,7 @@ pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.5 1]);
248 281
     model.txtSVMnfold = createTextField(pSVM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold);
249 282
     createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
250 283
     
251
-pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 1]);
284
+pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 0.7]);
252 285
     set(pSOM,'Title','SOM Classification');
253 286
     set(pSOM,'BackgroundColor',basecolor);
254 287
 
... ...
@@ -287,6 +320,19 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 1]);
287 320
 end
288 321
 
289 322
 
323
+function cbSwitchTask(src,evnt,task,taskpanel)
324
+set(taskpanel.preprocessing,'Visible','off');
325
+set(taskpanel.classification,'Visible','off');
326
+
327
+switch task
328
+    case 'PRE'
329
+        set(taskpanel.preprocessing,'Visible','on');
330
+    case 'CLASSIFY'
331
+        set(taskpanel.classification,'Visible','on');
332
+    case 'PLOT'
333
+end
334
+end
335
+
290 336
 
291 337
 function cbRunPreprocessing(src,evnt,model,task)
292 338
 main(model,'pre',task);
... ...
@@ -68,4 +68,6 @@ for timeIndex = 1:timeLineEnd-timeLineStart+1
68 68
     decode.decodePerformance = [decode.decodePerformance; cross_value];
69 69
     
70 70
 end
71
+
72
+disp('decode done');
71 73
 end
72 74