9478fa59f86ee4ada163f394fcc5e141e221b6dd
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

1) function spm_SVMCrossVal
2) 
3) 
4) %  Initialize and hide the GUI as it is being constructed.
5)     frameWidth=450;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

6)     frameHeight=600;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

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');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

16)     
17)     
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

18)     savemenu = uimenu(frame,'Label','Save/Load');
19)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

20)     model.subjectMap = SubjectRoiMapping;
21)     nElementRows = 24;
22)     optionLineHeight = 1.0/nElementRows;
23)     controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight;
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

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]); 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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]);
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

30) 
31) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

32)     % Subject
33)     firstColumn  =  5.00;
34)     firstRow     =  1.00 * controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

35)     
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

36)     model.subjectSelector = uicontrol(pSubject,'Style','listbox',...
37)                     'Min',1, 'Max',3,...
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

38)                     'String',getSubjectCellList(model.subjectMap),...
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

39)                     'Value',5,...  % default selected item
40)                     'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

41)     set(model.subjectSelector,'BackgroundColor','w');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

42)     
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

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');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

46) 
47)     % PSTH
48)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

49)     secondColumn = 0.33*frameWidth;
50)     thirdColumn  = 0.66*frameWidth;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

51) %     fourthColumn = 0.84*frameWidth;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

52)     
53)     firstRow    = 5.5*controlElementHeight;
54)     secondRow   = 4.5*controlElementHeight;
55)     thirdRow    = 3.5*controlElementHeight;
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

56)     fourthRow   = 2.5*controlElementHeight;
57)     fifthRow    = 1.0*controlElementHeight;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

58)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

65)     
66)     
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

67)     model.txtPSTHStart       = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],'-1.0');
68)     model.txtPSTHEnd         = createTextField(pPSTH,[thirdColumn  secondRow 0.25*frameWidth controlElementHeight],' 35.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],' 45.0');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

73)     model.txtFrameShiftDur   = createTextField(pPSTH,[secondColumn fifthRow  0.25*frameWidth controlElementHeight],' 0');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

74) 
75)                 
76)     %Classes
77)     nClassRows = 6;
78)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

79)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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('<,\t[ 9,11,13],\t-2 ;\n>,\t[10,12,14],\t-1;'));
85)     set(model.txtClassDef,'HorizontalAlignment','left');
86)     set(model.txtClassDef,'Max',20);
87)     set(model.txtClassDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

88)     set(model.txtClassDef, 'FontName', 'FixedWidth')
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

89)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

90)     %Voxel
91)     nVoxelRows = 8;
92)     firstColumn  = 5.00;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

93)     
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

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],...
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

99)         sprintf('M1 l,\t[ 0, 0, 0];\nM1 l,\t[ 1, 0, 0];\nM1 l,\t[ 0, 1, 0];\nM1 l,\t[ 0, 0, 1];\n'));
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

100)     set(model.txtVoxelDef,'HorizontalAlignment','left');
101)     set(model.txtVoxelDef,'Max',20);
102)     set(model.txtVoxelDef,'Min',0);
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

103)     set(model.txtVoxelDef, 'FontName', 'FixedWidth')
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

104)                 
105)     % SVM
106)     firstColumn  =  5.00;
107)     firstRow     =  1.00 * controlElementHeight;
108) 
109)     model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow  0.66*frameWidth controlElementHeight],'-t 0 -s 0 -v 6');
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

110)     set(model.txtSVMopts,'Enable','on'); %inactive
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

111)     set(model.txtSVMopts,'HorizontalAlignment','left');
112) 
113)     set(btnRunButton,'Callback',{@cbRunSVM,model}); % set here, because of model.    
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

114)     uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
115)     uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
116) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

117)     set(frame,'Visible','on');
118) end
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

119) 
120) function mcb_save(src,event,model)
121) display('SAVE');
122) 
123) end
124) 
125) function mcb_load(src,event,model)
126) display('LOAD');
127) end
128) 
129) function sane = isSane(model)
130) % TODO
131) sane = 1;
132) end
133) 
134) function cbRunSVM(src,evnt,model)
135)     display('RUN');
136)     if isSane(model)
137)         classify(model)
138)     else
139)         error('spmtoolbox:SVMCrossVal:paramcheck','please verify all parameters');
140)     end
141) end
142) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

143)