-
Notifications
You must be signed in to change notification settings - Fork 1
/
manuallydefinedplotting.m
146 lines (129 loc) · 4.56 KB
/
manuallydefinedplotting.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
%% Plotting Topography of Significant clusters with predefined time intervals (an alternative to ft_clusterplot)
function capa_clusterplot = acaba(stat,grandavg1,grandavg2,Fs,alpha,topography_interval);
load('capa_layout');
load('capa_neighbour');
cfg = [];
cfg.parameter = 'avg';
cfg.operation = '(x1-x2)';
raw_effect = ft_math(cfg,grandavg1,grandavg2);
denemeplotting = deneme_interval(stat,Fs,alpha);
neg_existence = isfield(denemeplotting,'neg');
pos_existence = isfield(denemeplotting,'pos');
if pos_existence ==1 && neg_existence ==1
%for positive clusters
if isempty(denemeplotting.pos) == 0;
for k = 1:size(denemeplotting.pos,1);
if denemeplotting.pos(k,3) < 0.05;
N_of_topoplots = round((denemeplotting.pos(k,2) - denemeplotting.pos(k,1))/topography_interval);
time_steps = linspace(denemeplotting.pos(k,1),denemeplotting.pos(k,2),N_of_topoplots);
for i = 1:(N_of_topoplots-1);
a = round((N_of_topoplots-1)/2);
if a >= 6
figure(k)
subplot(round(a/2),4,i)
cfg = [];
cfg.layout = capa_layout;
cfg.xlim = [time_steps(i)/1000 time_steps(i+1)/1000];
cfg.highlight = 'on';
channel_indices = zeros(1,32);
for j = 1:32;
if sum(stat.posclusterslabelmat(j,(round((time_steps(i) - (stat.cfg.latency(1)*1000))*Fs /1000)):((round((time_steps(i+1) - (stat.cfg.latency(1)*1000))*Fs /1000))))) >= 1;
channel_indices(j) = 1;
else
channel_indices(j) = 0;
end
end
channels_to_be_highlighted = find(channel_indices == 1);
cfg.highlightchannel = channels_to_be_highlighted;
cfg.highlightcolor = [1 1 1];
cfg.highlightsize = 8;
ft_topoplotER(cfg,raw_effect)
else
figure(k)
subplot(a,3,i)
cfg = [];
cfg.layout = capa_layout;
cfg.xlim = [time_steps(i)/1000 time_steps(i+1)/1000];
cfg.highlight = 'on';
channel_indices = zeros(1,32);
for j = 1:32;
if sum(stat.posclusterslabelmat(j,(round((time_steps(i) - (stat.cfg.latency(1)*1000))*Fs /1000)):((round((time_steps(i+1) - (stat.cfg.latency(1)*1000))*Fs /1000))))) >= 1;
channel_indices(j) = 1;
else
channel_indices(j) = 0;
end
end
channels_to_be_highlighted = find(channel_indices == 1);
cfg.highlightcolor = [1 1 1];
cfg.highlightsize = 8;
cfg.highlightchannel = channels_to_be_highlighted;
ft_topoplotER(cfg,raw_effect)
end
sgtitle(sprintf('Topographies of %d. positive cluster',k))
end
else
fprintf('No significant clusters to be plotted for the %d. positive cluster',k)
end
end
end
%
% %%% Negative
if isempty(denemeplotting.neg) == 0;
for k = 1:size(denemeplotting.neg,1);
if denemeplotting.neg(k,3) < 0.05;
N_of_topoplots = round((denemeplotting.neg(k,2) - denemeplotting.neg(k,1))/topography_interval);
time_steps = linspace(denemeplotting.neg(k,1),denemeplotting.neg(k,2),N_of_topoplots);
for i = 1:(N_of_topoplots-1);
a = round((N_of_topoplots-1)/2);
if a >= 6
figure(k)
subplot(round(a/2),4,i)
cfg = [];
cfg.layout = capa_layout;
cfg.xlim = [time_steps(i)/1000 time_steps(i+1)/1000];
cfg.highlight = 'on';
channel_indices = zeros(1,32);
for j = 1:32;
if sum(stat.negclusterslabelmat(j,(round((time_steps(i) - (stat.cfg.latency(1)*1000))*Fs /1000)):((round((time_steps(i+1) - (stat.cfg.latency(1)*1000))*Fs /1000))))) >= 1;
channel_indices(j) = 1;
else
channel_indices(j) = 0;
end
end
channels_to_be_highlighted = find(channel_indices == 1);
cfg.highlightchannel = channels_to_be_highlighted;
cfg.highlightcolor = [1 1 1];
cfg.highlightsize = 8;
ft_topoplotER(cfg,raw_effect)
else
figure(k)
subplot(a,3,i)
cfg = [];
cfg.layout = capa_layout;
cfg.xlim = [time_steps(i)/1000 time_steps(i+1)/1000];
cfg.highlight = 'on';
channel_indices = zeros(1,32);
for j = 1:32;
if sum(stat.negclusterslabelmat(j,(round((time_steps(i) - (stat.cfg.latency(1)*1000))*Fs /1000)):((round((time_steps(i+1) - (stat.cfg.latency(1)*1000))*Fs /1000))))) >= 1;
channel_indices(j) = 1;
else
channel_indices(j) = 0;
end
end
channels_to_be_highlighted = find(channel_indices == 1);
cfg.highlightcolor = [1 1 1];
cfg.highlightsize = 8;
cfg.highlightchannel = channels_to_be_highlighted;
ft_topoplotER(cfg,raw_effect)
end
sgtitle(sprintf('Topographies of %d. negative cluster',k))
end
else
fprintf('No significant clusters to be plotted for the %d. negative cluster',k)
end
end
end
else
fprintf('No significant clusters to be plotted')
end
end