[Eeglablist] fitTwoDipoles error message

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Fri Oct 21 16:56:18 PDT 2022


Dear Arkadiy,

Sorry for the trouble.
Can you please copy and paste the output from the following
snippets applied after loading the dataset the algorithm failed?

EEG.dipfit.model(44).posxyz
EEG.dipfit.model(44).momxyz

My initial guess is that there should be invalid values there.

Makoto



On Thu, Oct 20, 2022 at 5:40 AM Maksimovskiy, Arkadiy <
AMAKSIMOVSKIY at mclean.harvard.edu> wrote:

> Hello Experts,
> I am encountering the following error when using the fitTwoDipoles
> function to estimate symmetrically constrained bilateral dipoles.
> Error:
> ‘Index exceeds the number of array elements. Index must not exceed 6.’
> Code:
> EEG = fitTwoDipoles(EEG, 'LRR', 35);
> Output (last few lines before the error):
> Optimization terminated:
> the current x satisfies the termination criteria using OPTIONS.TolX of
> 1.000000e-04
> and F(X) satisfies the convergence criteria using OPTIONS.TolFun of
> 1.000000e-04
> found minimum after non-linear optimization for topography 1 on
> [-5.54128e-06 2.87688 -31.3614; 5.54128e-06 2.87688 -31.3614]
> the call to "ft_dipolefitting" took 2 seconds and required the additional
> allocation of an estimated 0 MB
> Fail to look up brain areas
> Index in position 1 exceeds array bounds.
> Error in fitTwoDipoles (line 46)
>     firstDipolePosxyz  =
> EEG.dipfit.model(bilateralDipoleIdx(m)).posxyz(1,:);
> Version info:
> "fieldtrip-" v20221018
> EEGLAB v2022.1
>
> The function consists of the following code:
> function EEG = fitTwoDipoles(EEG, symmetryRegion, threshold)
>
> % Run Caterina's bilateral dipole finder.
> sym_class = IC_sym_class(EEG,  'sym_reg', symmetryRegion, 'threshold',
> threshold, 'plot', 'no');
> bilateralDipoleIdx = find(sym_class(2,:));
>
> % Fit bilateral dipoles
> for m=1:length(bilateralDipoleIdx)
>     firstDipolePosxyz  =
> EEG.dipfit.model(bilateralDipoleIdx(m)).posxyz(1,:);
>     firstDipoleMomxyz  =
> EEG.dipfit.model(bilateralDipoleIdx(m)).momxyz(1,:);
>     secondDipolePosxyz = firstDipolePosxyz.*[-1 1 1];
>     secondDipoleMomxyz = firstDipoleMomxyz.*[-1 1 1];
>     EEG.dipfit.model(bilateralDipoleIdx(m)).posxyz(2,:) =
> secondDipolePosxyz;
>     EEG.dipfit.model(bilateralDipoleIdx(m)).momxyz(2,:) =
> secondDipoleMomxyz;
>     EEG.dipfit.model(bilateralDipoleIdx(m)).select = [1 2];
>     EEG = dipfit_nonlinear(EEG, 'symmetry', 'x', 'component',
> bilateralDipoleIdx(m));
> end
>
> for m=1:length(bilateralDipoleIdx)
>     disp(bilateralDipoleIdx(m))
> end
>
> When testing the function, line by line, it looks like the error message
> is generated from index 2 of the bilateralDipoleIdx array:
>
> bilateralDipoleIdx = 2    44    47    71    78    80    81    86    88
> 89
>
> firstDipolePosxyz  = EEG.dipfit.model(bilateralDipoleIdx(1)).posxyz(1,:);
> firstDipoleMomxyz  = EEG.dipfit.model(bilateralDipoleIdx(2)).momxyz(1,:);
> Index in position 1 exceeds array bounds.
>
> I would love to hear if anyone encountered this and knows how to
> troubleshoot.
> Thanks in advance,
> Arkadiy
> The information in this e-mail is intended only for the person to whom it
> is addressed.  If you believe this e-mail was sent to you in error and the
> e-mail contains patient information, please contact the Mass General
> Brigham Compliance HelpLine at
> https://urldefense.com/v3/__https://www.massgeneralbrigham.org/complianceline__;!!Mih3wA!DnjxyyLXEUm3G7lW5fcKMLcIdnIjIoqfLzK-USqJtZXPKRU7SNnMR5bQX1F8vzHfkmpmu03EiueO_4kMS_5kabWqn_zqciKvuRiVHhI$
>  <
> https://urldefense.com/v3/__https://www.massgeneralbrigham.org/complianceline__;!!Mih3wA!DnjxyyLXEUm3G7lW5fcKMLcIdnIjIoqfLzK-USqJtZXPKRU7SNnMR5bQX1F8vzHfkmpmu03EiueO_4kMS_5kabWqn_zqciKvuRiVHhI$
> > .
> Please note that this e-mail is not secure (encrypted).  If you do not
> wish to continue communication over unencrypted e-mail, please notify the
> sender of this message immediately.  Continuing to send or respond to
> e-mail after receiving this message means you understand and accept this
> risk and wish to continue to communicate over unencrypted e-mail.
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>



More information about the eeglablist mailing list