<div dir="ltr"><div><div><div><div>Dear all,<br><br></div>I'm trying to compute source localization (to eventually do some connectivity in the source space) on my EEG data, using template mri and standard bem. <br><br></div>I have few errors:<br><br></div>1. When computing the leadfield:<br><br> Warning: dipole lies on boundary of volume model <br>> In forward/private/inf_medium_leadfield at 54<br>  In forward/private/eeg_leadfieldb at 93<br>  In ft_compute_leadfield at 442<br>  In ft_prepare_leadfield at 222 <br><br></div>2. I tried to discard this error, I cannot compute the source localization:<br><br>Error using svd<br>Input to SVD must not contain NaN or Inf.<br>Error in beamformer_dics>pinv (line 643)<br>  [U,S,V] = svd(A,0);<br>Error in beamformer_dics (line 336)<br>        filt = pinv(lf' * invCf * lf) * lf' * invCf;              % Gross eqn.<br>        3, use PINV/SVD to cover rank deficient leadfield<br>Error in ft_sourceanalysis (line 657)<br>          dip(i) = beamformer_dics(grid, sens, headmodel, [],<br>          squeeze(Cf(i,:,:)), optarg{:});<br><div><div><div><div><div><br><br></div><div>According to previous posts, the second error might be due to labeling of the electrodes. But the labels are ok, and I can make everything work when using the mne (by adapting the script of course) instead of beamforming. Therefore, I think the problem is more related to some of the previous steps.   <br><br></div><div>Here my code:<br><br><br>cfg  = [];<br>cfg.method     = 'mtmfft';<br>cfg.output     = 'powandcsd';<br>cfg.keeptrials = 'yes';<br>cfg.tapsmofrq  = 2<br>cfg.foi        = 10;<br>freq           = ft_freqanalysis(cfg,dataft);<br></div><div><br>% read electrodes<br>elec = ft_read_sens('/home/sv/Matlabtoolboxes/fieldtrip-20160223/template/electrode/biosemi64_1.sfp');<br>elec = ft_convert_units(elec,'cm');<br>% Load mri:<br>mri = ft_read_mri('/home/sv/Matlabtoolboxes/fieldtrip-20160223/external/spm8/templates/T1.nii');<br>mri = ft_convert_units(mri,elec.unit);<br><br>% Load headmodel:<br>load('/home/sv/Matlabtoolboxes/fieldtrip-20160223//template/headmodel/standard_bem.mat');<br>vol = ft_convert_units(vol,elec.unit);<br><br>[vol, sens] = ft_prepare_vol_sens(vol,elec);<br><br>% Load sourcemodel:<br>load('standard_sourcemodel3d8mm.mat');<br><br>% Compute LeadField<br>cfg           = [];<br>cfg.channel   = 'eeg';<br>cfg.elec      = sens;<br>cfg.headmodel = vol; <br>grid = ft_prepare_leadfield(cfg,freq);<br><br>% Compute Source:<br>cfg                   = [];<br>cfg.method            = 'dics';<br>cfg.grid              = grid;<br>cfg.vol               = vol;<br>cfg.keeptrials        = 'yes';<br>cfg.pcc.lambda        = '5%';<br>cfg.pcc.projectnoise  = 'yes';<br>source = ft_sourceanalysis(cfg,freq);<br><br><br> any help is appreciated <br><br>thanks a lot!<br></div><div>fosco<br></div><div><br><br><br><br><br><br></div><div><br><br></div></div></div></div></div></div>