3a5d22766db91cf04967a2c671fc60cd5dca1fc0
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 gui layout finished

Christoph Budziszewski authored 15 years ago

3) switch nargin
4)     case 0
5)         action = 'decode';
6)         SubjectID = 'JZ006';
7)     case 1
8)         action = 'decode';
9)         paramModel = varargin{1};
Christoph Budziszewski fixed: parseVoxelList empty...

Christoph Budziszewski authored 15 years ago

10)         SubjectID = getSubjectIDString(paramModel);
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

11)     otherwise
12)         error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

13) end
14) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

15)     
16) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

22)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

23)         display('loading SPM.mat');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

24) %         SubjectID = 'JZ006';
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

25) %         SubjectID = 'AI020';
26) %         SubjectID = 'HG027';
27)         spm = load(fullfile('D:\Analyze\Choice\24pilot',SubjectID,'results\SPM.mat'));
28) 
29)         display('done.');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

30)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

31)         
32)         
33)         params = struct;
34)         params.nClasses = 2;
35) 
36)         assignin('base','params',params);
37)         %% calculate
38)         display('calculating cross-validation performance time-shift');
39)         calculateParams  = struct;
40)         
41)         calculateParams.des             = spm.SPM;
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

42)         
43)         calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
44)         calculateParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
45)         calculateParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
46)         calculateParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
47)         calculateParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
48)         calculateParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
49)         calculateParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
50) 
51)         calculateParams.voxelList = parseVoxelList(paramModel);
52) 
53)         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

55) 
56) %         parseClassDef(paramModel)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

57)         calculateParams.classList       = {'<','>'};
58)         calculateParams.labelMap        = LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4});
59)         calculateParams.eventList       = [9,11,13; 10,12,14];
60)         
61)         assignin('base','calculateParams',calculateParams);
62)         
63) %         [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize);
64)         decode = calculateDecodePerformance(calculateParams);
65)         display(sprintf('Min CrossVal Accuracy: %g%% \t Max CrossVal Accuracy: %g%%',decode.minPerformance,decode.maxPerformance));
66)         
67)         assignin('base','decode',decode);
68) 
69)         display('Finished calculations.');
70)         display('Plotting.');
71) 
72)         plotParams = struct;
73)         plotParams.psthStart = calculateParams.psthStart;
74)         plotParams.psthEnd   = calculateParams.psthEnd;
75)         plotParams.nClasses  = length(calculateParams.classList);
76)         plotParams.frameShiftStart   = calculateParams.frameShiftStart;
77)         plotParams.frameShiftEnd     = calculateParams.frameShiftEnd;
78)         plotParams.decodePerformance = decode.decodePerformance;
79)         plotParams.rawTimeCourse     = decode.rawTimeCourse;
80)         plotParams.SubjectID         = SubjectID;
81)         
82)         assignin('base','plotParams',plotParams);
83) %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
84)         plotDecodePerformance(plotParams);
85) 
86)     otherwise
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

87)         display('give action command: clear decode');