Browse code

spatial and temporal grouping functionality

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@202 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on03/08/2009 16:18:15
Showing1 changed files
... ...
@@ -1,7 +1,5 @@
1 1
 function subjectData = runCoordTable(args)
2 2
 
3
-% global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4
-
5 3
     disp('run coord table')
6 4
     
7 5
     subjects = args.subjects;
... ...
@@ -12,20 +10,21 @@ function subjectData = runCoordTable(args)
12 10
     disp(sprintf('batch processing %g subjects.',nSubjects));
13 11
 
14 12
     for s = 1:nSubjects
13
+        % load SPM Design 
15 14
         subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
16 15
         d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
17 16
         subjectStruct{s}.des = d.SPM;
18 17
         subjectStruct{s}.name = cell2mat(subjects(s));
19
-        
18
+        % load ROI look-up table
20 19
         map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
21 20
         subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
22 21
         
23
-%         nVoxel = size(subjectStruct{s}.coords,1);
24
-        
22
+        %preload images
25 23
         disp('fetching volume definitions, please wait');
26 24
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
27 25
       
28
-        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords);
26
+        %extract voxel values
27
+        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,args.groupingFkt);
29 28
          
30 29
         pstopts.des = subjectStruct{s}.des;
31 30
         pstopts.eventList = args.eventList;
Browse code

radius frontend enabled, fixed backend problems. radius working

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@162 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on18/03/2009 14:50:47
Showing1 changed files
... ...
@@ -7,7 +7,6 @@ function subjectData = runCoordTable(args)
7 7
     subjects = args.subjects;
8 8
     nSubjects = numel(subjects);
9 9
     sessionlist = args.sessionList;
10
-    radius = args.radius;
11 10
     pstopts = args.psthOpts;
12 11
     
13 12
     disp(sprintf('batch processing %g subjects.',nSubjects));
... ...
@@ -26,7 +25,7 @@ function subjectData = runCoordTable(args)
26 25
         disp('fetching volume definitions, please wait');
27 26
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
28 27
       
29
-        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,radius);
28
+        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords);
30 29
          
31 30
         pstopts.des = subjectStruct{s}.des;
32 31
         pstopts.eventList = args.eventList;
Browse code

radius backend working

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@161 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on18/03/2009 13:53:10
Showing1 changed files
... ...
@@ -21,27 +21,28 @@ function subjectData = runCoordTable(args)
21 21
         map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
22 22
         subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
23 23
         
24
-        nVoxel = size(subjectStruct{s}.coords,1);
24
+%         nVoxel = size(subjectStruct{s}.coords,1);
25 25
         
26 26
         disp('fetching volume definitions, please wait');
27 27
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
28 28
       
29
-        extr = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,radius);
29
+        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,radius);
30 30
          
31 31
         pstopts.des = subjectStruct{s}.des;
32 32
         pstopts.eventList = args.eventList;
33 33
         pstopts.sessionList = sessionlist;
34 34
         
35
-        disp('computing psth');
36
-        for iVoxel = 1:nVoxel
35
+        disp(sprintf('computing psth for %g voxel',nExtractedVoxel));
36
+        for iVoxel = 1:nExtractedVoxel
37 37
             rawdata = [];
38 38
             for iImage = 1:length(extr);
39 39
                 tmp = extr(iImage);
40
-                rawdata = [rawdata tmp.dat(iVoxel,:)];
40
+                rawdata = [rawdata tmp.dat(iVoxel)];
41 41
             end
42 42
             subjectStruct{s}.rawData{iVoxel} = rawdata;
43 43
             subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
44 44
         end
45
+        
45 46
        disp(sprintf('done %g / %g',s,nSubjects));
46 47
     end
47 48
     
Browse code

radius bug fast behoben.

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@160 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on17/03/2009 14:50:47
Showing1 changed files
... ...
@@ -37,8 +37,9 @@ function subjectData = runCoordTable(args)
37 37
             rawdata = [];
38 38
             for iImage = 1:length(extr);
39 39
                 tmp = extr(iImage);
40
-                rawdata = [rawdata tmp.dat(iVoxel)];
40
+                rawdata = [rawdata tmp.dat(iVoxel,:)];
41 41
             end
42
+            subjectStruct{s}.rawData{iVoxel} = rawdata;
42 43
             subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
43 44
         end
44 45
        disp(sprintf('done %g / %g',s,nSubjects));
Browse code

normalization features enabled

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@158 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on16/03/2009 21:07:46
Showing1 changed files
... ...
@@ -8,6 +8,7 @@ function subjectData = runCoordTable(args)
8 8
     nSubjects = numel(subjects);
9 9
     sessionlist = args.sessionList;
10 10
     radius = args.radius;
11
+    pstopts = args.psthOpts;
11 12
     
12 13
     disp(sprintf('batch processing %g subjects.',nSubjects));
13 14
 
Browse code

enabled radius. but does not work with r>0 !

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@156 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on16/03/2009 18:55:40
Showing1 changed files
... ...
@@ -7,6 +7,7 @@ function subjectData = runCoordTable(args)
7 7
     subjects = args.subjects;
8 8
     nSubjects = numel(subjects);
9 9
     sessionlist = args.sessionList;
10
+    radius = args.radius;
10 11
     
11 12
     disp(sprintf('batch processing %g subjects.',nSubjects));
12 13
 
... ...
@@ -24,7 +25,7 @@ function subjectData = runCoordTable(args)
24 25
         disp('fetching volume definitions, please wait');
25 26
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
26 27
       
27
-        extr = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords);
28
+        extr = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,radius);
28 29
          
29 30
         pstopts.des = subjectStruct{s}.des;
30 31
         pstopts.eventList = args.eventList;
Browse code

task-models implementet.

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@154 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on16/03/2009 17:26:16
Showing1 changed files
... ...
@@ -8,8 +8,7 @@ function subjectData = runCoordTable(args)
8 8
     nSubjects = numel(subjects);
9 9
     sessionlist = args.sessionList;
10 10
     
11
-    disp(sprintf('we have %g subjects. Press ANY-Key to continue.\n Use Retrun if your Keyboard lacks the ANY-Key.',nSubjects));
12
-    pause
11
+    disp(sprintf('batch processing %g subjects.',nSubjects));
13 12
 
14 13
     for s = 1:nSubjects
15 14
         subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
Browse code

working: SingleSubject, CoordTable, SVM, VISUAL SingleSubject, ROI-Image, SVM, VISUAL MultiSubject, CoordTable, SVM, VISUAL MultiSubject, ROI-Image, SVM, VISUAL

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@147 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on09/03/2009 15:42:39
Showing1 changed files
... ...
@@ -1,12 +1,15 @@
1 1
 function subjectData = runCoordTable(args)
2 2
 
3
-global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
3
+% global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4 4
 
5 5
     disp('run coord table')
6 6
     
7 7
     subjects = args.subjects;
8
-    nSubjects = size(subjects);
8
+    nSubjects = numel(subjects);
9 9
     sessionlist = args.sessionList;
10
+    
11
+    disp(sprintf('we have %g subjects. Press ANY-Key to continue.\n Use Retrun if your Keyboard lacks the ANY-Key.',nSubjects));
12
+    pause
10 13
 
11 14
     for s = 1:nSubjects
12 15
         subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
... ...
@@ -37,7 +40,7 @@ global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
37 40
             end
38 41
             subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
39 42
         end
40
-       disp(sprintf('done %g // %g',s,nSubjects));
43
+       disp(sprintf('done %g / %g',s,nSubjects));
41 44
     end
42 45
     
43 46
     subjectData = subjectStruct;
Browse code

enabled svm classification. labelmap not working

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@143 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on05/03/2009 16:47:04
Showing1 changed files
... ...
@@ -1,4 +1,4 @@
1
-function runCoordTable(args)
1
+function subjectData = runCoordTable(args)
2 2
 
3 3
 global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4 4
 
... ...
@@ -40,5 +40,6 @@ global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
40 40
        disp(sprintf('done %g // %g',s,nSubjects));
41 41
     end
42 42
     
43
-    assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
43
+    subjectData = subjectStruct;
44
+%     assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
44 45
 end
Browse code

snapshot, classification

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@140 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on02/03/2009 18:28:41
Showing1 changed files
... ...
@@ -1,4 +1,7 @@
1 1
 function runCoordTable(args)
2
+
3
+global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4
+
2 5
     disp('run coord table')
3 6
     
4 7
     subjects = args.subjects;
... ...
@@ -37,33 +40,5 @@ function runCoordTable(args)
37 40
        disp(sprintf('done %g // %g',s,nSubjects));
38 41
     end
39 42
     
40
-    assignin('base','subjectStruct',subjectStruct);
43
+    assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
41 44
 end
42
-
43
-
44
-
45
-
46
-% 
47
-% %         decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
48
-% 
49
-%         display('Finished calculations.');
50
-%         display('Plotting...');
51
-% 
52
-%         plotParams                   = struct;
53
-%         
54
-% %         plotParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
55
-%         plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
56
-%         
57
-%         plotParams.nClasses          = length(calculateParams.classList);
58
-% 
59
-%         plotParams.decodePerformance = decode.decodePerformance;
60
-%         plotParams.rawTimeCourse     = decode.rawTimeCourse;
61
-%         plotParams.SubjectID         = subjectSelection;
62
-%         plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
63
-% 
64
-%         assignin('base','plotParams',plotParams);
65
-% %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
66
-%         plotDecodePerformance(timelineParams,plotParams);
67
-%             
68
-%         display('all done.');
69
-% 
Browse code

schwimmen.

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@139 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on25/02/2009 16:53:36
Showing1 changed files
... ...
@@ -14,14 +14,30 @@ function runCoordTable(args)
14 14
         map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
15 15
         subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
16 16
         
17
+        nVoxel = size(subjectStruct{s}.coords,1);
18
+        
17 19
         disp('fetching volume definitions, please wait');
18 20
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
19
-
21
+      
22
+        extr = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords);
23
+         
24
+        pstopts.des = subjectStruct{s}.des;
25
+        pstopts.eventList = args.eventList;
26
+        pstopts.sessionList = sessionlist;
20 27
         
21
-        rawData = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords)
22
-        
23
-        disp('done');
28
+        disp('computing psth');
29
+        for iVoxel = 1:nVoxel
30
+            rawdata = [];
31
+            for iImage = 1:length(extr);
32
+                tmp = extr(iImage);
33
+                rawdata = [rawdata tmp.dat(iVoxel)];
34
+            end
35
+            subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
36
+        end
37
+       disp(sprintf('done %g // %g',s,nSubjects));
24 38
     end
39
+    
40
+    assignin('base','subjectStruct',subjectStruct);
25 41
 end
26 42
 
27 43
 
Browse code

coordTabel works for JZ006

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@138 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on25/02/2009 15:49:55
Showing1 changed files
... ...
@@ -1,98 +1,53 @@
1
-function ppsth = runCoordTable(baseDir,subjects,timeline,coordinates,volumeFileList,classDef)
2
-%         paramModel = varargin{1};
1
+function runCoordTable(args)
3 2
     disp('run coord table')
4 3
     
5
-    disp('does not work yet.')
6
-    return
7
-        
8
-        PROJECT_BASE_PATH = baseDir;
9
-        PROJECT_RESULT_PATH = 'results\SPM.mat';
10
-
4
+    subjects = args.subjects;
5
+    nSubjects = size(subjects);
6
+    sessionlist = args.sessionList;
11 7
 
12
-        timelineParams = timeline;
13
-        
14
-        % common params
15
-        calculateParams  = struct;
16
-        
17
-        calculateParams.PROJECT_BASE_PATH    = PROJECT_BASE_PATH;
18
-        calculateParams.PROJECT_RESULT_PATH  = PROJECT_RESULT_PATH;
19
-        
20
-        calculateParams.RANDOMIZE       = 0;
21
-        calculateParams.sessionList     = 1:3;
22
-        
23
-        calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
8
+    for s = 1:nSubjects
9
+        subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
10
+        d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
11
+        subjectStruct{s}.des = d.SPM;
12
+        subjectStruct{s}.name = cell2mat(subjects(s));
24 13
         
25
-        subjectSelection = subjects;
26
-        calculateParams.subjectSelection = subjectSelection;
14
+        map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
15
+        subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
27 16
         
28
-        decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
17
+        disp('fetching volume definitions, please wait');
18
+        subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
29 19
 
30
-        display('Finished calculations.');
31
-        display('Plotting...');
32
-
33
-        plotParams                   = struct;
34 20
         
35
-%         plotParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
36
-        plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
21
+        rawData = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords)
37 22
         
38
-        plotParams.nClasses          = length(calculateParams.classList);
39
-
40
-        plotParams.decodePerformance = decode.decodePerformance;
41
-        plotParams.rawTimeCourse     = decode.rawTimeCourse;
42
-        plotParams.SubjectID         = subjectSelection;
43
-        plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
44
-
45
-        assignin('base','plotParams',plotParams);
46
-%         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
47
-        plotDecodePerformance(timelineParams,plotParams);
48
-            
49
-        display('all done.');
23
+        disp('done');
24
+    end
50 25
 end
51
-    
52
-
53
-%% subject loop
54
-function decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel)
55
-
56
-decode = struct;
57
-decode.decodePerformance = [];
58
-decode.rawTimeCourse     = [];
59 26
 
60
-for subjectCell = calculateParams.subjectSelection
61
-    SubjectID = cell2mat(subjectCell);
62
-    namehelper = strcat('s',SubjectID); %Vars can not start with numbers.
63 27
 
64
-    display('loading SPM.mat ...');
65
-    spm = load(fullfile(calculateParams.PROJECT_BASE_PATH,SubjectID,calculateParams.PROJECT_RESULT_PATH));
66
-    display('... done.');
67 28
 
68
-    % per subject params..
69
-    subjectParams = struct;
70
-    
71
-    subjectParams.des             = spm.SPM;
72
-
73
-
74
-    subjectParams.voxelList       = mapVoxelList(voxelList,SubjectID);
75
-
76
-    
77
-    subjectParams.SubjectID       = SubjectID;
78
-    subjectParams.namehelper      = namehelper;
79
-%     assignin('base','calculateParams',calculateParams);
80
-
81
-    display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',SubjectID));
82
-    display('switching off all warnings');
83
-    warning_state               = warning('off','all');
84
-    display('calculating ...');
85
-    decode.(namehelper)         = calculateDecodePerformance(timelineParams,calculateParams,subjectParams);
86
-
87
-    display('... done');
88
-    display('restoring warnings');
89
-    warning(warning_state);
90
-
91
-    decode.decodePerformance    = [decode.decodePerformance decode.(namehelper).decodePerformance];
92
-    decode.rawTimeCourse        = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse];
93
-
94
-    assignin('base','decode',decode);
95
-end
96
-
97
-end
98 29
 
30
+% 
31
+% %         decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
32
+% 
33
+%         display('Finished calculations.');
34
+%         display('Plotting...');
35
+% 
36
+%         plotParams                   = struct;
37
+%         
38
+% %         plotParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
39
+%         plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
40
+%         
41
+%         plotParams.nClasses          = length(calculateParams.classList);
42
+% 
43
+%         plotParams.decodePerformance = decode.decodePerformance;
44
+%         plotParams.rawTimeCourse     = decode.rawTimeCourse;
45
+%         plotParams.SubjectID         = subjectSelection;
46
+%         plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
47
+% 
48
+%         assignin('base','plotParams',plotParams);
49
+% %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
50
+%         plotDecodePerformance(timelineParams,plotParams);
51
+%             
52
+%         display('all done.');
53
+% 
Browse code

zwischenspeicherung

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@135 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on18/02/2009 18:24:30
Showing1 changed files
... ...
@@ -1,51 +1,28 @@
1
-function runCoordTable(timeline,varargin)
2
-        paramModel = varargin{1};
1
+function ppsth = runCoordTable(baseDir,subjects,timeline,coordinates,volumeFileList,classDef)
2
+%         paramModel = varargin{1};
3
+    disp('run coord table')
4
+    
5
+    disp('does not work yet.')
6
+    return
3 7
         
4
-global SVMCROSSVAL_CROSSVAL_METHOD_DEF;
5
-global SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF;
6
-
7
-
8
-        %PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
9
-        PROJECT_BASE_PATH = paramModel.baseDir;
8
+        PROJECT_BASE_PATH = baseDir;
10 9
         PROJECT_RESULT_PATH = 'results\SPM.mat';
11 10
 
12 11
 
13
-        % timeline params (claculate and plot)
14 12
         timelineParams = timeline;
15 13
         
16
-%         timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
17
-%         timelineParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
18
-%         timelineParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
19
-%         timelineParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
20
-%         timelineParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
21
-%         timelineParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
22
-%         timelineParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;       
23
-%        
24 14
         % common params
25 15
         calculateParams  = struct;
26 16
         
27
-%         calculateParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
28
-        calculateParams.CROSSVAL_METHOD      = SVMCROSSVAL_CROSSVAL_METHOD_DEF.svmcrossval;
29
-        calculateParams.VOXEL_SELECTION_MODE = SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF.roiImage;
30 17
         calculateParams.PROJECT_BASE_PATH    = PROJECT_BASE_PATH;
31 18
         calculateParams.PROJECT_RESULT_PATH  = PROJECT_RESULT_PATH;
32 19
         
33 20
         calculateParams.RANDOMIZE       = 0;
34
-        
35
-%         calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
36
-
37
-%         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
38 21
         calculateParams.sessionList     = 1:3;
39
-
40
-        classStruct = parseClassDef(paramModel);
41
-        
42 22
         
43
-%         calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
44
-%         calculateParams.classList       = getClasses(calculateParams.labelMap);
45 23
         calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
46
-%         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
47 24
         
48
-        subjectSelection = {'JZ006'}; %getSubjectIDString(paramModel);
25
+        subjectSelection = subjects;
49 26
         calculateParams.subjectSelection = subjectSelection;
50 27
         
51 28
         decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
Browse code

new parseVoxelTxtField getImageFileList reads files according to gui-settings voxel to subject coordinate mapping missing.

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@131 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on16/02/2009 17:32:42
Showing1 changed files
... ...
@@ -32,20 +32,20 @@ global SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF;
32 32
         
33 33
         calculateParams.RANDOMIZE       = 0;
34 34
         
35
-        calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
35
+%         calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
36 36
 
37
-        calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
37
+%         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
38 38
         calculateParams.sessionList     = 1:3;
39 39
 
40 40
         classStruct = parseClassDef(paramModel);
41 41
         
42 42
         
43
-        calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
44
-        calculateParams.classList       = getClasses(calculateParams.labelMap);
43
+%         calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
44
+%         calculateParams.classList       = getClasses(calculateParams.labelMap);
45 45
         calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
46 46
 %         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
47 47
         
48
-        subjectSelection = getSubjectIDString(paramModel);
48
+        subjectSelection = {'JZ006'}; %getSubjectIDString(paramModel);
49 49
         calculateParams.subjectSelection = subjectSelection;
50 50
         
51 51
         decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
... ...
@@ -94,7 +94,7 @@ for subjectCell = calculateParams.subjectSelection
94 94
     subjectParams.des             = spm.SPM;
95 95
 
96 96
 
97
-    subjectParams.voxelList       = parseVoxelList(paramModel,SubjectID);
97
+    subjectParams.voxelList       = mapVoxelList(voxelList,SubjectID);
98 98
 
99 99
     
100 100
     subjectParams.SubjectID       = SubjectID;
Browse code

subject list from filesystem, image mask list from filesystem

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@130 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on13/02/2009 14:57:00
Showing1 changed files
... ...
@@ -1,11 +1,12 @@
1 1
 function runCoordTable(timeline,varargin)
2
+        paramModel = varargin{1};
3
+        
4
+global SVMCROSSVAL_CROSSVAL_METHOD_DEF;
5
+global SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF;
2 6
 
3
-global CROSSVAL_METHOD_DEF;
4
-global VOXEL_SELECTION_MODE_DEF;
5 7
 
6
-        paramModel = varargin{1};
7 8
         %PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
8
-        PROJECT_BASE_PATH = 'D:\Analyze\Choice\24pilot';
9
+        PROJECT_BASE_PATH = paramModel.baseDir;
9 10
         PROJECT_RESULT_PATH = 'results\SPM.mat';
10 11
 
11 12
 
... ...
@@ -23,9 +24,9 @@ global VOXEL_SELECTION_MODE_DEF;
23 24
         % common params
24 25
         calculateParams  = struct;
25 26
         
26
-%         calculateParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
27
-        calculateParams.CROSSVAL_METHOD      = CROSSVAL_METHOD_DEF.svmcrossval;
28
-        calculateParams.VOXEL_SELECTION_MODE = VOXEL_SELECTION_MODE_DEF.roiImage;
27
+%         calculateParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
28
+        calculateParams.CROSSVAL_METHOD      = SVMCROSSVAL_CROSSVAL_METHOD_DEF.svmcrossval;
29
+        calculateParams.VOXEL_SELECTION_MODE = SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF.roiImage;
29 30
         calculateParams.PROJECT_BASE_PATH    = PROJECT_BASE_PATH;
30 31
         calculateParams.PROJECT_RESULT_PATH  = PROJECT_RESULT_PATH;
31 32
         
... ...
@@ -54,7 +55,7 @@ global VOXEL_SELECTION_MODE_DEF;
54 55
 
55 56
         plotParams                   = struct;
56 57
         
57
-%         plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
58
+%         plotParams.SVMCROSSVAL_CROSSVAL_METHOD_DEF = SVMCROSSVAL_CROSSVAL_METHOD_DEF;
58 59
         plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
59 60
         
60 61
         plotParams.nClasses          = length(calculateParams.classList);
Browse code

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@124 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on06/02/2009 11:51:00
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,120 @@
1
+function runCoordTable(timeline,varargin)
2
+
3
+global CROSSVAL_METHOD_DEF;
4
+global VOXEL_SELECTION_MODE_DEF;
5
+
6
+        paramModel = varargin{1};
7
+        %PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
8
+        PROJECT_BASE_PATH = 'D:\Analyze\Choice\24pilot';
9
+        PROJECT_RESULT_PATH = 'results\SPM.mat';
10
+
11
+
12
+        % timeline params (claculate and plot)
13
+        timelineParams = timeline;
14
+        
15
+%         timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
16
+%         timelineParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
17
+%         timelineParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
18
+%         timelineParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
19
+%         timelineParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
20
+%         timelineParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
21
+%         timelineParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;       
22
+%        
23
+        % common params
24
+        calculateParams  = struct;
25
+        
26
+%         calculateParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
27
+        calculateParams.CROSSVAL_METHOD      = CROSSVAL_METHOD_DEF.svmcrossval;
28
+        calculateParams.VOXEL_SELECTION_MODE = VOXEL_SELECTION_MODE_DEF.roiImage;
29
+        calculateParams.PROJECT_BASE_PATH    = PROJECT_BASE_PATH;
30
+        calculateParams.PROJECT_RESULT_PATH  = PROJECT_RESULT_PATH;
31
+        
32
+        calculateParams.RANDOMIZE       = 0;
33
+        
34
+        calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
35
+
36
+        calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
37
+        calculateParams.sessionList     = 1:3;
38
+
39
+        classStruct = parseClassDef(paramModel);
40
+        
41
+        
42
+        calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
43
+        calculateParams.classList       = getClasses(calculateParams.labelMap);
44
+        calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
45
+%         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
46
+        
47
+        subjectSelection = getSubjectIDString(paramModel);
48
+        calculateParams.subjectSelection = subjectSelection;
49
+        
50
+        decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
51
+
52
+        display('Finished calculations.');
53
+        display('Plotting...');
54
+
55
+        plotParams                   = struct;
56
+        
57
+%         plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
58
+        plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
59
+        
60
+        plotParams.nClasses          = length(calculateParams.classList);
61
+
62
+        plotParams.decodePerformance = decode.decodePerformance;
63
+        plotParams.rawTimeCourse     = decode.rawTimeCourse;
64
+        plotParams.SubjectID         = subjectSelection;
65
+        plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
66
+
67
+        assignin('base','plotParams',plotParams);
68
+%         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
69
+        plotDecodePerformance(timelineParams,plotParams);
70
+            
71
+        display('all done.');
72
+end
73
+    
74
+
75
+%% subject loop
76
+function decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel)
77
+
78
+decode = struct;
79
+decode.decodePerformance = [];
80
+decode.rawTimeCourse     = [];
81
+
82
+for subjectCell = calculateParams.subjectSelection
83
+    SubjectID = cell2mat(subjectCell);
84
+    namehelper = strcat('s',SubjectID); %Vars can not start with numbers.
85
+
86
+    display('loading SPM.mat ...');
87
+    spm = load(fullfile(calculateParams.PROJECT_BASE_PATH,SubjectID,calculateParams.PROJECT_RESULT_PATH));
88
+    display('... done.');
89
+
90
+    % per subject params..
91
+    subjectParams = struct;
92
+    
93
+    subjectParams.des             = spm.SPM;
94
+
95
+
96
+    subjectParams.voxelList       = parseVoxelList(paramModel,SubjectID);
97
+
98
+    
99
+    subjectParams.SubjectID       = SubjectID;
100
+    subjectParams.namehelper      = namehelper;
101
+%     assignin('base','calculateParams',calculateParams);
102
+
103
+    display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',SubjectID));
104
+    display('switching off all warnings');
105
+    warning_state               = warning('off','all');
106
+    display('calculating ...');
107
+    decode.(namehelper)         = calculateDecodePerformance(timelineParams,calculateParams,subjectParams);
108
+
109
+    display('... done');
110
+    display('restoring warnings');
111
+    warning(warning_state);
112
+
113
+    decode.decodePerformance    = [decode.decodePerformance decode.(namehelper).decodePerformance];
114
+    decode.rawTimeCourse        = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse];
115
+
116
+    assignin('base','decode',decode);
117
+end
118
+
119
+end
120
+