⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eeg_interp_sph_spline_test.m

📁 Matlab下的EEG处理程序库
💻 M
字号:
% EEG_INTERP_SPH_SLINE_TEST - Script to test eeg_interp_sph_spline
%

clear

elecpath = 'D:\matlab\cnl\eeg_example_data\';
elecfile = 'elec_124_cart.txt';
voltpath = 'D:\matlab\cnl\eeg_example_data\';
voltfile = 'eeg_data_simulated124.txt'; % (400 rows x 125 columns)
timecol  = 200;
grid     = 0.5;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load electrode co-ordinates and create 3D interpolated surface

    file = strcat(elecpath,elecfile);
    [elec,etype,X,Y,Z,th,phi,r] = elec_load(file,'Cartesian');
    clear th phi r;
    
    % Get electrode dataset centroid (should be <0,0,0>)
    index = find(etype == 99);    xo = X(index);    yo = Y(index);    zo = Z(index);
    
    % Select electrodes only
    index = find(etype == 69);
    elec  = elec(index);        X  = X(index); Y  = Y(index); Z  = Z(index);
    
    [r,x,y,z] = elec_proj_sph(X,Y,Z,xo,yo,zo);
    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load and plot data (400 rows x 125 columns)

    file = strcat(voltpath,voltfile);
    volt = eeg_load_ascii(file)';
    V = volt(1:124,timecol) * 10^6;
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Interpolate the electrode co-ordinates

    figure; %surf(Xi,Yi,Zi,Vi);
    trisurf(delaunay(X,Y),X,Y,Z,V,'EdgeColor','none','FaceColor','interp');
    absmax = max(abs(V)); caxis([-absmax absmax]);
    title 'Orig Potential'; colorbar; rotate3d
    hold on, plot3(X,Y,Z,'.');
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % spherical interpolation
    
    [E,U] = eeg_interp_sph_spline(V,[x y z],24);
    
    X = E(:,1);
    Y = E(:,2);
    Z = E(:,3);
    
    figure;
    USurf = trisurf(delaunay(X,Y),X,Y,Z,U,'EdgeColor','none','FaceColor','interp');
    absmax = max(abs(U)); caxis([-absmax absmax]);
    title 'Spheric Spline Interp Potential'; colorbar; rotate3d
    hold on, plot3(X,Y,Z,'.');
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -