Home > bioelectromagnetism > eeg_interp_scalp3D_test.m

eeg_interp_scalp3D_test

PURPOSE ^

eeg_interp_scalp3d_test - Script to test 3D interpolation of scalp potentials

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 eeg_interp_scalp3d_test - Script to test 3D interpolation of scalp potentials

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % eeg_interp_scalp3d_test - Script to test 3D interpolation of scalp potentials
0002 
0003 clear
0004 
0005 p = eeg_toolbox_defaults;
0006 p = eeg_open(p);
0007 p = elec_open(p);
0008 p = mesh_open(p);
0009 
0010 p = mesh_plot(p);
0011 
0012 close all
0013 
0014 scalpvert = p.mesh.data.vertices{3};
0015 
0016 Mean = mean(scalpvert);
0017 STD  = std(scalpvert);
0018 
0019 Min = Mean - 3*STD;
0020 Max = Mean + 3*STD;
0021 
0022 delta = 0.05;
0023 Xd = Min(1):delta:Max(1);
0024 Yd = Min(2):delta:Max(2);
0025 Zd = Min(3):delta:Max(3);
0026 
0027 [x0,y0,z0] = meshgrid(Xd,Yd,Zd);
0028 
0029 X0 = [x0(:), y0(:), z0(:)];
0030 
0031 X = p.mesh.data.vertices{4};
0032 v = p.volt.data(1,:)';
0033 
0034 v0 = griddatan(X,v,X0);
0035 v0 = reshape(v0, size(x0));
0036 
0037 V = v0(:);
0038 Vfinite = find(isfinite(V));
0039 X0finite = X0(Vfinite,:);
0040 
0041 trisurf(convhulln(X0finite),X0finite(:,1),X0finite(:,2),X0finite(:,3),Vfinite,'EdgeColor','none','FaceColor','interp');
0042 
0043 fprintf('\ndone\n');
0044 return
0045 
0046 
0047 %X0scalpindices = dsearchn(X0,scalpvert);
0048 X0scalpindices = dsearchn(X0finite,scalpvert);
0049 
0050 newscalpvert(:,1) = x0(X0scalpindices);
0051 newscalpvert(:,2) = y0(X0scalpindices);
0052 newscalpvert(:,3) = z0(X0scalpindices);
0053 newvoltage = v0(X0scalpindices);
0054 
0055 trisurf(convhulln(newscalpvert),newscalpvert(:,1),newscalpvert(:,2),newscalpvert(:,3),newvoltage,'EdgeColor','none','FaceColor','interp');
0056 
0057 return
0058 
0059 Vplot = mean(v);
0060 
0061 Hp = patch(isosurface(x0,y0,z0,v0,Vplot)); 
0062 isonormals(x0,y0,z0,v0,Hp); 
0063 set(Hp,'FaceColor','red','EdgeColor','none'); 
0064 view(3); 
0065 camlight; 
0066 lighting phong
0067 %axis equal
0068 title('Interpolated isosurface from scattered data')

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