Browse code

removed unused functions

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

Christoph Budziszewski authored on31/07/2009 10:29:51
Showing1 changed files
... ...
@@ -1,5 +1,6 @@
1
-%function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,data,sessionList)
1
+%function pst = calculatePST(timeline,pstopts,data)
2 2
 function pst = calculatePST(timeline,pstopts,data)
3
+%function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,data,sessionList)
3 4
     des         = pstopts.des;
4 5
     eventList   = pstopts.eventList;
5 6
     sessionList = pstopts.sessionList;
Browse code

added TR

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

Christoph Budziszewski authored on16/04/2009 17:00:50
Showing1 changed files
... ...
@@ -11,14 +11,14 @@ function pst = calculatePST(timeline,pstopts,data)
11 11
     edur            = 12;
12 12
     pre             = timeline.psthStart;
13 13
     post            = timeline.psthEnd;
14
-    res             = 1;
14
+    tr              = timeline.tr;
15
+    res             = tr * timeline.trFactor;
15 16
 
16 17
     normz           = 'file';
17 18
     pm              = 0;
18 19
 
19 20
     lsess           = getNumberOfScans(des);
20 21
     nSessions       = getNumberOfSessions(des);
21
-    tr              = 2;
22 22
 
23 23
     [evntrow evntcol]=size(eventList);
24 24
     
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
... ...
@@ -3,6 +3,8 @@ function pst = calculatePST(timeline,pstopts,data)
3 3
     des         = pstopts.des;
4 4
     eventList   = pstopts.eventList;
5 5
     sessionList = pstopts.sessionList;
6
+    col_bias_removal = pstopts.colBias;
7
+    norm4SVM         = pstopts.psthNorm; %Normalization method for SVM
6 8
 
7 9
     bstart          = timeline.baselineStart;
8 10
     bend            = timeline.baselineEnd;
... ...
@@ -129,7 +131,7 @@ function pst = calculatePST(timeline,pstopts,data)
129 131
     end;
130 132
     
131 133
     %%%%COL BIAS REMOVAL, added 090110 %%%%%
132
-    col_bias_removal=1;
134
+
133 135
     if col_bias_removal
134 136
 
135 137
         for zr=1:evntrow % Event ROW
... ...
@@ -155,8 +157,7 @@ function pst = calculatePST(timeline,pstopts,data)
155 157
     
156 158
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
157 159
 
158
-    norm4SVM='mean'; %Normalization method for SVM
159
-    disp(['normalization: ' norm4SVM]);   
160
+%     disp(['normalization: ' norm4SVM]);   
160 161
     % none - no normalization
161 162
     % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
162 163
     % minmax - all PSTHs between [0 1]
Browse code

all enabled features working: PRE: roi-image and coord-table CLASS: batch svm and x-subject svm PLOT: raw psth per voxel, subject performance, mean performance and SE

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

Christoph Budziszewski authored on16/03/2009 18:11:30
Showing1 changed files
... ...
@@ -155,7 +155,7 @@ function pst = calculatePST(timeline,pstopts,data)
155 155
     
156 156
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
157 157
 
158
-    norm4SVM='minmax'; %Normalization method for SVM
158
+    norm4SVM='mean'; %Normalization method for SVM
159 159
     disp(['normalization: ' norm4SVM]);   
160 160
     % none - no normalization
161 161
     % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
Browse code

GUI Task Switch: selfmade TabbedPanel

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

Christoph Budziszewski authored on16/03/2009 16:03:31
Showing1 changed files
... ...
@@ -138,7 +138,6 @@ function pst = calculatePST(timeline,pstopts,data)
138 138
             for ze=1:evntcol % Even COL
139 139
                 if ze==1 || (ze>1 && eventList(zr,ze)~=eventList(zr,ze-1))
140 140
                     n_col=n_col+1;
141
-                    tmp_index=[];
142 141
                     tmp_index=find(pstevnt{zr}(:)==eventList(zr,ze));
143 142
                     % Calculate Average PST for each COL within ROW
144 143
                     pst4col(n_col,:)=nanmean(pst{zr}(tmp_index,:));
... ...
@@ -153,16 +152,10 @@ function pst = calculatePST(timeline,pstopts,data)
153 152
         end;
154 153
     end;
155 154
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
156
-                
157
-            
158
-            
159
-    
160
-    
161
-    
162 155
     
163 156
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
164 157
 
165
-    norm4SVM='mean'; %Normalization method for SVM
158
+    norm4SVM='minmax'; %Normalization method for SVM
166 159
     disp(['normalization: ' norm4SVM]);   
167 160
     % none - no normalization
168 161
     % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
Browse code

refactored to arg-structs! (untested)

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

Christoph Budziszewski authored on29/01/2009 16:25:27
Showing1 changed files
... ...
@@ -1,9 +1,14 @@
1
-function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,data,sessionList)
2
-    bstart          = baselineStart;
3
-    bend            = baselineEnd;
1
+%function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,data,sessionList)
2
+function pst = calculatePST(timeline,pstopts,data)
3
+    des         = pstopts.des;
4
+    eventList   = pstopts.eventList;
5
+    sessionList = pstopts.sessionList;
6
+
7
+    bstart          = timeline.baselineStart;
8
+    bend            = timeline.baselineEnd;
4 9
     edur            = 12;
5
-    pre             =  globalStart;
6
-    post            =  globalEnd;
10
+    pre             = timeline.psthStart;
11
+    post            = timeline.psthEnd;
7 12
     res             = 1;
8 13
 
9 14
     normz           = 'file';
Browse code

labels for axis

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

Axel Lindner authored on26/01/2009 18:36:09
Showing1 changed files
... ...
@@ -124,7 +124,7 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
124 124
     end;
125 125
     
126 126
     %%%%COL BIAS REMOVAL, added 090110 %%%%%
127
-    col_bias_removal=0;
127
+    col_bias_removal=1;
128 128
     if col_bias_removal
129 129
 
130 130
         for zr=1:evntrow % Event ROW
Browse code

New Option for COL Bias removal in calculatePST

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

Axel Lindner authored on10/01/2009 08:50:16
Showing1 changed files
... ...
@@ -93,12 +93,13 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
93 93
 
94 94
                         n{zr}=n{zr}+1;
95 95
                         pst{zr}(n{zr},:)=interp1(stime,sdata(:,sessionID),[des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+pre:res:des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+post],'linear');
96
+                        pstevnt{zr}(n{zr})=eventList(zr,ze); % NEW 090110 Specify #Event/Condition for each PST
96 97
                         if strcmp(normz,'epoc')
97 98
                             bline=nanmean(pst{zr}(n{zr},round(-pre/res+(bstart)/res+1):round(-pre/res+(bend)/res+1)));
98 99
                             if isnan(bline)
99 100
                                 pst{zr}(n{zr},1:-pre/res+post/res+1)=nan;
100 101
                             else
101
-%                                     nn{zr}=nn{zr}+1;
102
+                                nn{zr}=nn{zr}+1;
102 103
                                 pst{zr}(n{zr},:)=(pst{zr}(n{zr},:)-bline)/bline*100; % 'epoch-based' normalization
103 104
                             end;
104 105
                         end;
... ...
@@ -122,9 +123,41 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
122 123
         end;
123 124
     end;
124 125
     
126
+    %%%%COL BIAS REMOVAL, added 090110 %%%%%
127
+    col_bias_removal=0;
128
+    if col_bias_removal
129
+
130
+        for zr=1:evntrow % Event ROW
131
+            pst4row(zr,:)=nanmean(pst{zr}); % Average PST for overall ROW
132
+            n_col=0;
133
+            for ze=1:evntcol % Even COL
134
+                if ze==1 || (ze>1 && eventList(zr,ze)~=eventList(zr,ze-1))
135
+                    n_col=n_col+1;
136
+                    tmp_index=[];
137
+                    tmp_index=find(pstevnt{zr}(:)==eventList(zr,ze));
138
+                    % Calculate Average PST for each COL within ROW
139
+                    pst4col(n_col,:)=nanmean(pst{zr}(tmp_index,:));
140
+                    % COL BIAS: Calculate Difference between COL Ave and Overall Row Ave
141
+                    pst_delta(n_col,:)=pst4col(n_col,:)-pst4row(zr,:);
142
+                    % Remove COL BIAS from single PSTs
143
+                    for z=1:length(tmp_index)
144
+                        pst{zr}(tmp_index(z),:)=pst{zr}(tmp_index(z),:)-pst_delta(n_col,:);
145
+                    end;
146
+                end;
147
+            end;
148
+        end;
149
+    end;
150
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
151
+                
152
+            
153
+            
154
+    
155
+    
156
+    
157
+    
125 158
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
126 159
 
127
-    norm4SVM='none'; %Normalization method for SVM
160
+    norm4SVM='mean'; %Normalization method for SVM
128 161
     disp(['normalization: ' norm4SVM]);   
129 162
     % none - no normalization
130 163
     % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
Browse code

New Normalization Methods in CalculatePST

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

Axel Lindner authored on09/01/2009 16:47:12
Showing1 changed files
... ...
@@ -123,19 +123,32 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
123 123
     end;
124 124
     
125 125
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
126
+
127
+    norm4SVM='none'; %Normalization method for SVM
128
+    disp(['normalization: ' norm4SVM]);   
129
+    % none - no normalization
130
+    % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
131
+    % minmax - all PSTHs between [0 1]
132
+    
133
+    for zr=1:evntrow
134
+          tmp_maxmean(zr)=max(nanmean(pst{zr}));
135
+          tmp_max(zr)=max(max(pst{zr}));
136
+          tmp_min(zr)=min(min(pst{zr}));
137
+    end;
126 138
     
127
-%     for zr=1:evntrow
128
-% %        tmp_max(zr)=max(nanmean(pst{zr}));
129
-%           tmp_max(zr)=max(max(pst{zr}));
130
-%           tmp_min(zr)=min(min(pst{zr}));
131
-%     end;
132
-% %    pstmax=max(tmp_max);
133
-% %    pstmin=min(tmp_min);
134
-%     pstmax=max(abs([tmp_max tmp_min]));
135
-%     for zr=1:evntrow
136
-%         pst{zr}=pst{zr}./pstmax-.5;
137
-% %        pst{zr}=(pst{zr}-pstmin)./(pstmax-pstmin);
138
-%     end;
139
+    pstmaxmean=max(tmp_maxmean);
140
+    pstmax=max(tmp_max);
141
+    pstmin=min(tmp_min);
142
+    
143
+    for zr=1:evntrow
144
+        switch norm4SVM
145
+            case {'none'}
146
+            case {'mean'}
147
+                pst{zr}=pst{zr}./pstmaxmean-.5;
148
+            case {'minmax'}
149
+                pst{zr}=(pst{zr}-pstmin)./(pstmax-pstmin);
150
+        end;
151
+    end;
139 152
     
140 153
     
141 154
     
Browse code

plot optimiert. normalisierung pst, zwischenversion UI Defaults verbessert

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

Axel Lindner authored on09/01/2009 15:52:07
Showing1 changed files
... ...
@@ -121,4 +121,23 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
121 121
             end;
122 122
         end;
123 123
     end;
124
+    
125
+    %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
126
+    
127
+%     for zr=1:evntrow
128
+% %        tmp_max(zr)=max(nanmean(pst{zr}));
129
+%           tmp_max(zr)=max(max(pst{zr}));
130
+%           tmp_min(zr)=min(min(pst{zr}));
131
+%     end;
132
+% %    pstmax=max(tmp_max);
133
+% %    pstmin=min(tmp_min);
134
+%     pstmax=max(abs([tmp_max tmp_min]));
135
+%     for zr=1:evntrow
136
+%         pst{zr}=pst{zr}./pstmax-.5;
137
+% %        pst{zr}=(pst{zr}-pstmin)./(pstmax-pstmin);
138
+%     end;
139
+    
140
+    
141
+    
142
+    
124 143
 end
125 144
\ No newline at end of file
Browse code

kleine änderungen code move

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

Christoph Budziszewski authored on08/01/2009 11:44:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,124 @@
1
+function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,data,sessionList)
2
+    bstart          = baselineStart;
3
+    bend            = baselineEnd;
4
+    edur            = 12;
5
+    pre             =  globalStart;
6
+    post            =  globalEnd;
7
+    res             = 1;
8
+
9
+    normz           = 'file';
10
+    pm              = 0;
11
+
12
+    lsess           = getNumberOfScans(des);
13
+    nSessions       = getNumberOfSessions(des);
14
+    tr              = 2;
15
+
16
+    [evntrow evntcol]=size(eventList);
17
+    
18
+
19
+    hsec=str2num(des.xsDes.High_pass_Filter(8:end-3)); % Highpass filter [sec] from SPM.mat
20
+
21
+    if strcmp(des.xBF.UNITS,'secs')
22
+        unitsecs=1;
23
+    end;
24
+
25
+    nScansPerSession=getNumberOfScans(des);
26
+    %stime=[0:tr:max(nScansPerSession)*tr+post-tr]; % Stimulus time for raw data plot
27
+    stime=0:tr:max(nScansPerSession)*tr+round(post/tr)*tr-tr; % Stimulus time for raw data plot
28
+
29
+
30
+
31
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32
+    % RUN
33
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34
+
35
+
36
+    % Digital Highpass
37
+    Rp=0.5;
38
+    Rs=20;
39
+    NO=1;
40
+    Wp=1/((1/2/tr)/(1/hsec));
41
+    [B, A] = ellip(NO,Rp,Rs,Wp,'high');
42
+
43
+    sdata(1:max(nScansPerSession)+round(post/tr),1:nSessions)=nan; % Open Data Matrix
44
+    for z=1:nSessions % Fill Data Matrix sessionwise
45
+        sdata(1:nScansPerSession(z),z)=data(sum(nScansPerSession(1:z))-nScansPerSession(z)+1:sum(nScansPerSession(1:z)))';
46
+    end;
47
+%         usdata=sdata; % Keep unfiltered data
48
+
49
+    sdatamean=nanmean(nanmean(sdata(:,:)));
50
+    for z=1:nSessions
51
+%             X(:,z)=[1:1:max(nScansPerSession)]'; % #Volume
52
+        sdata(1:nScansPerSession(z),z)=filtfilt(B,A,sdata(1:nScansPerSession(z),z)); %Filter Data (Highpass)
53
+    end;
54
+    sdata=sdata+sdatamean;
55
+
56
+
57
+    %%%%Parametric Modulation Modus%%%%
58
+    if pm %Find Parameters for Event of Interest
59
+        [imods modss mods erow evntrow eventList] = getParametricMappingEvents(eventList,evntrow,des,pmf);
60
+    end;
61
+    %%%%PM%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62
+
63
+
64
+    for zr=1:evntrow
65
+        n{zr}=0;
66
+        nn{zr}=0; 
67
+        nnn{zr}=0;
68
+        sstart{zr}=1;
69
+    end;
70
+
71
+
72
+    sesst0=0; 
73
+    for sessionID=sessionList
74
+        if sessionID>1
75
+            sesst0(sessionID)=sum(lsess(1:sessionID-1))*tr;  
76
+        end;
77
+        for zr=1:evntrow  %LABEL NUMBER, EVENT GROUP
78
+            sstart{zr}=n{zr}+1;
79
+            for ze=1:evntcol % EVENT INDEX in EventList
80
+                if ze==1 || (ze>1 && eventList(zr,ze)~=eventList(zr,ze-1))
81
+                    for zz=1:length(des.Sess(sessionID).U(eventList(zr,ze)).ons) % EVENT REPETITION NUMBER
82
+                        if ~unitsecs
83
+                            des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)=(des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)-1)*tr;
84
+                            des.Sess(sessionID).U(eventList(zr,ze)).dur(zz)=(des.Sess(sessionID).U(eventList(zr,ze)).dur(zz)-1)*tr;
85
+                        end;
86
+
87
+                        nnn{zr}=nnn{zr}+1; % INFO for rawdataplot start
88
+                        if des.Sess(sessionID).U(eventList(zr,ze)).dur(zz)<edur
89
+                            mev{zr}(nnn{zr},1:2)=[des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+sesst0(sessionID) edur]; % modeled event [onset length]
90
+                        else
91
+                            mev{zr}(nnn{zr},1:2)=[des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+sesst0(sessionID) des.Sess(sessionID).U(eventList(zr,ze)).dur(zz)];
92
+                        end; % INFO for rawdataplot end
93
+
94
+                        n{zr}=n{zr}+1;
95
+                        pst{zr}(n{zr},:)=interp1(stime,sdata(:,sessionID),[des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+pre:res:des.Sess(sessionID).U(eventList(zr,ze)).ons(zz)+post],'linear');
96
+                        if strcmp(normz,'epoc')
97
+                            bline=nanmean(pst{zr}(n{zr},round(-pre/res+(bstart)/res+1):round(-pre/res+(bend)/res+1)));
98
+                            if isnan(bline)
99
+                                pst{zr}(n{zr},1:-pre/res+post/res+1)=nan;
100
+                            else
101
+%                                     nn{zr}=nn{zr}+1;
102
+                                pst{zr}(n{zr},:)=(pst{zr}(n{zr},:)-bline)/bline*100; % 'epoch-based' normalization
103
+                            end;
104
+                        end;
105
+                    end;
106
+                end;
107
+            end;
108
+            if ~strcmp(normz,'epoc')
109
+                bline(zr)=nanmean(nanmean(pst{zr}(sstart{zr}:n{zr},-pre/res+(bstart)/res+1:-pre/res+(bend)/res+1)));
110
+                bstd(zr)=nanmean(nanstd(pst{zr}(sstart{zr}:n{zr},-pre/res+(bstart)/res+1:-pre/res+(bend)/res+1)));
111
+                nn{zr}=n{zr};
112
+            end;
113
+        end;
114
+        if strcmp(normz,'filz')
115
+            for zr=1:evntrow
116
+                pst{zr}(sstart{zr}:n{zr},:)=(pst{zr}(sstart{zr}:n{zr},:)-mean(bline))/mean(bstd); % session-based z-score normalization
117
+            end;
118
+        elseif strcmp(normz,'file')
119
+            for zr=1:evntrow
120
+                pst{zr}(sstart{zr}:n{zr},:)=(pst{zr}(sstart{zr}:n{zr},:)-mean(bline))/mean(bline)*100; % session-based normalization
121
+            end;
122
+        end;
123
+    end;
124
+end
0 125
\ No newline at end of file