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 subjectStruct  = runROIImageMaskMode(args)
2 2
 
3
-% global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4
-
5 3
 subjects = args.subjects;
6 4
    
7 5
 nSubjects = numel(subjects);
Browse code

debugging

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

Christoph Budziszewski authored on26/04/2009 18:27:56
Showing1 changed files
... ...
@@ -32,7 +32,7 @@ for s = 1:nSubjects
32 32
 
33 33
     disp('computing volume values, please wait');
34 34
     
35
-    extr = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
35
+    [extr x y z] = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
36 36
     
37 37
     nVoxel = size(extr(1).dat,1);
38 38
 
... ...
@@ -41,6 +41,7 @@ for s = 1:nSubjects
41 41
 
42 42
     disp('computing psth');
43 43
     for iVoxel = 1:nVoxel
44
+        [ x(iVoxel) y(iVoxel) z(iVoxel)]
44 45
         rawdata = [];
45 46
         for iImage = 1:length(extr);
46 47
             tmp = extr(iImage);
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
... ...
@@ -6,6 +6,9 @@ subjects = args.subjects;
6 6
    
7 7
 nSubjects = numel(subjects);
8 8
 sessionlist = args.sessionList;
9
+pstopts = args.psthOpts;
10
+pstopts.eventList = args.eventList;
11
+pstopts.sessionList = sessionlist;
9 12
 
10 13
 disp(sprintf('batch processing  %g subjects.',nSubjects));
11 14
 
... ...
@@ -35,8 +38,6 @@ for s = 1:nSubjects
35 38
 
36 39
     % calculate psth
37 40
     pstopts.des = subjectStruct{s}.des;
38
-    pstopts.eventList = args.eventList;
39
-    pstopts.sessionList = sessionlist;
40 41
 
41 42
     disp('computing psth');
42 43
     for iVoxel = 1:nVoxel
Browse code

first plot button. not working. Idea: 3 tasks = 3 models.

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

Christoph Budziszewski authored on16/03/2009 17:07:44
Showing1 changed files
... ...
@@ -7,8 +7,7 @@ subjects = args.subjects;
7 7
 nSubjects = numel(subjects);
8 8
 sessionlist = args.sessionList;
9 9
 
10
-disp(sprintf('we have %g subjects. Press ANY-Key to continue.\n Use Retrun if your Keyboard lacks the ANY-Key.',nSubjects));
11
-pause
10
+disp(sprintf('batch processing  %g subjects.',nSubjects));
12 11
 
13 12
 for s = 1:nSubjects
14 13
     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,14 @@
1
-function runROIImageMaskMode(args)
1
+function subjectStruct  = runROIImageMaskMode(args)
2 2
 
3
-global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
3
+% global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4 4
 
5 5
 subjects = args.subjects;
6 6
    
7
-nSubjects = size(subjects);
7
+nSubjects = numel(subjects);
8 8
 sessionlist = args.sessionList;
9 9
 
10
+disp(sprintf('we have %g subjects. Press ANY-Key to continue.\n Use Retrun if your Keyboard lacks the ANY-Key.',nSubjects));
11
+pause
10 12
 
11 13
 for s = 1:nSubjects
12 14
     subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
... ...
@@ -49,7 +51,7 @@ for s = 1:nSubjects
49 51
     disp('done');
50 52
 end
51 53
 
52
-assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
54
+% assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
53 55
 
54 56
 end
55 57
 
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,5 +1,7 @@
1 1
 function runROIImageMaskMode(args)
2 2
 
3
+global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
4
+
3 5
 subjects = args.subjects;
4 6
    
5 7
 nSubjects = size(subjects);
... ...
@@ -47,7 +49,7 @@ for s = 1:nSubjects
47 49
     disp('done');
48 50
 end
49 51
 
50
-assignin('base','subjectStruct',subjectStruct);
52
+assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
51 53
 
52 54
 end
53 55
 
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
... ...
@@ -26,17 +26,24 @@ for s = 1:nSubjects
26 26
 
27 27
     disp('computing volume values, please wait');
28 28
     
29
-    rawData = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
29
+    extr = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
30
+    
31
+    nVoxel = size(extr(1).dat,1);
32
+
30 33
     % calculate psth
31 34
     pstopts.des = subjectStruct{s}.des;
32 35
     pstopts.eventList = args.eventList;
33 36
     pstopts.sessionList = sessionlist;
34
-    
35
-    assignin('base','pstopts',pstopts);
36
-    assignin('base','rawData',rawData);
37 37
 
38 38
     disp('computing psth');
39
-    subjectStruct{s}.psth    = calculatePST(args.timeline,pstopts,rawData);
39
+    for iVoxel = 1:nVoxel
40
+        rawdata = [];
41
+        for iImage = 1:length(extr);
42
+            tmp = extr(iImage);
43
+            rawdata = [rawdata tmp.dat(iVoxel)];
44
+        end
45
+        subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
46
+    end
40 47
     disp('done');
41 48
 end
42 49
 
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,14 +1,15 @@
1 1
 function runROIImageMaskMode(args)
2 2
 
3 3
 subjects = args.subjects;
4
-mask     = ['^' cell2mat(args.mask) '.*\.img$'];
5
-    
4
+   
6 5
 nSubjects = size(subjects);
7
-sessionlist = 1:3;
6
+sessionlist = args.sessionList;
8 7
 
9 8
 
10 9
 for s = 1:nSubjects
11 10
     subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
11
+    d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
12
+    subjectStruct{s}.des = d.SPM;
12 13
     subjectStruct{s}.name = cell2mat(subjects(s));
13 14
     subjectStruct{s}.roiFile = ui_selectRoiImage(...
14 15
         sprintf('Select ROI Files for %s',subjectStruct{s}.name),...
... ...
@@ -21,12 +22,22 @@ for s = 1:nSubjects
21 22
     % load image data
22 23
    
23 24
     disp('fetching volume definitions, please wait');
24
-    subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,mask));
25
+    subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
25 26
 
26 27
     disp('computing volume values, please wait');
27
-    subjectStruct{s}.rawData = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
28
+    
29
+    rawData = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
28 30
     % calculate psth
29
-          
31
+    pstopts.des = subjectStruct{s}.des;
32
+    pstopts.eventList = args.eventList;
33
+    pstopts.sessionList = sessionlist;
34
+    
35
+    assignin('base','pstopts',pstopts);
36
+    assignin('base','rawData',rawData);
37
+
38
+    disp('computing psth');
39
+    subjectStruct{s}.psth    = calculatePST(args.timeline,pstopts,rawData);
40
+    disp('done');
30 41
 end
31 42
 
32 43
 assignin('base','subjectStruct',subjectStruct);
Browse code

roi image working

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

Christoph Budziszewski authored on25/02/2009 13:40:40
Showing1 changed files
... ...
@@ -1,37 +1,35 @@
1
-function runROIImageMaskMode(subjects,timeline)
1
+function runROIImageMaskMode(args)
2 2
 
3
-%         imageStruct = loadImageFileNamesData(loadParams);
4
-%         assignin('base','imageStruct',imageStruct);
5
-        
6
-%         coordinateStruct = computeCoordinates(imageStruct);
7
-%         assignin('base','coordinateStruct',coordinateStruct);
3
+subjects = args.subjects;
4
+mask     = ['^' cell2mat(args.mask) '.*\.img$'];
5
+    
6
+nSubjects = size(subjects);
7
+sessionlist = 1:3;
8
+
9
+
10
+for s = 1:nSubjects
11
+    subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
12
+    subjectStruct{s}.name = cell2mat(subjects(s));
13
+    subjectStruct{s}.roiFile = ui_selectRoiImage(...
14
+        sprintf('Select ROI Files for %s',subjectStruct{s}.name),...
15
+        fullfile(subjectStruct{s}.dir,'results','roi'));
16
+end
17
+
18
+
19
+
20
+for s = 1:nSubjects
21
+    % load image data
22
+   
23
+    disp('fetching volume definitions, please wait');
24
+    subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,mask));
25
+
26
+    disp('computing volume values, please wait');
27
+    subjectStruct{s}.rawData = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
28
+    % calculate psth
29
+          
8 30
 end
9 31
 
10
-function extr = claculateRoiImageData(filenameList,roiImageList)
11
-
12
-V = filenameList;
13
-nImage = numel(V);
14
-Vm = roiImageList;
15
-nRoi = numel(Vm);
16
-for kImage=1:nImage
17
-    x = []; y = []; z = [];
18
-    for iRoiFile = 1:nRoi
19
-        [x1 y1] = ndgrid(1:V(k).dim(1),1:V(k).dim(2));
20
-        for p = 1:V(k).dim(3) % resample mask Vm(i) in space of V(k)
21
-            B = spm_matrix([0 0 -p 0 0 0 1 1 1]);
22
-            M = inv(B*inv(V(k).mat)*Vm(iRoiFile).mat);
23
-            msk = find(spm_slice_vol(Vm(iRoiFile),M,V(k).dim(1:2),0));
24
-            if ~isempty(msk)
25
-                z1 = p*ones(size(msk(:)));
26
-                x = [x; x1(msk(:))];
27
-                y = [y; y1(msk(:))];
28
-                z = [z; z1];
29
-            end
30
-        end
31
-        dat = spm_sample_vol(V(k), x, y, z,0);
32
-
33
-        extr(kImage).dat(iRoiFile) = dat;
34
-    end
32
+assignin('base','subjectStruct',subjectStruct);
33
+
35 34
 end
36 35
 
37
-end
38 36
\ No newline at end of file
Browse code

save load working for most parameters.

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

Christoph Budziszewski authored on18/02/2009 17:48:16
Showing1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 function runROIImageMaskMode(subjects,timeline)
2 2
 
3
-        imageStruct = loadImageFileNamesData(loadParams);
4
-        assignin('base','imageStruct',imageStruct);
3
+%         imageStruct = loadImageFileNamesData(loadParams);
4
+%         assignin('base','imageStruct',imageStruct);
5 5
         
6 6
 %         coordinateStruct = computeCoordinates(imageStruct);
7 7
 %         assignin('base','coordinateStruct',coordinateStruct);
Browse code

started save/load functionality.

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

Christoph Budziszewski authored on18/02/2009 15:59:39
Showing1 changed files
... ...
@@ -1,7 +1,4 @@
1
-function runROIImageMaskMode(timeline,parameterModel)
2
-        loadParams.StudyID = 'CHOICE24';
3
-        loadParams.use_smoothed_image_hack = 1;
4
-        loadParams.subjectCellArray = getSubjectIDString(parameterModel);
1
+function runROIImageMaskMode(subjects,timeline)
5 2
 
6 3
         imageStruct = loadImageFileNamesData(loadParams);
7 4
         assignin('base','imageStruct',imageStruct);
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,4 +1,4 @@
1
-function runROIImageMaskMode(parameterModel)
1
+function runROIImageMaskMode(timeline,parameterModel)
2 2
         loadParams.StudyID = 'CHOICE24';
3 3
         loadParams.use_smoothed_image_hack = 1;
4 4
         loadParams.subjectCellArray = getSubjectIDString(parameterModel);
Browse code

moved things

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

Christoph Budziszewski authored on09/02/2009 16:44:50
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+function runROIImageMaskMode(parameterModel)
2
+        loadParams.StudyID = 'CHOICE24';
3
+        loadParams.use_smoothed_image_hack = 1;
4
+        loadParams.subjectCellArray = getSubjectIDString(parameterModel);
5
+
6
+        imageStruct = loadImageFileNamesData(loadParams);
7
+        assignin('base','imageStruct',imageStruct);
8
+        
9
+%         coordinateStruct = computeCoordinates(imageStruct);
10
+%         assignin('base','coordinateStruct',coordinateStruct);
11
+end
12
+
13
+function extr = claculateRoiImageData(filenameList,roiImageList)
14
+
15
+V = filenameList;
16
+nImage = numel(V);
17
+Vm = roiImageList;
18
+nRoi = numel(Vm);
19
+for kImage=1:nImage
20
+    x = []; y = []; z = [];
21
+    for iRoiFile = 1:nRoi
22
+        [x1 y1] = ndgrid(1:V(k).dim(1),1:V(k).dim(2));
23
+        for p = 1:V(k).dim(3) % resample mask Vm(i) in space of V(k)
24
+            B = spm_matrix([0 0 -p 0 0 0 1 1 1]);
25
+            M = inv(B*inv(V(k).mat)*Vm(iRoiFile).mat);
26
+            msk = find(spm_slice_vol(Vm(iRoiFile),M,V(k).dim(1:2),0));
27
+            if ~isempty(msk)
28
+                z1 = p*ones(size(msk(:)));
29
+                x = [x; x1(msk(:))];
30
+                y = [y; y1(msk(:))];
31
+                z = [z; z1];
32
+            end
33
+        end
34
+        dat = spm_sample_vol(V(k), x, y, z,0);
35
+
36
+        extr(kImage).dat(iRoiFile) = dat;
37
+    end
38
+end
39
+
40
+end
0 41
\ No newline at end of file