-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathctmr_gauss_plot.m
93 lines (83 loc) · 3.1 KB
/
ctmr_gauss_plot.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
function ctmr_gauss_plot(cortex,electrodes,weights)
% function [electrodes]=ctmr_gauss_plot(cortex,electrodes,weights)
% projects electrode locations onto their cortical spots in the
% left hemisphere and plots about them using a gaussian kernel
% for only cortex use:
% ctmr_gauss_plot(cortex,[0 0 0],0)
% rel_dir=which('loc_plot');
% rel_dir((length(rel_dir)-10):length(rel_dir))=[];
% addpath(rel_dir)
% Copyright (C) 2009 K.J. Miller & D. Hermes, Dept of Neurology and Neurosurgery, University Medical Center Utrecht
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% Version 1.1.0, released 26-11-2009
%load in colormap
load('loc_colormap')
brain=cortex.vert;
v='l';
% %view from which side?
% temp=1;
% while temp==1
% disp('---------------------------------------')
% disp('to view from right press ''r''')
% disp('to view from left press ''l''');
% v=input('','s');
% if v=='l'
% temp=0;
% elseif v=='r'
% temp=0;
% else
% disp('you didn''t press r, or l try again (is caps on?)')
% end
% end
if length(weights)~=length(electrodes(:,1))
error('you sent a different number of weights than electrodes (perhaps a whole matrix instead of vector)')
end
%gaussian "cortical" spreading parameter - in mm, so if set at 10, its 1 cm
%- distance between adjacent electrodes
gsp=50;
c=zeros(length(cortex(:,1)),1);
for i=1:length(electrodes(:,1))
b_z=abs(brain(:,3)-electrodes(i,3));
b_y=abs(brain(:,2)-electrodes(i,2));
b_x=abs(brain(:,1)-electrodes(i,1));
% d=weights(i)*exp((-(b_x.^2+b_z.^2+b_y.^2).^.5)/gsp^.5); %exponential fall off
d=weights(i)*exp((-(b_x.^2+b_z.^2+b_y.^2))/gsp); %gaussian
c=c+d';
end
% c=(c/max(c));
a=tripatch(cortex, '', c');
shading interp;
a=get(gca);
%%NOTE: MAY WANT TO MAKE AXIS THE SAME MAGNITUDE ACROSS ALL COMPONENTS TO REFLECT
%%RELEVANCE OF CHANNEL FOR COMPARISON's ACROSS CORTICES
d=a.CLim;
set(gca,'CLim',[-max(abs(d)) max(abs(d))])
l=light;
colormap(cm)
lighting gouraud; %play with lighting...
% material dull;
material([.3 .8 .1 10 1]);
axis off
set(gcf,'Renderer', 'zbuffer')
if v=='l'
view(270, 0);
set(l,'Position',[-1 0 1])
elseif v=='r'
view(90, 0);
set(l,'Position',[1 0 1])
end
% %exportfig
% exportfig(gcf, strcat(cd,'\figout.png'), 'format', 'png', 'Renderer', 'painters', 'Color', 'cmyk', 'Resolution', 600, 'Width', 4, 'Height', 3);
% disp('figure saved as "figout"');