cdb6cdac74f1e550de8fca7b38eeab7b84fc7bd4
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

1) function classify(varargin)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

2) 
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

3) PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

4) PROJECT_RESULT_PATH = 'results\SPM.mat';
5) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

6) switch nargin
7)     case 1
8)         action = 'decode';
9)         paramModel = varargin{1};
10)     otherwise
11)         error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

12) end
13) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

14)     
15) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

16)     switch(action)
17)     case 'clear'
18)         evalin('base','clear map lm SPM classList dataTimeLine decodeTable labelTimeLine svmopts trialProtocol voxelList xTimeEnd xTimeStart xTimeWindow');
19)       
20)     case 'decode'
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

21)         
22)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

23)         % common params
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

24)         calculateParams  = struct;
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

25)         calculateParams.smoothed        = getDouble(paramModel.txtSmoothed);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

26) 
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

27)         calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
28)         calculateParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
29)         calculateParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
30)         calculateParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
31)         calculateParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
32)         calculateParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
33)         calculateParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
34) 
35)         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

36)         calculateParams.sessionList     = 1:3;
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

37) 
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

38)         classStruct = parseClassDef(paramModel);
39)         
40)         calculateParams.classList       = classStruct.label; %{'<','>'};
41)         calculateParams.labelMap        = LabelMap(classStruct.label , classStruct.value); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4});
42)         calculateParams.eventList       = classStruct.event; %[9,11,13; 10,12,14];
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

43) 
44)         params = struct;
45)         params.nClasses = 2;
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

46)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

47)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

48)         subjectSelection = getSubjectIDString(paramModel);
49)         decode = struct;
50)         decode.decodePerformance = [];
51)         decode.rawTimeCourse     = [];
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

52)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

53)         for subjectCell = subjectSelection
54)             SubjectID = cell2mat(subjectCell);
55) 
56)             display('loading SPM.mat');
57)             spm = load(fullfile(PROJECT_BASE_PATH,SubjectID,PROJECT_RESULT_PATH));
58) %             display('done.');
59) 
60)             %% calculate
61)             display(sprintf('calculating cross-validation performance time-shift for Subject %s',SubjectID));
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

62)             namehelper = strcat('s',SubjectID);
63)             calculateParams.(namehelper).des             = spm.SPM;
64)             calculateParams.(namehelper).voxelList       = parseVoxelList(paramModel,SubjectID);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

65)             
66)             assignin('base','calculateParams',calculateParams);
67)             
68)     %         [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize);
69)             display('switching off all warnings');
70)             warning_state = warning('off','all');
71)             
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

72)             decode.(namehelper) = calculateDecodePerformance(calculateParams,SubjectID);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

73)             display('restoring warnings');
74)             warning(warning_state);
75)             
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

76)             decode.decodePerformance = [decode.decodePerformance decode.(namehelper).decodePerformance];
77)             decode.rawTimeCourse = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse];
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

78)   
79)             
80) %             display(sprintf('Min CrossVal Accuracy: %g%% \t Max CrossVal Accuracy: %g%%',decode.minPerformance,decode.maxPerformance));
81) 
82)             assignin('base','decode',decode);
83)         end
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

84) 
85)         display('Finished calculations.');
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

86)         display('Plotting...');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

87) 
88)         plotParams = struct;
89)         plotParams.psthStart = calculateParams.psthStart;
90)         plotParams.psthEnd   = calculateParams.psthEnd;
91)         plotParams.nClasses  = length(calculateParams.classList);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

92)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

93)         plotParams.frameShiftStart   = calculateParams.frameShiftStart;
94)         plotParams.frameShiftEnd     = calculateParams.frameShiftEnd;
95)         plotParams.decodePerformance = decode.decodePerformance;
96)         plotParams.rawTimeCourse     = decode.rawTimeCourse;
97)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

98)         if numel(subjectSelection) == 1
99)           plotParams.SubjectID         = SubjectID;
100)         else
101)           plotParams.SubjectID         = 'Multiple';
102)         end
103) 
104)         plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
105)          
106) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

107)         assignin('base','plotParams',plotParams);
108) %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
109)         plotDecodePerformance(plotParams);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

110)             
111)         display('done.');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

112) 
113)     otherwise
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

114)         display('give action command: clear, decode');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

115)     end