4ac11e20dcd3c2e8e24a430db99b4a5bcf711293
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

1) function ui_main(varargin)
2) 
3) DEFAULT.selectedSubject = 1;
4) DEFAULT.smoothed        = 1;
5) DEFAULT.multisubject    = 'single';
6) DEFAULT.pststart        = -15;
7) DEFAULT.pstend          = 40;
8) DEFAULT.baselinestart   = -3;
9) DEFAULT.baselineend     = -1;
10) DEFAULT.frameshiftstart = -5;
11) DEFAULT.frameshiftend   = 35;
12) DEFAULT.frameshiftdur   = 0;
13) DEFAULT.classdefstring  = 'left,\t[9,11,13]\nright,\t[10,12,14]';
14) DEFAULT.voxelstring     = 'SPL l + [ 0, 0, 0] \nSPL r + [ 0, 0, 0]\n';
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

15) DEFAULT.svmoptstring    = '-s 0 -t 0 -c 1';
16) DEFAULT.svmnfold        = '6';
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

17) DEFAULT.searchlightradius = 3;
18) 
19) %  Initialize and hide the GUI as it is being constructed.
20)     frameWidth=450;
21)     frameHeight=600;
22)     
23)     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
24)     movegui(frame,'west'); % get this thing visible on smaller displays.
25)     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
26)     set(frame,'NumberTitle','off');
27)     set(frame,'MenuBar','none');
28)     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

29)     set(frame,'Resize','on');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

30)     set(frame,'Units','normalized');
31) 
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

32)     pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.3 1 0.7]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

33)     set(pFirstStep,'BackgroundColor','w');
34)     set(pFirstStep,'Units','normalized');
35)     
36) 
37)     model = createFirstStepPanel(pFirstStep,DEFAULT);
38)     assignin('base','model',model);
39)     
40)     %Classification Step
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

41)     secondStepBaseColor = 'w';
42)     pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.3]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

43)     set(pSecondStep,'BackgroundColor',secondStepBaseColor);
44) 
45)     
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

46)     model2 = createSecondStepPanel(pSecondStep,DEFAULT,model,secondStepBaseColor);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

47)     assignin('base','model2',model2);
48) 
49)     set(frame,'Visible','on');
50) end
51) 
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

52) function model = createSecondStepPanel(parent,DEFAULT,model1,basecolor)
53)     
54) pSVM = uipanel(parent,'Units','normalized','Position',[0 0.0 0.5 1]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

55)     set(pSVM,'Title','SVM Classification');
56)     set(pSVM,'BackgroundColor',basecolor);
57) 
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

58)     model.txtSVMopts = createTextField(pSVM,[0 0.75 1 0.25],DEFAULT.svmoptstring);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

59)     set(model.txtSVMopts,'HorizontalAlignment','left');
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

60)     
61)     model.txtSVMnfold = createTextField(pSVM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold);
62)     createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
63) 
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

64) 
65)     
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

66) pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 1]);
67)     set(pSOM,'Title','SOM Classification');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

68)     set(pSOM,'BackgroundColor',basecolor);
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

69) 
70)     model.txtSOMopts = createTextField(pSOM,[0 0.75 1 0.25],'4x3 rect');
71)     set(model.txtSOMopts,'HorizontalAlignment','left');
72)         set(model.txtSOMopts,'Enable','off');
73) 
74)     model.txtSOMnfold = createTextField(pSOM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold);
75)         set(model.txtSOMnfold,'Enable','off');
76)     createLabel(pSOM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal');
77) 
78) 
79)     
80)     
81)     btnRunSVM = uicontrol(pSVM,'String','run SVM Crossvalidation',...
82)         'Units','normalized',...
83)         'Position',[0 0.25 1 0.25]);
84)     set(btnRunSVM,'Callback',{@cbRunSVM,model1,model}); % set here, because of model.
85)     
86)     btnRunXSVM = uicontrol(pSVM,'String','run SVM X-Subject validation',...
87)         'Units','normalized',...
88)         'Position',[0 0.0 1 0.25]);
89)     set(btnRunXSVM,'Callback',{@cbRunXSVM,model1,model}); % set here, because of model.
90)     set(btnRunXSVM,'Enable','off');
91)     
92)     btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',...
93)         'Units','normalized',...
94)     'Position',[0.0 0.25 1 0.25]);
95)     set(btnRunSOM,'Callback',{@cbRunSOM,model1,model}); % set here, because of model.
96)     set(btnRunSOM,'Enable','off');
97) 
98)     btnRunXSOM = uicontrol(pSOM,'String','run SOM X-Subject validation',...
99)         'Units','normalized',...
100)         'Position',[0.0 0.0 1 0.25]);
101)     set(btnRunXSOM,'Callback',{@cbRunXSOM,model1,model}); % set here, because of model.
102)     set(btnRunXSOM,'Enable','off');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

103) end
104) 
105) function model = createFirstStepPanel(parent,DEFAULT)
106) 
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

107)     main_grid = cell(2,4);
108)     main_grid{1,1} = [0 0.7 0.4 0.3];
109)     main_grid{1,2} = [0 0.5 0.5 0.2];
110)     main_grid{1,3} = [0 0.1 0.5 0.4];
111)     main_grid{1,4} = [0 0.0 1.0 0.1];
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

112)     
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

113)     main_grid{2,1} = [0.4 0.7 0.6 0.3];
114)     main_grid{2,2} = [0.5 0.5 0.5 0.2];
115)     main_grid{2,3} = [0.5 0.1 0.5 0.4];
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

116)     
117)     %Subjects
118)     subjectList = {'Subj1','Subj2','Subj3','Subj4'};
119)     model.subjectSelector = uicontrol(parent,'Style','listbox',...
120)                     'Min',1, 'Max',3,...
121)                     'String',subjectList,...
122)                     'UserData',subjectList,...
123)                     'Units','normalized',...
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

124)                     'Position',cell2mat(main_grid(1,1)));
125)     set(model.subjectSelector,'BackgroundColor','w');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

126)     
127)     %Classes
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

128)     pClasses = uipanel(parent,'Units','normalized','Position',cell2mat(main_grid(1,2)));
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

129)     set(pClasses,'Title','Class Definitions');
130)     set(pClasses,'BackgroundColor','w');
131)         lClassDef = uicontrol(pClasses,...
132)             'Style','text',...
133)             'String',sprintf('<Label>,\t <[Event, Event, ..]>;'),...
134)             'Units','normalized',...
135)             'Position',[0 0.8 1 0.2]);
136)         set(lClassDef,'BackgroundColor','w');
137)         set(lClassDef,'HorizontalAlignment','left');
138)         
139)         model.txtClassDef = uicontrol(pClasses,'Style','edit',...
140)             'String',sprintf(DEFAULT.classdefstring),...
141)             'Units','normalized',...
142)             'Position',[0 0 1 0.8]);
143)         set(model.txtClassDef,'HorizontalAlignment','left');
144)         set(model.txtClassDef,'Max',20);
145)         set(model.txtClassDef,'Min',0);
146)         set(model.txtClassDef, 'FontName', 'FixedWidth');
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

147)         set(model.txtClassDef, 'BackgroundColor', 'w');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

148) 
149) 
150)     %Timeline
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

151)     pPSTH        = uipanel(parent,'Title','PSTH Options','Position',cell2mat(main_grid(2,1)));
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

152)     set(pPSTH,'BackgroundColor','w');
153)         
154)         grid_h = 0.16;
155)         grid_w = 0.3;
156)         
157)         grid = cell([3 6]);
158)         grid{2,1} = [0.0 0.83 grid_w grid_h];
159)         grid{2,1} = [0.4 0.83 grid_w grid_h];
160)         grid{3,1} = [0.7 0.83 grid_w grid_h];
161)         
162)         grid{1,2} = [0.0 0.66 grid_w grid_h];
163)         grid{2,2} = [0.4 0.66 grid_w grid_h];
164)         grid{3,2} = [0.7 0.66 grid_w grid_h];
165) 
166)         grid{1,3} = [0.0 0.5 grid_w grid_h];
167)         grid{2,3} = [0.4 0.5 grid_w grid_h];
168)         grid{3,3} = [0.7 0.5 grid_w grid_h];
169)         
170)         grid{1,4} = [0.0 0.33 grid_w grid_h];
171)         grid{2,4} = [0.4 0.33 grid_w grid_h];
172)         grid{3,4} = [0.7 0.33 grid_w grid_h];
173) 
174)         grid{1,5} = [0.0 0.16 0.5 grid_h];
175)         grid{2,5} = [0.5 0.16 grid_w grid_h];
176)         grid{3,5} = [0.75 0.16 grid_w grid_h];
177)         
178)         grid{1,6} = [0.0 0.0 0.5 grid_h];
179)         grid{2,6} = [0.5 0.0 grid_w grid_h];
180)         grid{3,6} = [0.75 0.0 grid_w grid_h];
181) 
182)         lStart      = createLabel(pPSTH, cell2mat(grid(2,1)) ,'Start [sec]');
183)         lEnd        = createLabel(pPSTH, cell2mat(grid(3,1)) ,'End [sec]');
184)         lPSTH       = createLabel(pPSTH, cell2mat(grid(1,2)),'PSTH Range');
185)         lBaseline   = createLabel(pPSTH, cell2mat(grid(1,3)),'Baseline');
186)         lFrameShift = createLabel(pPSTH, cell2mat(grid(1,4)),'Frame Shift');
187)         lFramsSize  = createLabel(pPSTH, cell2mat(grid(1,5)),'Frame Size');
188)         lSearchligh = createLabel(pPSTH, cell2mat(grid(1,6)),'Searchlight Radius');
189) 
190) 
191)         model.txtPSTHStart         = createTextField(pPSTH,cell2mat(grid(2,2)),DEFAULT.pststart);
192)         model.txtPSTHEnd           = createTextField(pPSTH,cell2mat(grid(3,2)),DEFAULT.pstend);
193)         model.txtBaselineStart     = createTextField(pPSTH,cell2mat(grid(2,3)),DEFAULT.baselinestart);
194)         model.txtBaselineEnd       = createTextField(pPSTH,cell2mat(grid(3,3)),DEFAULT.baselineend);
195)         model.txtFrameShiftStart   = createTextField(pPSTH,cell2mat(grid(2,4)),DEFAULT.frameshiftstart);
196)         model.txtFrameShiftEnd     = createTextField(pPSTH,cell2mat(grid(3,4)),DEFAULT.frameshiftend);
197)         model.txtFrameShiftDur     = createTextField(pPSTH,cell2mat(grid(2,5)),DEFAULT.frameshiftdur);
198)         model.txtSearchlightRadius = createTextField(pPSTH,cell2mat(grid(2,6)),DEFAULT.searchlightradius);
199)         
200)         % images
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

201)         pImage = uipanel(parent,'Title','Image Options','Position',cell2mat(main_grid(2,2)));
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

202)         set(pImage,'BackgroundColor','w');
203) 
204)         createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base');
205)         
206)         imageRegExList = {'swrf*.IMG','wrf*.IMG'};
207)         model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',...
208)         'Units','normalized',...
209)         'Position',[0.0 0.0 1 0.5],...
210)         'String',imageRegExList,...
211)         'UserData',imageRegExList,...
212)         'Value',1);
213)         set(model.imageTypeSelection,'BackgroundColor','w');
214)         
215)         
216)         % coordinate Table
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

217)         pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3)));
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

218)         set(pVoxel,'BackgroundColor','w');
219)         lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name>+[offset];');
220)         model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],...
221)             sprintf(DEFAULT.voxelstring));
222)         set(model.txtVoxelDef,'HorizontalAlignment','left');
223)         set(model.txtVoxelDef,'Max',20);
224)         set(model.txtVoxelDef,'Min',0);
225)         set(model.txtVoxelDef, 'FontName', 'FixedWidth');
226)         
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

227)         %normalizations
228)         pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3)));
229)         set(pNorm,'BackgroundColor','w');
230)         
231)         createLabel(pNorm,[0 0.75 1 0.25],'PST Normalization');
232)         norm1Model = {'norm A','norm B'};
233)         model.selNormPST = uicontrol(pNorm,'Style','popupmenu',...
234)             'Units','normalized',...
235)             'Position',[0.0 0.5 1 0.25],...
236)             'String',norm1Model,...
237)             'UserData',norm1Model,...
238)             'Value',1);
239)          set(model.selNormPST,'BackgroundColor','w');   
240)         
241)         createLabel(pNorm,[0 0.25 1 0.25],'Class-Grouping Normalization');
242)         norm2Model = {'norm X','norm Y'};
243)         model.selNormClass = uicontrol(pNorm,'Style','popupmenu',...
244)             'Units','normalized',...
245)             'Position',[0.0 0.0 1 0.25],...
246)             'String',norm2Model,...
247)             'UserData',norm2Model,...
248)             'Value',1);
249)          set(model.selNormClass,'BackgroundColor','w');   
250)         
251)         %buttons
252)         pButtons = uipanel(parent,'Position',cell2mat(main_grid(1,4)));
253)         set(pButtons,'BackgroundColor','w');
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

254)         
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

255)         btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
256)             'Units','normalized','Position',[0 0 0.33 1]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

257)         set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model.    
258)         
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

259)         btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight',...
260)             'Units','normalized','Position',[0.33 0 0.33 1]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

261)         set(btnRunButton2,'Callback',{@cbRunFBS,model}); % set here, because of model.    
262)         
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

263)         btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
264)             'Units','normalized','Position',[0.66 0 0.33 1]);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

265)         set(btnRunButton2,'Callback',{@cbRunROIImage,model}); % set here, because of model.    
266)         set(btnRunButton3,'Enable','off');
267) end
268) 
269) function cbRunCoordTable(src,evnt,model)
270)     display('RUN Coord-Table Mode');
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

271)     assignin('base','model1',model);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

272)     main('COORD-LOOKUP-TABLE',model);
273) end
274) function cbRunROIImage(src,evnt,model)
275)     display('RUN Image-Mask Mode');
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

276)     assignin('base','model1',model);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

277)     main('ROI-IMAGE-MASK', model);
278) end
279) function cbRunFBS(src,evnt,model)
280)     display('RUN Full Brain Searchlight Mode');
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

281)     assignin('base','model1',model);
Christoph Budziszewski new GUI. Only Layout. Backe...

Christoph Budziszewski authored 15 years ago

282)     display('not implemented.');
283) end
284) 
285) 
286) function label = createLabel(parent,  pos, labelText)
287)     label = uicontrol(parent,'Style','text','Units','normalized','String',labelText,'Position',pos);
288)     set(label,'HorizontalAlignment','left');
289)     set(label,'BackgroundColor','w');
290) end
291) 
292) function txt = createTextField(parent,pos,model)
Christoph Budziszewski gui finished. callbacks sti...

Christoph Budziszewski authored 15 years ago

293) %     textfieldcolor = [0.9 0.9 0.0];
294)     textfieldcolor = 'w';