[FieldTrip] Source Reconstruction - Leadfield has NaNs

Anke Ninija Karabanov anke at nexs.ku.dk
Wed Dec 29 23:37:48 CET 2021


I will be out of offie from December 21st to 4th of January and will be checking my email only infrequently during this time. I will respond to your email when I return.

Best
Anke

On 26 Dec 2021, at 17.45, Tibor Auer via fieldtrip <fieldtrip at science.ru.nl> wrote:

Dear Emilie,

It is usually due to rank deficiency in the leadfield. I suggest removing the affected sources. See how it is implemented in Automatic Analysis:
https://github.com/tiborauer/automaticanalysis/blob/82f7a2beac3b690b966933a7aad9c60f2c12a48d/aa_modules/aamod_meeg_sourcereconstruction.m#L185-L221
I hope it helps.

Kind regards,
Tibor

Dr Tibor Auer, MD., PhD.
tibor.auer at gmail.com
+44-7906-863837
@TiborAuer

Feladó: fieldtrip <fieldtrip-bounces at science.ru.nl> E személy nevében: Emilie Caspar via fieldtrip
Küldve: 09 December 2021 11:16
Címzett: FieldTrip discussion list <fieldtrip at science.ru.nl>
Másolatot kap: Emilie Caspar <ecaspar at ulb.ac.be>
Tárgy: [FieldTrip] Source Reconstruction - Leadfield has NaNs

Dear Fieldtripper,
I am currently trying to compute a source reconstruction on my EEG data (Biosemi, 64 electrodes).

I use the following code:

load Subject01_sourcemodel_15684;
headmodel = ft_read_headmodel('headmodel/standard_bem.mat');
electr_pos=ft_read_sens('Biosemi-Cap64.sfp’);

load('GA_GroupPerpetrators_Parents_Neutral_DOUL.mat')

cfg = [];
cfg.method = 'interactive';
cfg.elec = electr_pos;
cfg.headshape = headmodel.bnd(1); %1 = skin
elec = ft_electroderealign(cfg, electr_pos);

cfg         = [];
cfg.elec = elec;   % sensor information
cfg.channel = elec.label;%;  % the used channels
cfg.sourcemodel    = sourcemodel;   % source points
cfg.headmodel = headmodel;   % volume conduction model
cfg.singleshell.batchsize = 5000; % speeds up the computation
leadfield   = ft_prepare_leadfield(cfg);
%%
cfg               = [];
cfg.method        = 'mne';
cfg.elec = elec;
cfg.grid          = leadfield;
cfg.headmodel     = headmodel;
cfg.mne.prewhiten = 'yes';
cfg.mne.lambda    = 3;
cfg.mne.scalesourcecov = 'yes';

source_GA_GroupPerpetrators_Parents_Neutral_DOUL = ft_sourceanalysis(cfg, GA_GroupPerpetrators_Parents_Neutral_DOUL);

However, I got the following error when computing the ft_sourceanalysis:

Error using svd

Input to SVD must not contain NaN or Inf.


Error in beamformer_lcmv>pinv (line 415)

  [U,S,V] = svd(A,0);


Error in beamformer_lcmv (line 297)

    filt = pinv(lf' * invCy * lf) * lf' * invCy;              % van Veen eqn.

    23, use PINV/SVD to cover rank deficient leadfield


Error in ft_sourceanalysis (line 950)

      dip(i) = beamformer_lcmv(grid, sens, headmodel, squeeze_avg, squeeze_Cy,

      optarg{:});


I checked in all the datafiles I use, and the only NaN I found are in the leadfield.leadfield but all the previous steps appear to be correct and contain the correct electrode locations, data, covariance matrix etc.

I am thus not sure how to solve the problem and why my leadfield.leadfield has NaN (or even if the problem comes from there).

Thank you in advance for your help!

Emilie
_______________________________________________
fieldtrip mailing list
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=04%7C01%7Canke%40nexs.ku.dk%7C1679ad96bd2641a91e1d08d9c88f7538%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637761340768975636%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rUa14mj7uJ5Stnr7b6SecyIrzgB0OUSNaBfOg4I7P5o%3D&reserved=0
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=04%7C01%7Canke%40nexs.ku.dk%7C1679ad96bd2641a91e1d08d9c88f7538%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637761340768975636%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bCzvsfnHf4M8uAr7VEwomrCbXsBDQjjxkl%2BPMKRdizs%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211229/39b51a01/attachment.htm>


More information about the fieldtrip mailing list