-
Notifications
You must be signed in to change notification settings - Fork 0
/
rd_plotTADetectDiscrimGroupAmpsWholebrain.m
194 lines (183 loc) · 5.98 KB
/
rd_plotTADetectDiscrimGroupAmpsWholebrain.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
function rd_plotTADetectDiscrimGroupAmpsWholebrain(A, measure, subjects, ...
groupData, groupMean, groupSte, ...
saveFigs, figDir, figStr)
%% setup
load data/data_hdr.mat
twin = A.wtwin;
twindow = twin(1):twin(end);
wPAAUT = groupMean.PAAUT;
wPAAU = groupMean.PAAU;
wAUT = groupMean.AUT;
wPAT = groupMean.PAT;
%% itpc
% twindow = A.stftwinvals;
% freq = 30;
% wPAAUT0 = squeeze(groupMean.PAAUT(:,freq,:,:,:));
% wPAAU0 = squeeze(groupMean.PAAU(:,freq,:,:));
% wAUT0 = squeeze(groupMean.AUT(:,freq,:,:,:));
% wPAT0 = squeeze(groupMean.PAT(:,freq,:,:,:));
%
% % switch time and channels dimensions
% for i=1:4
% for j=1:2
% wPAAUT(:,:,i,j) = wPAAUT0(:,:,i,j)';
% end
% wPAAU(:,:,i) = wPAAU0(:,:,i)';
% end
% for i=1:2
% for j=1:2
% wAUT(:,:,i,j) = wAUT0(:,:,i,j)';
% wPAT(:,:,i,j) = wPAT0(:,:,i,j)';
% end
% end
%% plot setup
paauNames = {'P-att','P-unatt','A-att','A-unatt'};
auNames = {'att','unatt'};
paNames = {'P','A'};
switch A.normalizeOption
case 'none'
clims = [0 200];
diffClims = [-40 40];
case 'stim'
clims = [0.5 1.5];
diffClims = [-.3 .3];
end
cmap = flipud(lbmap(64,'RedBlue'));
nBins = 6;
binSize = round(numel(twindow)/nBins);
load parula
%% movie
tstep = 2;
iPAAU = 1;
iT = 1;
figure
for iTime = 1:tstep:numel(twindow)
ssm_plotOnMesh(wPAAUT(iTime,:,iPAAU,iT), ...
sprintf('wPAAUT t=%d',twindow(iTime)),[], data_hdr, '2d');
set(gca,'CLim',clims)
colormap(parula)
pause(.1)
end
%% time bins
fH = [];
% PAAU
figPos = [32 150 200*nBins 750];
for iT = 1:2
fH(1+iT-1) = figure('Position',figPos);
for iPAAU = 1:4
for iBin = 1:nBins
subplot(4,nBins,iBin + nBins*(iPAAU-1))
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('wPAAUT, %s, t=[%d %d]',paauNames{iPAAU}, twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAAUT(tidx,:,iPAAU,iT),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',clims)
colormap(parula)
end
end
rd_supertitle2(sprintf('T%d',iT))
end
% AU
figPos = [32 250 200*nBins 650];
for iT = 1:2
fH(3+iT-1) = figure('Position',figPos);
for iAU = 1:2
for iBin = 1:nBins
subplot(3,nBins,iBin + nBins*(iAU-1))
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('wAUT, %s, t=[%d %d]',auNames{iAU}, twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wAUT(tidx,:,iAU,iT),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',clims)
colormap(parula)
freezeColors
end
end
for iBin = 1:nBins
subplot(3,nBins,iBin + nBins*2)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('wAUT, A-U, t=[%d %d]',twindow(tidx(1)), twindow(tidx(end)));
vals = mean((wAUT(tidx,:,1,iT) - wAUT(tidx,:,2,iT)),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
end
colormap(cmap)
rd_supertitle2(sprintf('T%d',iT))
end
% PA
figPos = [32 250 200*nBins 650];
for iT = 1:2
fH(5+iT-1) = figure('Position',figPos);
for iPA = 1:2
for iBin = 1:nBins
subplot(3,nBins,iBin + nBins*(iPA-1))
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('wPAT, %s, t=[%d %d]',paNames{iPA}, twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAT(tidx,:,iPA,iT),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',clims)
colormap(parula)
freezeColors
end
end
for iBin = 1:nBins
subplot(3,nBins,iBin + nBins*2)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('wPAT, P-A, t=[%d %d]',twindow(tidx(1)), twindow(tidx(end)));
vals = mean((wPAT(tidx,:,1,iT) - wPAT(tidx,:,2,iT)),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
end
colormap(cmap)
rd_supertitle2(sprintf('T%d',iT))
end
% AUDiff for present and absent separately
figPos = [32 250 200*nBins 450];
for iT = 1:2
fH(7+iT-1) = figure('Position',figPos);
for iBin = 1:nBins
subplot(2,nBins,iBin)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('%s, t=[%d %d]','P-att - P-unatt', twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAAUT(tidx,:,1,iT),1) - mean(wPAAUT(tidx,:,2,iT),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
colormap(cmap)
end
for iBin = 1:nBins
subplot(2,nBins,iBin + nBins)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('%s, t=[%d %d]','A-att - A-unatt', twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAAUT(tidx,:,3,iT),1) - mean(wPAAUT(tidx,:,4,iT),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
colormap(cmap)
end
rd_supertitle2(sprintf('T%d',iT))
end
% AUDiff for present and absent separately, T1 & T2 combined
figPos = [32 250 200*nBins 450];
fH(9) = figure('Position',figPos);
for iBin = 1:nBins
subplot(2,nBins,iBin)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('%s, t=[%d %d]','P-att - P-unatt', twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAAU(tidx,:,1),1) - mean(wPAAU(tidx,:,2),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
colormap(cmap)
end
for iBin = 1:nBins
subplot(2,nBins,iBin + nBins)
tidx = (1:binSize+1) + (iBin-1)*binSize;
str = sprintf('%s, t=[%d %d]','A-att - A-unatt', twindow(tidx(1)), twindow(tidx(end)));
vals = mean(wPAAU(tidx,:,3),1) - mean(wPAAU(tidx,:,4),1);
ssm_plotOnMesh(vals,str,[], data_hdr, '2d');
set(gca,'CLim',diffClims)
colormap(cmap)
end
rd_supertitle2('T1 & T2')
if saveFigs
figPrefix = sprintf('%s_map_wholebrain_%dHz', figStr, ssvefFreq);
rd_saveAllFigs(fH, {'wPAAUT1','wPAAUT2','wAUT1','wAUT2','wPAT1','wPAT2','wPAAUDiffT1','wPAAUDiffT2','wPAAUDiffT1T2Comb'}, figPrefix, figDir)
end