-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLL_plot.m
More file actions
139 lines (114 loc) · 6.11 KB
/
LL_plot.m
File metadata and controls
139 lines (114 loc) · 6.11 KB
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
function LL_plot(new_anat,new_LL,ts,i,S)
% Created by Natalia Sucher and Jon Kleen May 10 2022, Updated May 26
% 2022 by NS
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %Electrode Activity
%writematrix(LL,'q8_LL.csv') %hardcoding specific file to feed to brain_w8s.m
%Electrode Activity
%Sort new anatomy
[u1,~,u3] = unique(new_anat(:,4)); % u1 = new_anat(u2); u2 = index of new_anat; u3 = index of u1
[~,si] = sort(u3); % sort u3 by electrode index low to high
u3_s = u3(si); % store sorted u3
[~,u2_s] = unique(u3_s); %sort u2 (entries of first mentions) by deleting repetitions in u3_s
%Sort linelength data
LL_s = new_LL(si,:); % sort LL data in ascending electrodes to plot
abv_u1 = {};
%Abbreviate ytick labels
for k = 1:length(u1)
%contains(u1{k},'superiortemporal')
switch u1{k}
case {'parstriangularis'}; abv_u1(k) = {'pt'};
case {'parsopercularis'}; abv_u1(k) = {'pop'};
case {'parsorbitalis'}; abv_u1(k) = {'por'};
%frontal
case {'rostralmiddlefrontal'}; abv_u1(k) = {'rmf'};
case {'caudalmiddlefrontal'}; abv_u1(k) = {'cmf'};
case {'lateralorbitofrontal'}; abv_u1(k) = {'lof'};
%case {'superiorfrontal'}; abv_u1(k) = {'sf'};
case {'medialorbitofrontal'}; abv_u1(k) = {'mof'};
%central
case {'precentral'}; abv_u1(k) = {'prec'};
case {'postcentral'}; abv_u1(k) = {'postc'};
%temporal
case {'middletemporal'}; abv_u1(k) = {'mtg'};
case {'superiortemporal'}; abv_u1(k) = {'stg'};
case {'inferiortemporal'}; abv_u1(k) = {'itg'};
case {'parahippocampal'}; abv_u1(k) = {'ph'};
case {'Right-Hippocampus'}; abv_u1(k) = {'rhp'};
case {'Left-Hippocampus'}; abv_u1(k) = {'lhp'};
case {'Right-Amygdala'}; abv_u1(k) = {'ram'};
case {'Left-Amygdala'}; abv_u1(k) = {'lam'};
case {'entorhinal'}; abv_u1(k) = {'ent'};
case {'fusiform'}; abv_u1(k) = {'fus'};
%poles
case {'temporalpole'}; abv_u1(k) = {'tp'};
%case {'frontalpole'}; abv_u1(k) = {'fp'};
%marginal
case {'supramarginal'}; abv_u1(k) = {'sm'};
%other
case {'lingual'}; abv_u1(k) = {'lg'};
% case 'Right-Inf-Lat-Vent';
case {'Right-Cerebral-White-Matter'}; abv_u1(k) = {'rcwm'};
case {'Left-Cerebral-White-Matter'}; abv_u1(k) = {'lcwm'};
% case 'ctx...';
case {'bankssts'}; abv_u1(k) = {'bsts'};
case {'Right-choroid-plexus'}; abv_u1(k) = {'rchp'};
case {'Right-Putamen'}; abv_u1(k) = {'rput'};
case {'Right-VentralDC'}; abv_u1(k) = {'rvdc'};
case {'inferiorparietal'}; abv_u1(k) = {'ipt'};
case {'superiorparietal'}; abv_u1(k) = {'spt'};
end
end
%Average space between yticks for spacious labels
[LL_s_row,~] = size(LL_s);
[label_row,~] = size(u2_s);
avg_yt_LL = nan(1,label_row);
for i = 2:length(u2_s) + 1
if i < length(u2_s)+1
avg_yt_LL(i-1) = u2_s(i-1) + (u2_s(i) - u2_s(i-1))/2;
elseif i == length(u2_s) + 1 %20
avg_yt_LL(i-1) = u2_s(i-1) + (LL_s_row - u2_s(i-1))/2;
end
% elseif i == length(u2_s)
% avg_yt_LL(i-1) = u2_s(i-1) + (u2_s(i) - u2_s(i))/2;
% avg_yt_LL(i) = u2_s(i-1) + (LL_s_row - u2_s(i))/2;
% end
% end
%avg_yt_LL(length(u2_s)) = u2_s(i); % added to account for last average in for loop
end
% for i = 2:length(u2_s)
% i
% if i < length(u2_s)
% avg_yt_LL(i-1) = u2_s(i-1) + (u2_s(i) - u2_s(i-1))/2;
% elseif i == length(u2_s)
% avg_yt_LL(i-1) = u2_s(i-1) + (u2_s(i) - u2_s(i))/2;
% avg_yt_LL(i) = u2_s(i-1) + (LL_s_row - u2_s(i))/2;
% end
% % end
% %avg_yt_LL(length(u2_s)) = u2_s(i); % added to account for last average in for loop
% end
% avg_yt_LL = [];
% for i = 2:length(u2_s)
% avg_yt_LL(i-1) = u2_s(i-1) + (u2_s(i) - u2_s(i-1))/2;
% end
% variables for y axis
ytl_LL = abv_u1; %ytick labels for LL_s plot
yt_LL = avg_yt_LL; %yticks for LL_s plot
% set new_LL and neuroanatomy labels as global
setGlobal_sem_w8s(LL_s,ytl_LL,yt_LL,u2_s,u3_s)
% display plot with pcolor
pcolor(ts,1:size(new_LL,1),LL_s);
shading flat;
% modify axes
xlabel('Time (seconds)')
set(gca,'ytick',yt_LL,'yticklabel',ytl_LL,'ydir','reverse','yaxislocation','right','fontsize',8)
title('Line Length')
tx=diff(xlim);
caxis(S.cax)
hold on; plot(xlim,[u2_s u2_s],'w-')
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %Time Stamp
% Time Marking
%show vertical white lines to denote when semiology plot beginsand ends
SEMperiod = getGlobalSEMperiod;
plot([SEMperiod(1) SEMperiod(1)],ylim,'w-');
plot([SEMperiod(2) SEMperiod(2)],ylim,'w-');
%hold on;