Create spatial Laplacian matrix for a slice of data FORMAT [L] = spm_vb_laplacian (vxyz) vxyz list of neighbours of voxels to be analysed L laplacian matrix %W% Will Penny and Nelson Trujillo-Barreto %E%
0001 function [L] = spm_vb_laplacian (vxyz) 0002 % Create spatial Laplacian matrix for a slice of data 0003 % FORMAT [L] = spm_vb_laplacian (vxyz) 0004 % 0005 % vxyz list of neighbours of voxels to be analysed 0006 % L laplacian matrix 0007 % 0008 % %W% Will Penny and Nelson Trujillo-Barreto %E% 0009 0010 voxels=size(vxyz,1); 0011 L=4*speye(voxels); 0012 0013 for j=1:voxels, 0014 0015 L(j,nonzeros(vxyz(j,:)))=-1; 0016 0017 % Ensure normalisation is correct for edges/corners 0018 % keeping this line makes L rank deficient 0019 %L(j,j)=length(nonzeros(vxyz(j,:))); 0020 0021 % With above line commented out, this produces the 0022 % Laplacian used in LORETA, with biased boundary conditions 0023 % - see discussion in section 2 of paper VB2 0024 end;