0001 function vb_plot_sensor_2d(x,z,clim, face_disp, highlight_channel_ix, XY_scale)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 if nargin<3, clim = []; end
0028 if size(z,2)==1, z = z'; end
0029 if ~exist('highlight_channel_ix', 'var')
0030 highlight_channel_ix = [];
0031 end
0032 if ~exist('XY_scale', 'var') || isempty(XY_scale)
0033 XY_scale = 1;
0034 end
0035
0036
0037 cla;
0038
0039 [phi,theta,r] = cart2sph(x(:,1),x(:,2),x(:,3));
0040 [xa,ya,za] = pol2cart(phi,0.5*pi-theta,r);
0041
0042
0043 ya = ya * -1;
0044 xa = xa * -1;
0045
0046 dx = (max(xa)-min(xa))/200;
0047 dy = (max(ya)-min(ya))/200;
0048 r_max = max(sqrt(xa.^2+ya.^2));
0049 xaa = xa;
0050 yaa = ya;
0051
0052
0053 xa = [xa; (XY_scale*1.1*r_max*cos(0:0.02*pi:1.99*pi))'];
0054 ya = [ya; (XY_scale*1.1*r_max*sin(0:0.02*pi:1.99*pi))'];
0055 za = [z'; zeros(100,1)];
0056
0057
0058 warning('off', 'MATLAB:griddata:DuplicateDataPoints');
0059 [X,Y,Z] = griddata(xa,ya,za,...
0060 (min(xa):dx:max(xa)),...
0061 (min(ya):dy:max(ya))','cubic');
0062 warning('on', 'MATLAB:griddata:DuplicateDataPoints');
0063 [C,h] = contourf(X,Y,Z,20);
0064
0065 if ~isempty(clim),
0066 caxis(clim);
0067 else
0068 clim = get(gca,'CLim');
0069 if abs(clim(1))>abs(clim(2)), clim(2) = abs(clim(1));
0070 else clim(1) = -1*abs(clim(2)); end
0071 caxis(clim);
0072 end
0073 set(h,'EdgeColor','none');
0074 hold on;
0075
0076
0077 z_max = max(abs(clim));
0078 v = (0.2*z_max):(0.4*z_max):(1.0*z_max);
0079 v = [-1*v(end:-1:1) v];
0080 [C,h] = contourf(X,Y,Z,v);
0081
0082
0083 if vb_matlab_version >= 7
0084 set(h,'Fill','off');
0085 else
0086 set(h,'FaceColor','none');
0087 end
0088
0089 plot(xaa,yaa,'ko','MarkerSize',2);
0090 set(gca,'XDir','reverse');
0091 set(gca,'YDir','reverse');
0092
0093 if ~isempty(highlight_channel_ix)
0094 xaw = xa(highlight_channel_ix);
0095 yaw = ya(highlight_channel_ix);
0096 plot(xaw,yaw,'ko','MarkerSize',6, 'MarkerEdgeColor','w', 'MarkerFaceColor',[1, 1, 1]);
0097 end
0098
0099 if exist('face_disp', 'var') && face_disp
0100 vb_plot_sensor_2d_head_plot_add(gca);
0101 end
0102
0103
0104
0105 return;