[FieldTrip] Beamformer source localization for EEG, template MRI & standard BEM

fosco bernasconi fosco.bernasconi at gmail.com
Wed Mar 2 15:29:53 CET 2016

Dear all,

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.

I have few errors:

1. When computing the leadfield:

 Warning: dipole lies on boundary of volume model
> In forward/private/inf_medium_leadfield at 54
  In forward/private/eeg_leadfieldb at 93
  In ft_compute_leadfield at 442
  In ft_prepare_leadfield at 222

2. I tried to discard this error, I cannot compute the source localization:

Error using svd
Input to SVD must not contain NaN or Inf.
Error in beamformer_dics>pinv (line 643)
  [U,S,V] = svd(A,0);
Error in beamformer_dics (line 336)
        filt = pinv(lf' * invCf * lf) * lf' * invCf;              % Gross
        3, use PINV/SVD to cover rank deficient leadfield
Error in ft_sourceanalysis (line 657)
          dip(i) = beamformer_dics(grid, sens, headmodel, [],
          squeeze(Cf(i,:,:)), optarg{:});

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

Here my code:

cfg  = [];
cfg.method     = 'mtmfft';
cfg.output     = 'powandcsd';
cfg.keeptrials = 'yes';
cfg.tapsmofrq  = 2
cfg.foi        = 10;
freq           = ft_freqanalysis(cfg,dataft);

% read electrodes
elec =
elec = ft_convert_units(elec,'cm');
% Load mri:
mri =
mri = ft_convert_units(mri,elec.unit);

% Load headmodel:
vol = ft_convert_units(vol,elec.unit);

[vol, sens] = ft_prepare_vol_sens(vol,elec);

% Load sourcemodel:

% Compute LeadField
cfg           = [];
cfg.channel   = 'eeg';
cfg.elec      = sens;
cfg.headmodel = vol;
grid = ft_prepare_leadfield(cfg,freq);

% Compute Source:
cfg                   = [];
cfg.method            = 'dics';
cfg.grid              = grid;
cfg.vol               = vol;
cfg.keeptrials        = 'yes';
cfg.pcc.lambda        = '5%';
cfg.pcc.projectnoise  = 'yes';
source = ft_sourceanalysis(cfg,freq);

any help is appreciated

thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160302/0ac0c59e/attachment-0001.html>

More information about the fieldtrip mailing list