Christoph Budziszewski commited on 2008-12-17 17:57:53
Zeige 5 geänderte Dateien mit 98 Einfügungen und 38 Löschungen.
working version git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@92 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... | ... |
@@ -18,9 +18,9 @@ end |
18 | 18 |
evalin('base','clear map lm SPM classList dataTimeLine decodeTable labelTimeLine svmopts trialProtocol voxelList xTimeEnd xTimeStart xTimeWindow'); |
19 | 19 |
|
20 | 20 |
case 'decode' |
21 |
- tmp_sidx = get(paramModel.subjectSelector,'Value'); |
|
22 |
- tmp_cellList = getSubjectCellList(paramModel.subjectMap); |
|
23 |
- SubjectID = cell2mat(tmp_cellList(tmp_sidx)); |
|
21 |
+ |
|
22 |
+ SubjectID = getSubjectIDString(paramModel); |
|
23 |
+ |
|
24 | 24 |
|
25 | 25 |
display('loading SPM.mat'); |
26 | 26 |
% SubjectID = 'JZ006'; |
... | ... |
@@ -32,29 +32,6 @@ end |
32 | 32 |
|
33 | 33 |
|
34 | 34 |
|
35 |
- |
|
36 |
- map = SubjectRoiMapping; |
|
37 |
- |
|
38 |
- voxelList = [... |
|
39 |
- getCoordinate(map,SubjectID,'SPL l')+[0,0,0];... |
|
40 |
- getCoordinate(map,SubjectID,'SPL l')+[1,0,0];... |
|
41 |
- getCoordinate(map,SubjectID,'SPL l')+[-1,0,0];... |
|
42 |
- getCoordinate(map,SubjectID,'SPL l')+[0,1,0];... |
|
43 |
- getCoordinate(map,SubjectID,'SPL l')+[0,-1,0];... |
|
44 |
- getCoordinate(map,SubjectID,'SPL l')+[0,0,1];... |
|
45 |
- getCoordinate(map,SubjectID,'SPL l')+[0,0,-1];... |
|
46 |
- getCoordinate(map,SubjectID,'SPL r')+[0,0,0];... |
|
47 |
- getCoordinate(map,SubjectID,'SPL r')+[1,0,0];... |
|
48 |
- getCoordinate(map,SubjectID,'SPL r')+[-1,0,0];... |
|
49 |
- getCoordinate(map,SubjectID,'SPL r')+[0,1,0];... |
|
50 |
- getCoordinate(map,SubjectID,'SPL r')+[0,-1,0];... |
|
51 |
- getCoordinate(map,SubjectID,'SPL r')+[0,0,1];... |
|
52 |
- getCoordinate(map,SubjectID,'SPL r')+[0,0,-1];... |
|
53 |
- getCoordinate(map,SubjectID,'M1 r')+[0,0,0];... |
|
54 |
- getCoordinate(map,SubjectID,'M1 l')+[0,0,0];... |
|
55 |
- ]; |
|
56 |
- |
|
57 |
- |
|
58 | 35 |
params = struct; |
59 | 36 |
params.nClasses = 2; |
60 | 37 |
|
... | ... |
@@ -64,18 +41,23 @@ end |
64 | 41 |
calculateParams = struct; |
65 | 42 |
|
66 | 43 |
calculateParams.des = spm.SPM; |
67 |
- calculateParams.frameShiftStart = -20; |
|
68 |
- calculateParams.frameShiftEnd = 15; |
|
69 |
- calculateParams.decodeDuration = 0; |
|
70 |
- calculateParams.svmargs = '-t 0 -s 0 -v 6'; |
|
44 |
+ |
|
45 |
+ calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart); % -20; |
|
46 |
+ calculateParams.frameShiftEnd = getDouble(paramModel.txtFrameShiftEnd); %15; |
|
47 |
+ calculateParams.decodeDuration = getDouble(paramModel.txtFrameShiftDur); |
|
48 |
+ calculateParams.psthStart = getDouble(paramModel.txtPSTHStart); % -25; |
|
49 |
+ calculateParams.psthEnd = getDouble(paramModel.txtPSTHEnd); % 20; |
|
50 |
+ calculateParams.baselineStart = getDouble(paramModel.txtBaselineStart); % -22; |
|
51 |
+ calculateParams.baselineEnd = getDouble(paramModel.txtBaselineEnd); % -20; |
|
52 |
+ |
|
53 |
+ calculateParams.voxelList = parseVoxelList(paramModel); |
|
54 |
+ |
|
55 |
+ calculateParams.svmargs = get(paramModel.txtSVMopts,'String'); |
|
71 | 56 |
calculateParams.sessionList = 1:3; |
72 |
- calculateParams.voxelList = voxelList; |
|
57 |
+ |
|
58 |
+% parseClassDef(paramModel) |
|
73 | 59 |
calculateParams.classList = {'<','>'}; |
74 | 60 |
calculateParams.labelMap = LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); |
75 |
- calculateParams.psthStart = -25; |
|
76 |
- calculateParams.psthEnd = 20; |
|
77 |
- calculateParams.baselineStart = -22; |
|
78 |
- calculateParams.baselineEnd = -20; |
|
79 | 61 |
calculateParams.eventList = [9,11,13; 10,12,14]; |
80 | 62 |
|
81 | 63 |
assignin('base','calculateParams',calculateParams); |
... | ... |
@@ -0,0 +1,9 @@ |
1 |
+function s = getSubjectIDString(model) |
|
2 |
+ tmp_sidx = get(model.subjectSelector,'Value'); |
|
3 |
+ tmp_cellList = getSubjectCellList(model.subjectMap); |
|
4 |
+ s = cell2mat(tmp_cellList(tmp_sidx)); |
|
5 |
+ if ~ischar(s) |
|
6 |
+ error('spmtoolbox:SVMCrossVal:getSubjectID:NoString','convert error'); |
|
7 |
+ end |
|
8 |
+end |
|
9 |
+ |
|
0 | 10 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,65 @@ |
1 |
+function voxelList = parseVoxelList(model) |
|
2 |
+ voxelList = []; |
|
3 |
+ |
|
4 |
+ %<ROI Name>,<ROI Modifier>; |
|
5 |
+ txt = get(model.txtVoxelDef,'String'); |
|
6 |
+ map = model.subjectMap; |
|
7 |
+ SubjectID = getSubjectIDString(model); |
|
8 |
+ |
|
9 |
+ assignin('base','txt',txt); |
|
10 |
+ |
|
11 |
+ rows = size(txt,1); |
|
12 |
+ while all(isspace(txt(rows,:))) |
|
13 |
+ rows = rows -1; |
|
14 |
+ end |
|
15 |
+ |
|
16 |
+ for i = 1:rows |
|
17 |
+ line = txt(i,:); |
|
18 |
+ roi = parseROIName(line); |
|
19 |
+ roimod = parseModifier(line); |
|
20 |
+ voxelList = [voxelList; getCoordinate(map,SubjectID,roi)+eval(roimod)]; |
|
21 |
+ end |
|
22 |
+ |
|
23 |
+% voxelList = [... |
|
24 |
+% getCoordinate(map,SubjectID,'SPL l')+[0,0,0];... |
|
25 |
+% getCoordinate(map,SubjectID,'SPL l')+[1,0,0];... |
|
26 |
+% getCoordinate(map,SubjectID,'SPL l')+[-1,0,0];... |
|
27 |
+% getCoordinate(map,SubjectID,'SPL l')+[0,1,0];... |
|
28 |
+% getCoordinate(map,SubjectID,'SPL l')+[0,-1,0];... |
|
29 |
+% getCoordinate(map,SubjectID,'SPL l')+[0,0,1];... |
|
30 |
+% getCoordinate(map,SubjectID,'SPL l')+[0,0,-1];... |
|
31 |
+% getCoordinate(map,SubjectID,'SPL r')+[0,0,0];... |
|
32 |
+% getCoordinate(map,SubjectID,'SPL r')+[1,0,0];... |
|
33 |
+% getCoordinate(map,SubjectID,'SPL r')+[-1,0,0];... |
|
34 |
+% getCoordinate(map,SubjectID,'SPL r')+[0,1,0];... |
|
35 |
+% getCoordinate(map,SubjectID,'SPL r')+[0,-1,0];... |
|
36 |
+% getCoordinate(map,SubjectID,'SPL r')+[0,0,1];... |
|
37 |
+% getCoordinate(map,SubjectID,'SPL r')+[0,0,-1];... |
|
38 |
+% getCoordinate(map,SubjectID,'M1 r')+[0,0,0];... |
|
39 |
+% getCoordinate(map,SubjectID,'M1 l')+[0,0,0];... |
|
40 |
+% ]; |
|
41 |
+ |
|
42 |
+end |
|
43 |
+ |
|
44 |
+function roi = parseROIName(line) |
|
45 |
+c = 1; |
|
46 |
+roi = ''; |
|
47 |
+while line(c)~=',' |
|
48 |
+ roi = [roi line(c)]; |
|
49 |
+ c = c+1; |
|
50 |
+end |
|
51 |
+roi = strtrunc(roi); |
|
52 |
+end |
|
53 |
+ |
|
54 |
+function roimod = parseModifier(line) |
|
55 |
+c = 1; |
|
56 |
+while line(c)~=',' % skip roi |
|
57 |
+ c=c+1; |
|
58 |
+end |
|
59 |
+c=c+1; % skip ',' |
|
60 |
+roimod=''; |
|
61 |
+while line(c) ~= ';' |
|
62 |
+ roimod = [roimod line(c)]; |
|
63 |
+ c = c+1; |
|
64 |
+end |
|
65 |
+end |
... | ... |
@@ -61,9 +61,9 @@ function spm_SVMCrossVal |
61 | 61 |
model.txtBaselineEnd = createTextField(pPSTH,[thirdColumn thirdRow 0.25*frameWidth controlElementHeight],'-20.0'); |
62 | 62 |
model.txtPSTHStart = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],'-25.0'); |
63 | 63 |
model.txtPSTHEnd = createTextField(pPSTH,[thirdColumn secondRow 0.25*frameWidth controlElementHeight],' 20.0'); |
64 |
- model.txtFramsShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],'-20.0'); |
|
65 |
- model.txtFramsShiftEnd = createTextField(pPSTH,[thirdColumn fourthRow 0.25*frameWidth controlElementHeight],' 15.0'); |
|
66 |
- model.txtFramsShiftDur = createTextField(pPSTH,[secondColumn fifthRow 0.25*frameWidth controlElementHeight],' 0'); |
|
64 |
+ model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],'-20.0'); |
|
65 |
+ model.txtFrameShiftEnd = createTextField(pPSTH,[thirdColumn fourthRow 0.25*frameWidth controlElementHeight],' 15.0'); |
|
66 |
+ model.txtFrameShiftDur = createTextField(pPSTH,[secondColumn fifthRow 0.25*frameWidth controlElementHeight],' 0'); |
|
67 | 67 |
|
68 | 68 |
|
69 | 69 |
%Classes |
... | ... |
@@ -143,6 +143,7 @@ function cbRunSVM(src,evnt,model) |
143 | 143 |
if isSane(model) |
144 | 144 |
set(0,'userdata',model); |
145 | 145 |
% set(src,'Enable','off'); |
146 |
+ assignin('base','guiParams',model); |
|
146 | 147 |
classify(model) |
147 | 148 |
% set(src,'Enable','on'); |
148 | 149 |
else |
149 | 150 |