Home > bioelectromagnetism > elec_plot.m

elec_plot

PURPOSE ^

elec_plot - plots electrode positions in 3D

SYNOPSIS ^

function elec_plot(p)

DESCRIPTION ^

 elec_plot - plots electrode positions in 3D

 Usage: elec_plot(p)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function elec_plot(p)
0002 
0003 % elec_plot - plots electrode positions in 3D
0004 %
0005 % Usage: elec_plot(p)
0006 %
0007 
0008 % $Revision: 1.2 $ $Date: 2005/07/12 21:27:50 $
0009 
0010 % Licence:  GNU GPL, no express or implied warranties
0011 % History:  10/2003, Darren.Weber_at_radiology.ucsf.edu
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 tic; fprintf('\nELEC_PLOT...\n');
0016 
0017 x = p.elec.data.x;
0018 y = p.elec.data.y;
0019 z = p.elec.data.z;
0020 
0021 Xsp = p.elec.data.Xsp;
0022 Ysp = p.elec.data.Ysp;
0023 Zsp = p.elec.data.Zsp;
0024 
0025 Rsp =  p.elec.data.Rsp(1);
0026 
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 % Plot the electrode positions
0029 
0030 figure('NumberTitle','off','Name','Electrode Placements');
0031 set(gca,'Projection','perspective');
0032 set(gca,'DataAspectRatio',[1 1 1]);
0033 
0034 hold on
0035 
0036 plot3(x,y,z,'b.');
0037 plot3(Xsp,Ysp,Zsp,'ro');
0038 legend('input xyz','fitted sphere','Location','BestOutside');
0039 
0040 [Xs,Ys,Zs]=sphere;
0041 Xs = Xs * Rsp;
0042 Ys = Ys * Rsp;
0043 Zs = Zs * Rsp;
0044 
0045 surf(Xs,Ys,Zs,...
0046     'EdgeColor','none',...
0047     'FaceColor',[0.7 0.7 0.7],...
0048     'FaceAlpha',0.4);
0049 view(2);
0050 rotate3d;
0051 
0052 axis tight; hold off;
0053 
0054 t = toc; fprintf('...done (%6.2f sec).\n\n',t);
0055 
0056 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003