07662323fba6e78914c6c57228dd116276b8a9ca
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

1) function main_UI(args)
2) 
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

3) global CROSSVAL_METHOD_DEF;
4) 
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

5) %     project = args.project;
6) %     DEFAULT = project.default;
7) 
Christoph Budziszewski moving things to private, s...

Christoph Budziszewski authored 15 years ago

8)     % DELETE THIS when Project chooser is ready
Christoph Budziszewski transport changes

Christoph Budziszewski authored 15 years ago

9)  
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

10) DEFAULT.selectedSubject = 1;
11) DEFAULT.smoothed        = 1;
12) DEFAULT.multisubject    = 'single';
13) DEFAULT.pststart        = -15;
14) DEFAULT.pstend          = 40;
15) DEFAULT.baselinestart   = -3;
16) DEFAULT.baselineend     = -1;
17) DEFAULT.frameshiftstart = -5;
18) DEFAULT.frameshiftend   = 35;
19) DEFAULT.frameshiftdur   = 0;
20) DEFAULT.classdefstring  = 'left,\t[9,11,13],\t -2 ;\nright,\t[10,12,14],\t -1;';
21) DEFAULT.voxelstring     = 'SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n';
22) DEFAULT.svmoptstring    = '-s 0 -t 0 -v 6 -c 1';
23)     % STOP DELETE HERE
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

24) 
25) %  Initialize and hide the GUI as it is being constructed.
26)     frameWidth=450;
27)     frameHeight=600;
28)     frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
29)     movegui(frame,'west'); % get this thing visible on smaller displays.
30)     
31)     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
32)     set(frame,'NumberTitle','off');
33)     set(frame,'MenuBar','none');
34)     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
35)     set(frame,'Resize','off');
36)     set(frame,'Units','normalize');
37)     
38)     
39)     savemenu = uimenu(frame,'Label','Save/Load');
40)     
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

41) %     model.subjectMap = SubjectRoiMapping(project);
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

42)     model.subjectMap = SubjectRoiMapping;
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

43)     
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

44)     nElementRows = 24;
45)     optionLineHeight = 1.0/nElementRows;
46)     controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
47)     pSubject     = uipanel(frame,'Title','Subject',          'Position',[0 optionLineHeight*19 frameWidth optionLineHeight*5]);
48)     pPSTH        = uipanel(frame,'Title','PSTH Options',     'Position',[0 optionLineHeight*14 frameWidth optionLineHeight*5]); 
49)     pCLASS       = uipanel(frame,'Title','Class Definitions','Position',[0 optionLineHeight*9  frameWidth optionLineHeight*5]); 
50)     pVOXEL       = uipanel(frame,'Title','Voxel Selector',   'Position',[0 optionLineHeight*3  frameWidth optionLineHeight*6]); 
51)     pSVM         = uipanel(frame,'Title','SVM Options',      'Position',[0 optionLineHeight*1  frameWidth optionLineHeight*2]); 
52)     btnRunButton = uicontrol(frame,'Tag','run','String','run decode-performance visualiser','Position',[2 optionLineHeight*0  frameWidth controlElementHeight*1.6]);
53) 
54) 
55)     % Subject
56)     firstColumn  =  5.00;
57)     firstRow     =  1.00 * controlElementHeight;
58)     
59)     model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
60)                     'Min',1, 'Max',3,...
61)                     'String',getSubjectCellList(model.subjectMap),...
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

62)                     'Value',DEFAULT.selectedSubject,...  % default selected item
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

63)                     'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
64)     set(model.subjectSelector,'BackgroundColor','w');
65)     
Christoph Budziszewski added 2nd classification me...

Christoph Budziszewski authored 15 years ago

66)     model.chkSmoothed     = uicontrol(pSubject,'Style','checkbox','Position',[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'Value',DEFAULT.smoothed);
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

67)     createLabel(pSubject,[0.75*frameWidth firstRow  0.25*frameWidth controlElementHeight],'Smooth Data?');
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

68) 
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

69)     createLabel(pSubject,[0.68*frameWidth firstRow*4  0.25*frameWidth controlElementHeight],'Analysis Method');
70)     
71)     model.analysisMethodSelector = uicontrol(pSubject,'Style','popupmenu',...
72)         'Position',[0.68*frameWidth firstRow*3  0.25*frameWidth controlElementHeight],...
73)         'String',{CROSSVAL_METHOD_DEF.svmcrossval, CROSSVAL_METHOD_DEF.classPerformance},...
74)         'Value',1);
75)     set(model.analysisMethodSelector,'BackgroundColor','w');
76) %     set(model.analysisMethodSelector,'enable','off');
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

77) 
78)     % PSTH
79)     firstColumn  = 5.00;
80)     secondColumn = 0.33*frameWidth;
81)     thirdColumn  = 0.66*frameWidth;
82) %     fourthColumn = 0.84*frameWidth;
83)     
84)     firstRow    = 5.5*controlElementHeight;
85)     secondRow   = 4.5*controlElementHeight;
86)     thirdRow    = 3.5*controlElementHeight;
87)     fourthRow   = 2.5*controlElementHeight;
88)     fifthRow    = 1.0*controlElementHeight;
89)     
90)     lStart      = createLabel(pPSTH, [secondColumn firstRow  0.33*frameWidth controlElementHeight],'Start [sec]');
91)     lEnd        = createLabel(pPSTH, [thirdColumn  firstRow  0.33*frameWidth controlElementHeight],'End [sec]');
92)     lPSTH       = createLabel(pPSTH, [firstColumn  secondRow 0.33*frameWidth controlElementHeight],'PSTH Range');
93)     lBaseline   = createLabel(pPSTH, [firstColumn  thirdRow  0.33*frameWidth controlElementHeight],'Baseline');
94)     lFrameShift = createLabel(pPSTH, [firstColumn  fourthRow 0.33*frameWidth controlElementHeight],'SVM Frame Shift');
95)     lFramsSize  = createLabel(pPSTH, [firstColumn  fifthRow  0.33*frameWidth controlElementHeight],'SVM Frame Size');
96)     
97)     
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

98)     model.txtPSTHStart       = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],DEFAULT.pststart);
99)     model.txtPSTHEnd         = createTextField(pPSTH,[thirdColumn  secondRow 0.25*frameWidth controlElementHeight],DEFAULT.pstend);
100)     model.txtBaselineStart   = createTextField(pPSTH,[secondColumn thirdRow  0.25*frameWidth controlElementHeight],DEFAULT.baselinestart);
101)     model.txtBaselineEnd     = createTextField(pPSTH,[thirdColumn  thirdRow  0.25*frameWidth controlElementHeight],DEFAULT.baselineend);
102)     model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],DEFAULT.frameshiftstart);
103)     model.txtFrameShiftEnd   = createTextField(pPSTH,[thirdColumn  fourthRow 0.25*frameWidth controlElementHeight],DEFAULT.frameshiftend);
104)     model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],DEFAULT.frameshiftdur);
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

105) 
106)                 
107)     %Classes
108)     nClassRows = 6;
109)     firstColumn  = 5.00;
110)     
111)     firstRow    = (nClassRows-0.5)*controlElementHeight;
112)     secondRow   = (nClassRows-4.5)*controlElementHeight;
113) 
114)     lClassDef = createLabel(pCLASS, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;');
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

115)     model.txtClassDef = createTextField(pCLASS,[firstColumn secondRow 0.98*frameWidth 4*controlElementHeight],sprintf(DEFAULT.classdefstring));
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

116)     set(model.txtClassDef,'HorizontalAlignment','left');
117)     set(model.txtClassDef,'Max',20);
118)     set(model.txtClassDef,'Min',0);
119)     set(model.txtClassDef, 'FontName', 'FixedWidth')
120)     
121)     %Voxel
122)     nVoxelRows = 8;
123)     firstColumn  = 5.00;
124)     
125)     firstRow    = (nVoxelRows-0.5)*controlElementHeight;
126)     secondRow   = (nVoxelRows-7.5)*controlElementHeight;
127) 
128)     lVoxelDef = createLabel(pVOXEL, [firstColumn firstRow  0.66*frameWidth controlElementHeight],'<ROI Name>,<ROI Modifier>;');
129)     model.txtVoxelDef = createTextField(pVOXEL,[firstColumn secondRow 0.98*frameWidth 6*controlElementHeight],...
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

130)         sprintf(DEFAULT.voxelstring));
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

131)     set(model.txtVoxelDef,'HorizontalAlignment','left');
132)     set(model.txtVoxelDef,'Max',20);
133)     set(model.txtVoxelDef,'Min',0);
134)     set(model.txtVoxelDef, 'FontName', 'FixedWidth')
135)                 
136)     % SVM
137)     firstColumn  =  5.00;
138)     firstRow     =  1.00 * controlElementHeight;
139) 
Christoph Budziszewski variable DEFAULTS

Christoph Budziszewski authored 15 years ago

140)     model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],DEFAULT.svmoptstring);
Christoph Budziszewski moved UI stuff. new project...

Christoph Budziszewski authored 15 years ago

141)     %model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-s 0 -t 2 -v 6 -c 10 -g .1');
142)     set(model.txtSVMopts,'Enable','on'); %inactive
143)     set(model.txtSVMopts,'HorizontalAlignment','left');
144) 
145)     set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
146)     uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
147)     uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
148) 
149)     set(frame,'Visible','on');
150) end
151) 
152) function mcb_save(src,event,model)
153) display('SAVE');
154) 
155) end
156) 
157) function mcb_load(src,event,model)
158) display('LOAD');
159) end
160) 
161) function sane = isSane(model)
162) % TODO
163) sane = 1;
164) end
165) 
166) function cbRunSVM(src,evnt,model)
167)     display('RUN');
168)     if isSane(model)
Christoph Budziszewski heavy CrossVal Toolbox deve...

Christoph Budziszewski authored 15 years ago

169) %         classify(model)
170)         main('all',model);