-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_headmodel_surfaces.m
102 lines (79 loc) · 3.25 KB
/
plot_headmodel_surfaces.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
clear
clc
%% path 2 surfaces and electrodes position
path2folder = 'data\head_model_NMTv2\surfaces';
%% plot head model surfaces
for ii=1:4
if ii==1
disp('Cortex')
load(fullfile(path2folder, 'tess_cortex_pial.mat'))
figure;
V = [1 1 1].*196./255;
p1 = patch('Faces', Faces, 'Vertices', Vertices, ...
'FaceVertexCdata',V, 'FaceAlpha', 0.8); % draw cortex
set (p1,'EdgeColor','none','FaceColor','flat', ...
'FaceLighting','phong','diffuseStrength',0.8 );
camlight right;
elseif ii==2 % inner skull
disp('Inner skull')
load(fullfile(path2folder, 'tess_innerskull_bem.mat'))
hold on;
V = [250 153 153]./255;
p1 = patch('Faces', Faces, 'Vertices', Vertices,'FaceVertexCdata',V, ...
'FaceAlpha', 0.3); % draw
set (p1,'EdgeColor','none','FaceColor','flat','FaceLighting', ...
'phong','diffuseStrength',0.8 );
% camlight right;
% lighting phong;
elseif ii==3 % outer skull
disp('Outer skull')
load(fullfile(path2folder, 'tess_outerskull_bem.mat'))
hold on;
V = [250 204 204]./255;
p1 = patch('Faces', Faces, 'Vertices', Vertices, ...
'FaceVertexCdata',V, 'FaceAlpha', 0.3); % draw
set (p1,'EdgeColor','none','FaceColor','flat','FaceLighting', ...
'phong','diffuseStrength',0.8 );
% camlight right;
% lighting phong;
else % scalp
disp('Scalp')
load(fullfile(path2folder, 'tess_head_bem.mat'))
hold on;
V = [250 178 102]./255;
p1 = patch('Faces', Faces, 'Vertices', Vertices, ...
'FaceVertexCdata',V, 'FaceAlpha', 0.2); % draw
set (p1,'EdgeColor','none','FaceColor','flat','FaceLighting', ...
'phong','diffuseStrength',0.8 );
set(gca,'YTickLabel',[],'YTick',[],'YColor',[1 1 1], ...
'XTickLabel',[],'XTick',[],'XColor',[1 1 1], ...
'ZTickLabel',[],'ZTick',[],'ZColor',[1 1 1])
% camlight right;
% lighting phong;
end
end
%% electrodes
load(fullfile(path2folder,'electrodes.mat'))
selected_electrodes = [6 11 15 31];
hold on;
plot3(electrodes(selected_electrodes, 1), electrodes(selected_electrodes, 2), ...
electrodes(selected_electrodes, 3), '.y', 'MarkerSize',30)
text(electrodes(selected_electrodes, 1), electrodes(selected_electrodes, 2), ...
electrodes(selected_electrodes, 3), labels(selected_electrodes))
%% plot dipoles
load(fullfile(path2folder, 'tess_cortex_pial.mat'))
load('SEF_vert_and_orient.mat')
figure;
V = [1 1 1].*196./255; %[0.6350 0.0780 0.1840];
p1 = patch('Faces', Faces, 'Vertices', Vertices,'FaceVertexCdata',V, ...
'FaceAlpha', 0.8); % draw the outer cortex
set (p1,'EdgeColor','none','FaceColor','flat','FaceLighting', ...
'phong','diffuseStrength',0.8 );
camlight right;
hold on;
quiver3(Vertices(ind, 1), Vertices(ind, 2), Vertices(ind, 3),...
orientation(:,1), orientation(:,2), orientation(:,3), 'Color', 'k', ...
'LineWidth',1.5,'Marker','.', 'MarkerSize',10)
set(gca,'YTickLabel',[],'YTick',[],'YColor',[1 1 1], ...
'XTickLabel',[],'XTick',[],'XColor',[1 1 1], ...
'ZTickLabel',[],'ZTick',[],'ZColor',[1 1 1])