Christoph Budziszewski commited on 2009-01-28 14:52:30
Zeige 3 geänderte Dateien mit 59 Einfügungen und 60 Löschungen.
git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@121 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... | ... |
@@ -1,30 +1,23 @@ |
1 |
-function plotDecodePerformance(varargin) |
|
1 |
+function plotDecodePerformance(timeline,inputStruct) |
|
2 | 2 |
|
3 | 3 |
global CROSSVAL_METHOD_DEF; |
4 | 4 |
|
5 | 5 |
PSTH_AXIS_MIN = -1; |
6 | 6 |
PSTH_AXIS_MAX = 1; |
7 | 7 |
|
8 |
-switch nargin |
|
8 |
+ psthStart = timeline.psthStart; |
|
9 |
+ psthEnd = timeline.psthEnd; |
|
10 |
+ frameStart = timeline.frameShiftStart; |
|
11 |
+ frameEnd = timeline.frameShiftEnd; |
|
9 | 12 |
|
10 |
- case 1 |
|
11 |
- inputStruct = cell2mat(varargin(1)); |
|
12 |
- |
|
13 |
- psthStart = inputStruct.psthStart; |
|
14 |
- psthEnd = inputStruct.psthEnd; |
|
15 | 13 |
nClasses = inputStruct.nClasses; |
16 | 14 |
decodePerformance = inputStruct.decodePerformance; |
17 |
- frameStart = inputStruct.frameShiftStart; |
|
18 |
- frameEnd = inputStruct.frameShiftEnd; |
|
19 | 15 |
psth = inputStruct.rawTimeCourse; |
20 | 16 |
SubjectID = inputStruct.SubjectID; |
21 | 17 |
smoothed = inputStruct.smoothed; |
22 | 18 |
PLOT_METHOD = inputStruct.CROSSVAL_METHOD; |
23 | 19 |
% CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF; |
24 | 20 |
|
25 |
- otherwise |
|
26 |
- error('spmtoolbox:SVMCrossVal:plotDecodePerformance:WrongArgument','Wrong Arguments'); |
|
27 |
-end |
|
28 | 21 |
|
29 | 22 |
f = figure; |
30 | 23 |
subplot(2,1,1); |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
% function [decodePerformance rawTimecourse ] = calculateDecodePerformance(des,timeLineStart, timeLineEnd, decodeDuration, svmargs, conditionList, sessionList, voxelList, classList, labelMap,normalize) |
2 |
-function outputStruct = calculateDecodePerformance(inputStruct,SubjectID) |
|
2 |
+function outputStruct = calculateDecodePerformance(timeline,inputStruct,SubjectID) |
|
3 | 3 |
|
4 | 4 |
global CROSSVAL_METHOD_DEF; |
5 | 5 |
|
... | ... |
@@ -14,21 +14,23 @@ outputStruct = struct; |
14 | 14 |
|
15 | 15 |
namehelper = strcat('s',SubjectID); |
16 | 16 |
des = inputStruct.(namehelper).des; |
17 |
-timeLineStart = inputStruct.frameShiftStart; |
|
18 |
-timeLineEnd = inputStruct.frameShiftEnd; |
|
19 |
-decodeDuration = inputStruct.decodeDuration; |
|
20 | 17 |
svmargs = inputStruct.svmargs; |
21 | 18 |
sessionList = inputStruct.sessionList; |
22 | 19 |
voxelList = inputStruct.(namehelper).voxelList; |
23 | 20 |
% classList = inputStruct.classList; |
24 | 21 |
% labelMap = inputStruct.labelMap; |
25 | 22 |
smoothed = inputStruct.smoothed; |
26 |
-globalStart = inputStruct.psthStart; |
|
27 |
-globalEnd = inputStruct.psthEnd; |
|
28 |
-baselineStart = inputStruct.baselineStart; |
|
29 |
-baselineEnd = inputStruct.baselineEnd; |
|
30 | 23 |
eventList = inputStruct.eventList; |
31 | 24 |
|
25 |
+timeLineStart = timeline.frameShiftStart; |
|
26 |
+timeLineEnd = timeline.frameShiftEnd; |
|
27 |
+decodeDuration = timeline.decodeDuration; |
|
28 |
+globalStart = timeline.psthStart; |
|
29 |
+globalEnd = timeline.psthEnd; |
|
30 |
+baselineStart = timeline.baselineStart; |
|
31 |
+baselineEnd = timeline.baselineEnd; |
|
32 |
+ |
|
33 |
+ |
|
32 | 34 |
minPerformance = inf; |
33 | 35 |
maxPerformance = -inf; |
34 | 36 |
|
... | ... |
@@ -12,24 +12,29 @@ switch nargin |
12 | 12 |
error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model'); |
13 | 13 |
end |
14 | 14 |
|
15 |
+ % timeline params (claculate and plot) |
|
16 |
+ timelineParams = struct; |
|
17 |
+ |
|
18 |
+ timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart); % -20; |
|
19 |
+ timelineParams.frameShiftEnd = getDouble(paramModel.txtFrameShiftEnd); %15; |
|
20 |
+ timelineParams.decodeDuration = getDouble(paramModel.txtFrameShiftDur); |
|
21 |
+ timelineParams.psthStart = getDouble(paramModel.txtPSTHStart); % -25; |
|
22 |
+ timelineParams.psthEnd = getDouble(paramModel.txtPSTHEnd); % 20; |
|
23 |
+ timelineParams.baselineStart = getDouble(paramModel.txtBaselineStart); % -22; |
|
24 |
+ timelineParams.baselineEnd = getDouble(paramModel.txtBaselineEnd); % -20; |
|
25 |
+ |
|
15 | 26 |
% common params |
16 | 27 |
calculateParams = struct; |
17 | 28 |
|
18 | 29 |
% calculateParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF; |
19 | 30 |
calculateParams.CROSSVAL_METHOD = CROSSVAL_METHOD_DEF.svmcrossval; |
31 |
+ calculateParams.PROJECT_BASE_PATH = PROJECT_BASE_PATH; |
|
32 |
+ calculateParams.PROJECT_RESULT_PATH = PROJECT_RESULT_PATH; |
|
20 | 33 |
|
21 | 34 |
calculateParams.RANDOMIZE = 0; |
22 | 35 |
|
23 | 36 |
calculateParams.smoothed = getChkValue(paramModel.chkSmoothed); |
24 | 37 |
|
25 |
- calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart); % -20; |
|
26 |
- calculateParams.frameShiftEnd = getDouble(paramModel.txtFrameShiftEnd); %15; |
|
27 |
- calculateParams.decodeDuration = getDouble(paramModel.txtFrameShiftDur); |
|
28 |
- calculateParams.psthStart = getDouble(paramModel.txtPSTHStart); % -25; |
|
29 |
- calculateParams.psthEnd = getDouble(paramModel.txtPSTHEnd); % 20; |
|
30 |
- calculateParams.baselineStart = getDouble(paramModel.txtBaselineStart); % -22; |
|
31 |
- calculateParams.baselineEnd = getDouble(paramModel.txtBaselineEnd); % -20; |
|
32 |
- |
|
33 | 38 |
calculateParams.svmargs = get(paramModel.txtSVMopts,'String'); |
34 | 39 |
calculateParams.sessionList = 1:3; |
35 | 40 |
|
... | ... |
@@ -42,6 +47,35 @@ end |
42 | 47 |
% calculateParams.eventList = getPSTEventMatrix(calculateParams.labelMap); |
43 | 48 |
|
44 | 49 |
subjectSelection = getSubjectIDString(paramModel); |
50 |
+ calculateParams.subjectSelection = subjectSelection; |
|
51 |
+ |
|
52 |
+ decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams); |
|
53 |
+ |
|
54 |
+ display('Finished calculations.'); |
|
55 |
+ display('Plotting...'); |
|
56 |
+ |
|
57 |
+ plotParams = struct; |
|
58 |
+ |
|
59 |
+% plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF; |
|
60 |
+ plotParams.CROSSVAL_METHOD = calculateParams.CROSSVAL_METHOD; |
|
61 |
+ |
|
62 |
+ plotParams.nClasses = length(calculateParams.classList); |
|
63 |
+ |
|
64 |
+ plotParams.decodePerformance = decode.decodePerformance; |
|
65 |
+ plotParams.rawTimeCourse = decode.rawTimeCourse; |
|
66 |
+ plotParams.SubjectID = subjectSelection; |
|
67 |
+ plotParams.smoothed = boolToYesNoString(calculateParams.smoothed); |
|
68 |
+ |
|
69 |
+ assignin('base','plotParams',plotParams); |
|
70 |
+% plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse); |
|
71 |
+ plotDecodePerformance(timelineParams,plotParams); |
|
72 |
+ |
|
73 |
+ display('all done.'); |
|
74 |
+end |
|
75 |
+ |
|
76 |
+ |
|
77 |
+%% subject loop |
|
78 |
+function decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams) |
|
45 | 79 |
decode = struct; |
46 | 80 |
decode.decodePerformance = []; |
47 | 81 |
decode.rawTimeCourse = []; |
... | ... |
@@ -51,7 +85,7 @@ end |
51 | 85 |
namehelper = strcat('s',SubjectID); %Vars can not start with numbers. |
52 | 86 |
|
53 | 87 |
display('loading SPM.mat ...'); |
54 |
- spm = load(fullfile(PROJECT_BASE_PATH,SubjectID,PROJECT_RESULT_PATH)); |
|
88 |
+ spm = load(fullfile(calculateParams.PROJECT_BASE_PATH,SubjectID,calculateParams.PROJECT_RESULT_PATH)); |
|
55 | 89 |
display('... done.'); |
56 | 90 |
|
57 | 91 |
% calculate |
... | ... |
@@ -63,7 +97,7 @@ end |
63 | 97 |
display('switching off all warnings'); |
64 | 98 |
warning_state = warning('off','all'); |
65 | 99 |
display('calculating ...'); |
66 |
- decode.(namehelper) = calculateDecodePerformance(calculateParams,SubjectID); |
|
100 |
+ decode.(namehelper) = calculateDecodePerformance(timelineParams,calculateParams,SubjectID); |
|
67 | 101 |
|
68 | 102 |
display('... done'); |
69 | 103 |
display('restoring warnings'); |
... | ... |
@@ -75,34 +109,4 @@ end |
75 | 109 |
assignin('base','decode',decode); |
76 | 110 |
end |
77 | 111 |
|
78 |
- display('Finished calculations.'); |
|
79 |
- display('Plotting...'); |
|
80 |
- |
|
81 |
- plotParams = struct; |
|
82 |
- |
|
83 |
-% plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF; |
|
84 |
- plotParams.CROSSVAL_METHOD = calculateParams.CROSSVAL_METHOD; |
|
85 |
- |
|
86 |
- plotParams.psthStart = calculateParams.psthStart; |
|
87 |
- plotParams.psthEnd = calculateParams.psthEnd; |
|
88 |
- plotParams.nClasses = length(calculateParams.classList); |
|
89 |
- |
|
90 |
- plotParams.frameShiftStart = calculateParams.frameShiftStart; |
|
91 |
- plotParams.frameShiftEnd = calculateParams.frameShiftEnd; |
|
92 |
- plotParams.decodePerformance = decode.decodePerformance; |
|
93 |
- plotParams.rawTimeCourse = decode.rawTimeCourse; |
|
94 |
- |
|
95 |
-% if numel(subjectSelection) == 1 |
|
96 |
-% plotParams.SubjectID = SubjectID; |
|
97 |
-% else |
|
98 |
- plotParams.SubjectID = subjectSelection; |
|
99 |
-% end |
|
100 |
- |
|
101 |
- plotParams.smoothed = boolToYesNoString(calculateParams.smoothed); |
|
102 |
- |
|
103 |
- assignin('base','plotParams',plotParams); |
|
104 |
-% plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse); |
|
105 |
- plotDecodePerformance(plotParams); |
|
106 |
- |
|
107 |
- display('all done.'); |
|
108 | 112 |
end |
109 | 113 |
\ No newline at end of file |
110 | 114 |