Browse code

moved UI stuff. new project structure in the making

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

Christoph Budziszewski authored on 12/01/2009 17:57:09
Showing 4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,167 @@
1
+function main_UI(args)
2
+
3
+
4
+%  Initialize and hide the GUI as it is being constructed.
5
+    frameWidth=450;
6
+    frameHeight=600;
7
+    frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
8
+    movegui(frame,'west'); % get this thing visible on smaller displays.
9
+    
10
+    set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
11
+    set(frame,'NumberTitle','off');
12
+    set(frame,'MenuBar','none');
13
+    set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
14
+    set(frame,'Resize','off');
15
+    set(frame,'Units','normalize');
16
+    
17
+    
18
+    savemenu = uimenu(frame,'Label','Save/Load');
19
+    
20
+    model.subjectMap = SubjectRoiMapping;
21
+    nElementRows = 24;
22
+    optionLineHeight = 1.0/nElementRows;
23
+    controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
24
+    pSubject     = uipanel(frame,'Title','Subject',          'Position',[0 optionLineHeight*19 frameWidth optionLineHeight*5]);
25
+    pPSTH        = uipanel(frame,'Title','PSTH Options',     'Position',[0 optionLineHeight*14 frameWidth optionLineHeight*5]); 
26
+    pCLASS       = uipanel(frame,'Title','Class Definitions','Position',[0 optionLineHeight*9  frameWidth optionLineHeight*5]); 
27
+    pVOXEL       = uipanel(frame,'Title','Voxel Selector',   'Position',[0 optionLineHeight*3  frameWidth optionLineHeight*6]); 
28
+    pSVM         = uipanel(frame,'Title','SVM Options',      'Position',[0 optionLineHeight*1  frameWidth optionLineHeight*2]); 
29
+    btnRunButton = uicontrol(frame,'Tag','run','String','run decode-performance visualiser','Position',[2 optionLineHeight*0  frameWidth controlElementHeight*1.6]);
30
+
31
+
32
+    % Subject
33
+    firstColumn  =  5.00;
34
+    firstRow     =  1.00 * controlElementHeight;
35
+    
36
+    model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
37
+                    'Min',1, 'Max',3,...
38
+                    'String',getSubjectCellList(model.subjectMap),...
39
+                    'Value',5,...  % default selected item
40
+                    'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
41
+    set(model.subjectSelector,'BackgroundColor','w');
42
+    
43
+    model.txtSmoothed     = createTextField(pSubject,[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'1');
44
+    model.txtMultisubject = createTextField(pSubject,[0.68*frameWidth firstRow*2  0.25*frameWidth controlElementHeight],'single');
45
+    set(model.txtMultisubject,'enable','off');
46
+
47
+    % PSTH
48
+    firstColumn  = 5.00;
49
+    secondColumn = 0.33*frameWidth;
50
+    thirdColumn  = 0.66*frameWidth;
51
+%     fourthColumn = 0.84*frameWidth;
52
+    
53
+    firstRow    = 5.5*controlElementHeight;
54
+    secondRow   = 4.5*controlElementHeight;
55
+    thirdRow    = 3.5*controlElementHeight;
56
+    fourthRow   = 2.5*controlElementHeight;
57
+    fifthRow    = 1.0*controlElementHeight;
58
+    
59
+    lStart      = createLabel(pPSTH, [secondColumn firstRow  0.33*frameWidth controlElementHeight],'Start [sec]');
60
+    lEnd        = createLabel(pPSTH, [thirdColumn  firstRow  0.33*frameWidth controlElementHeight],'End [sec]');
61
+    lPSTH       = createLabel(pPSTH, [firstColumn  secondRow 0.33*frameWidth controlElementHeight],'PSTH Range');
62
+    lBaseline   = createLabel(pPSTH, [firstColumn  thirdRow  0.33*frameWidth controlElementHeight],'Baseline');
63
+    lFrameShift = createLabel(pPSTH, [firstColumn  fourthRow 0.33*frameWidth controlElementHeight],'SVM Frame Shift');
64
+    lFramsSize  = createLabel(pPSTH, [firstColumn  fifthRow  0.33*frameWidth controlElementHeight],'SVM Frame Size');
65
+    
66
+    
67
+    model.txtPSTHStart       = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],'-10.0');
68
+    model.txtPSTHEnd         = createTextField(pPSTH,[thirdColumn  secondRow 0.25*frameWidth controlElementHeight],' 40.0');
69
+    model.txtBaselineStart   = createTextField(pPSTH,[secondColumn thirdRow  0.25*frameWidth controlElementHeight],'-3.0');
70
+    model.txtBaselineEnd     = createTextField(pPSTH,[thirdColumn  thirdRow  0.25*frameWidth controlElementHeight],'-1.0');
71
+    model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],'-5.0');
72
+    model.txtFrameShiftEnd   = createTextField(pPSTH,[thirdColumn  fourthRow 0.25*frameWidth controlElementHeight],' 35.0');
73
+    model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],' 0');
74
+
75
+                
76
+    %Classes
77
+    nClassRows = 6;
78
+    firstColumn  = 5.00;
79
+    
80
+    firstRow    = (nClassRows-0.5)*controlElementHeight;
81
+    secondRow   = (nClassRows-4.5)*controlElementHeight;
82
+
83
+    lClassDef = createLabel(pCLASS, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;');
84
+    model.txtClassDef = createTextField(pCLASS,[firstColumn secondRow 0.98*frameWidth 4*controlElementHeight],sprintf('DRT,\t[9,10],\t-2 ;\nM2ST,\t[11,12],\t-1;'));
85
+    set(model.txtClassDef,'HorizontalAlignment','left');
86
+    set(model.txtClassDef,'Max',20);
87
+    set(model.txtClassDef,'Min',0);
88
+    set(model.txtClassDef, 'FontName', 'FixedWidth')
89
+    
90
+    %Voxel
91
+    nVoxelRows = 8;
92
+    firstColumn  = 5.00;
93
+    
94
+    firstRow    = (nVoxelRows-0.5)*controlElementHeight;
95
+    secondRow   = (nVoxelRows-7.5)*controlElementHeight;
96
+
97
+    lVoxelDef = createLabel(pVOXEL, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<ROI Name>,<ROI Modifier>;');
98
+    model.txtVoxelDef = createTextField(pVOXEL,[firstColumn secondRow 0.98*frameWidth 6*controlElementHeight],...
99
+        sprintf('SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n'));
100
+    set(model.txtVoxelDef,'HorizontalAlignment','left');
101
+    set(model.txtVoxelDef,'Max',20);
102
+    set(model.txtVoxelDef,'Min',0);
103
+    set(model.txtVoxelDef, 'FontName', 'FixedWidth')
104
+                
105
+    % SVM
106
+    firstColumn  =  5.00;
107
+    firstRow     =  1.00 * controlElementHeight;
108
+
109
+    model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-s 0 -t 0 -v 6 -c 1');
110
+    %model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-s 0 -t 2 -v 6 -c 10 -g .1');
111
+    set(model.txtSVMopts,'Enable','on'); %inactive
112
+    set(model.txtSVMopts,'HorizontalAlignment','left');
113
+
114
+    set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
115
+    uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
116
+    uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
117
+
118
+    set(frame,'Visible','on');
119
+end
120
+
121
+function mcb_save(src,event,model)
122
+display('SAVE');
123
+
124
+end
125
+
126
+function mcb_load(src,event,model)
127
+display('LOAD');
128
+end
129
+
130
+function sane = isSane(model)
131
+% TODO
132
+sane = 1;
133
+end
134
+
135
+function cbRunSVM(src,evnt,model)
136
+    display('RUN');
137
+    if isSane(model)
138
+        classify(model)
139
+    else
140
+        error('spmtoolbox:SVMCrossVal:paramcheck','please verify all parameters');
141
+    end
142
+end
143
+
144
+    
145
+function label = createLabel(parent,  pos, labelText)
146
+    label = uicontrol(parent,'Style','text','String',labelText,'Position',pos);
147
+    set(label,'HorizontalAlignment','left');
148
+    set(label,'Units','characters');
149
+%     set(label,'BackgroundColor','r');
150
+end
151
+
152
+function btn = createButton(parent,pos,tag,labelText,cbArgs)
153
+    btn = uicontrol(parent,'Position',pos,'String',labelText,'tag',tag);
154
+     set(btn,'Callback',{@cbParseVariable,cbArgs});
155
+%     set(btn,'BackgroundColor','b');
156
+end
157
+
158
+function txt = createTextField(parent,pos,model)
159
+    txt = uicontrol(parent,'Style','edit','String',model,'Position',pos);
160
+    set(txt,'BackgroundColor','w');
161
+end
162
+
163
+function drpField = createDropDown(parent,pos,selectionModel)
164
+ drpField = uicontrol(parent,'Style','popupmenu','Position',pos);
165
+  set(drpField,'String',selectionModel.Strings);
166
+  set(drpField,'BackgroundColor','w');
167
+end
0 168
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+function project_UI(args)
2
+    PROJECTPATH = 'projects';
3
+    
4
+    frameWidth=450;
5
+    frameHeight=50;
6
+    model.frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
7
+    movegui(model.frame,'west'); % get this thing visible on smaller displays.
8
+
9
+    set(model.frame,'Name','SVM CrossVal Decode Performance 4 SPM, Projectchooser');
10
+    set(model.frame,'NumberTitle','off');
11
+    set(model.frame,'MenuBar','none');
12
+    set(model.frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
13
+    set(model.frame,'Resize','off');
14
+    set(model.frame,'Units','normalize');
15
+
16
+    newProjectMenu = uimenu(model.frame,'Label','Define New Project');
17
+    set(newProjectMenu,'Enable','off');
18
+
19
+    d = dir(fullfile(PROJECTPATH,'*.m'));
20
+    
21
+    model.projectSelection = uicontrol(model.frame,'Style','popupmenu',...
22
+                    'String',{d.name},...
23
+                    'Value',1,...  % default selected item
24
+                    'Position',[0.33*frameWidth 40 0.66*frameWidth 20]);
25
+    set(model.projectSelection,'BackgroundColor','w');
26
+    
27
+    
28
+    btnSelectButton = uicontrol(model.frame,'Tag','select','String','continue','Position',[2 0  frameWidth 20]);
29
+    
30
+%    model.projectSelector = 
31
+
32
+	model.val = 1;
33
+
34
+    set(btnSelectButton,'Callback',{@cbChooseProject,model}); % set here, because of model.    
35
+    set(model.frame,'Visible','on');
36
+end
37
+
38
+function cbChooseProject(src,evnts,args)
39
+
40
+	spm_SVMCrossVal(args);
41
+	display(args);
42
+	close(args.frame)
43
+end
0 44
new file mode 100644
... ...
@@ -0,0 +1,145 @@
1
+this = struct;
2
+
3
+this.ID                      = 'Choice24';
4
+this.base_path               = fullfile('D:','Analyze','Choice','24pilot');
5
+
6
+this.default.selectedSubject = 1;
7
+this.default.smoothed        = 1;
8
+this.default.multisubject    = 'single';
9
+this.default.pststart        = -15;
10
+this.default.pstend          = 40;
11
+this.default.baselinestart   = -3;
12
+this.default.baselineend     = -1;
13
+this.default.frameshiftstart = -1;
14
+this.default.frameshiftend   = 35;
15
+this.default.frameshiftdur   = 1;
16
+
17
+% strings are parsed by sprintf!
18
+this.default.classdefstring  = 'left,\t[9,11,13],\t-2 ;\nright,\t[10,12,14],\t-1;';
19
+this.default.voxelstring     = 'SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n';
20
+
21
+% this string is used directly.
22
+this.default.svmoptstring    = '-s 0 -t 0 -v 6 -c 1';
23
+
24
+
25
+% SUBJECT DEFINITIONS
26
+this.subject{1} ='AI020';
27
+this.subject{2} ='BD001';
28
+this.subject{3} ='HG027';
29
+this.subject{4} ='IK011';
30
+this.subject{5} ='JZ006'; % Guter Proband
31
+this.subject{6} ='LB001';
32
+this.subject{7} ='SW007';
33
+this.subject{8} ='VW005';
34
+
35
+this.roi_name{1}  ='SPL l'; % <-Parietalkortex links
36
+this.roi_name{2}  ='SPL r'; % <-Parietalkortex rechts
37
+this.roi_name{3}  ='PMd l';
38
+this.roi_name{4}  ='PMd r';
39
+this.roi_name{5}  ='IPSa l';
40
+this.roi_name{6}  ='IPSa r';
41
+this.roi_name{7}  ='SMA';
42
+this.roi_name{8}  ='DLPFC';
43
+this.roi_name{9}  ='V1 l';
44
+this.roi_name{10} ='V1 r';
45
+this.roi_name{11} ='M1 l'; % <-Motorischer Cortex l
46
+this.roi_name{12} ='M1 r'; % <-Motorischer Cortex r
47
+
48
+
49
+% Koordinaten aller Probanden A von den ROIS B: rois{A}(B,[x y z in mm])
50
+this.coordinate{1}(1,:)  = [-18, -78, 53];
51
+this.coordinate{1}(2,:)  = [12, -69, 46];
52
+this.coordinate{1}(3,:)  = [-21, -12, 49];
53
+this.coordinate{1}(4,:)  = [30, -12, 53];
54
+this.coordinate{1}(5,:)  = [-30, -51, 39];
55
+this.coordinate{1}(6,:)  = [ 33, -60, 49];
56
+this.coordinate{1}(7,:)  = [ -9, 6, 46];
57
+this.coordinate{1}(8,:)  = [-27 27 48];
58
+this.coordinate{1}(9,:)  = [-6, -90, -7];
59
+this.coordinate{1}(10,:) = [12, -90, -4];
60
+this.coordinate{1}(11,:) = [-57, -24, 49];
61
+this.coordinate{1}(12,:) = [42, -24, 60];
62
+this.coordinate{2}(1,:)  = [-9, -72, 56];
63
+this.coordinate{2}(2,:)  = [15, -72, 60];
64
+this.coordinate{2}(3,:)  = [-30, -9, 53];
65
+this.coordinate{2}(4,:)  = [ 30, -9, 49];
66
+this.coordinate{2}(5,:)  = [-42 -36 39];
67
+this.coordinate{2}(6,:)  = [30 -36 42];
68
+this.coordinate{2}(7,:)  = [ -3, 6, 53];
69
+this.coordinate{2}(8,:)  = [-27 30 28];
70
+this.coordinate{2}(9,:)  = [-6, -81, -7];
71
+this.coordinate{2}(10,:) = [9, -78, -7];
72
+this.coordinate{2}(11,:) = [-51, -24, 60];
73
+this.coordinate{2}(12,:) = [48, -21, 63];
74
+this.coordinate{3}(1,:)  = [-15, -72, 60];
75
+this.coordinate{3}(2,:)  = [15, -66, 63];
76
+this.coordinate{3}(3,:)  = [-27, -12, 56];
77
+this.coordinate{3}(4,:)  = [24 -15 53];
78
+this.coordinate{3}(5,:)  = [-36 -36 42];
79
+this.coordinate{3}(6,:)  = [30 -39 35];
80
+this.coordinate{3}(7,:)  = [-9, 3, 53];
81
+this.coordinate{3}(8,:)  = [-30 30 28];
82
+this.coordinate{3}(9,:)  = [-3, -90, 4];
83
+this.coordinate{3}(10,:) = [15, -99, 14];
84
+this.coordinate{3}(11,:) = [-27, -27, 74];
85
+this.coordinate{3}(12,:) = [36, -27, 70];
86
+this.coordinate{4}(1,:)  = [-21, -69, 63];
87
+this.coordinate{4}(2,:)  = [21, -69, 63];
88
+this.coordinate{4}(3,:)  = [-33 -12 53];
89
+this.coordinate{4}(4,:)  = [12 -9 60];
90
+this.coordinate{4}(5,:)  = [-33 -35 46];
91
+this.coordinate{4}(6,:)  = [42 -36 39];
92
+this.coordinate{4}(7,:)  = [-3 0 49];
93
+this.coordinate{4}(8,:)  = [-33 33 28];
94
+this.coordinate{4}(9,:)  = [-3, -90, -7];
95
+this.coordinate{4}(10,:) = [9, -81, -7];
96
+this.coordinate{4}(11,:) = [-39, -27, 53];
97
+this.coordinate{4}(12,:) = [51, -24, 60];
98
+this.coordinate{5}(1,:)  = [-12 -66 63];
99
+this.coordinate{5}(2,:)  = [12, -75, 60];
100
+this.coordinate{5}(3,:)  = [-24, -12, 53];
101
+this.coordinate{5}(4,:)  = [27, -9, 60];
102
+this.coordinate{5}(5,:)  = [-42 -42 35];
103
+this.coordinate{5}(6,:)  = [33 -48 35];
104
+this.coordinate{5}(7,:)  = [ -3, 0, 49];
105
+this.coordinate{5}(8,:)  = [-36 33 28];
106
+this.coordinate{5}(9,:)  = [-15, -93, -4];
107
+this.coordinate{5}(10,:) = [15, -90, 4];
108
+this.coordinate{5}(11,:) = [-39, -33, 67];
109
+this.coordinate{5}(12,:) = [27, -18, 74];
110
+this.coordinate{6}(1,:)  = [-21, -69, 60];
111
+this.coordinate{6}(2,:)  = [9, -72, 63];
112
+this.coordinate{6}(3,:)  = [-24 -12 53];
113
+this.coordinate{6}(4,:)  = [32 -12 56];
114
+this.coordinate{6}(5,:)  = [-36 -39 35];
115
+this.coordinate{6}(6,:)  = [42 -33 46];
116
+this.coordinate{6}(7,:)  = [-6 3 49];
117
+this.coordinate{6}(8,:)  = [-36 33 28];
118
+this.coordinate{6}(9,:)  = [-12, -99, 0];
119
+this.coordinate{6}(10,:) = [9, -96, -7];
120
+this.coordinate{6}(11,:) = [-48, -27, 60];
121
+this.coordinate{6}(12,:) = [33, -33, 60];
122
+this.coordinate{7}(1,:)  = [-21, -60, 56];
123
+this.coordinate{7}(2,:)  = [12, -69, 60];
124
+this.coordinate{7}(3,:)  = [-24, -12, 49];
125
+this.coordinate{7}(4,:)  = [24, -6, 49];
126
+this.coordinate{7}(5,:)  = [-33 -45 46];
127
+this.coordinate{7}(6,:)  = [30, -51, 49];
128
+this.coordinate{7}(7,:)  = [0, 9, 42];
129
+this.coordinate{7}(8,:)  = [-30 36 35];
130
+this.coordinate{7}(9,:)  = [-3, -84, -4];
131
+this.coordinate{7}(10,:) = [18, -87, -7];
132
+this.coordinate{7}(11,:) = [-36, -30, 63];
133
+this.coordinate{7}(12,:) = [42, -27, 60];
134
+this.coordinate{8}(1,:)  = [-27, -63, 53];
135
+this.coordinate{8}(2,:)  = [18, -66, 56];
136
+this.coordinate{8}(3,:)  = [-21, -6, 56];
137
+this.coordinate{8}(4,:)  = [27 -6 53];
138
+this.coordinate{8}(5,:)  = [-36, -51, 49];
139
+this.coordinate{8}(6,:)  = [45, -39, 53];
140
+this.coordinate{8}(7,:)  = [-9, 9, 53];
141
+this.coordinate{8}(8,:)  = [-36 24 25];
142
+this.coordinate{8}(9,:)  = [0, -90, 4];
143
+this.coordinate{8}(10,:) = [0, -90, 4];
144
+this.coordinate{8}(11,:) = [-42, -27, 67];
145
+    this.coordinate{8}(12,:) = [51, -27, 63]; 
... ...
@@ -1,217 +1,15 @@
1 1
 function spm_SVMCrossVal(varargin)
2
-
3 2
 switch nargin
4 3
 case 0
5
-	project_UI();
4
+	project_UI;
6 5
 case 1
7 6
 	main_UI(varargin);
8 7
 otherwise
9 8
 error('spm_SVMCrossVal:main','wrong nargin');
10
-
11 9
 end
12 10
 end
13 11
 
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
-
27
-    newProjectMenu = uimenu(model.frame,'Label','Define New Project');
28
-    set(newProjectMenu,'Enable','off');
29
-
30
-
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)
49
-
50
-
51
-%  Initialize and hide the GUI as it is being constructed.
52
-    frameWidth=450;
53
-    frameHeight=600;
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');
63
-    
64
-    
65
-    savemenu = uimenu(frame,'Label','Save/Load');
66
-    
67
-    model.subjectMap = SubjectRoiMapping;
68
-    nElementRows = 24;
69
-    optionLineHeight = 1.0/nElementRows;
70
-    controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
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]); 
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]);
77
-
78
-
79
-    % Subject
80
-    firstColumn  =  5.00;
81
-    firstRow     =  1.00 * controlElementHeight;
82
-    
83
-    model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
84
-                    'Min',1, 'Max',3,...
85
-                    'String',getSubjectCellList(model.subjectMap),...
86
-                    'Value',5,...  % default selected item
87
-                    'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
88
-    set(model.subjectSelector,'BackgroundColor','w');
89
-    
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');
93
-
94
-    % PSTH
95
-    firstColumn  = 5.00;
96
-    secondColumn = 0.33*frameWidth;
97
-    thirdColumn  = 0.66*frameWidth;
98
-%     fourthColumn = 0.84*frameWidth;
99
-    
100
-    firstRow    = 5.5*controlElementHeight;
101
-    secondRow   = 4.5*controlElementHeight;
102
-    thirdRow    = 3.5*controlElementHeight;
103
-    fourthRow   = 2.5*controlElementHeight;
104
-    fifthRow    = 1.0*controlElementHeight;
105
-    
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');
112
-    
113
-    
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');
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');
119
-    model.txtFrameShiftEnd   = createTextField(pPSTH,[thirdColumn  fourthRow 0.25*frameWidth controlElementHeight],' 35.0');
120
-    model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],' 0');
121
-
122
-                
123
-    %Classes
124
-    nClassRows = 6;
125
-    firstColumn  = 5.00;
126
-    
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>;');
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;'));
132
-    set(model.txtClassDef,'HorizontalAlignment','left');
133
-    set(model.txtClassDef,'Max',20);
134
-    set(model.txtClassDef,'Min',0);
135
-    set(model.txtClassDef, 'FontName', 'FixedWidth')
136
-    
137
-    %Voxel
138
-    nVoxelRows = 8;
139
-    firstColumn  = 5.00;
140
-    
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],...
146
-        sprintf('SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n'));
147
-    set(model.txtVoxelDef,'HorizontalAlignment','left');
148
-    set(model.txtVoxelDef,'Max',20);
149
-    set(model.txtVoxelDef,'Min',0);
150
-    set(model.txtVoxelDef, 'FontName', 'FixedWidth')
151
-                
152
-    % SVM
153
-    firstColumn  =  5.00;
154
-    firstRow     =  1.00 * controlElementHeight;
155 12
 
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');
158
-    set(model.txtSVMopts,'Enable','on'); %inactive
159
-    set(model.txtSVMopts,'HorizontalAlignment','left');
160
-
161
-    set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
162
-    uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
163
-    uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
164
-
165
-    set(frame,'Visible','on');
166
-end
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
-
191
-    
192
-function label = createLabel(parent,  pos, labelText)
193
-    label = uicontrol(parent,'Style','text','String',labelText,'Position',pos);
194
-    set(label,'HorizontalAlignment','left');
195
-    set(label,'Units','characters');
196
-%     set(label,'BackgroundColor','r');
197
-end
198
-
199
-function btn = createButton(parent,pos,tag,labelText,cbArgs)
200
-    btn = uicontrol(parent,'Position',pos,'String',labelText,'tag',tag);
201
-     set(btn,'Callback',{@cbParseVariable,cbArgs});
202
-%     set(btn,'BackgroundColor','b');
203
-end
204
-
205
-function txt = createTextField(parent,pos,model)
206
-    txt = uicontrol(parent,'Style','edit','String',model,'Position',pos);
207
-    set(txt,'BackgroundColor','w');
208
-end
209
-
210
-function drpField = createDropDown(parent,pos,selectionModel)
211
- drpField = uicontrol(parent,'Style','popupmenu','Position',pos);
212
-  set(drpField,'String',selectionModel.Strings);
213
-  set(drpField,'BackgroundColor','w');
214
-end
215 13
 
216 14
 
217 15