sccn / BCILAB

MATLAB Toolbox for Brain-Computer Interface Research
Other
198 stars 120 forks source link

Your lead-field matrix has a # of columns that does not correspond to the # of source vertices #57

Open HeroDev67 opened 5 years ago

HeroDev67 commented 5 years ago

I am trying to run BCILAB with the following outlines given here

https://docs.google.com/document/d/1iTGj23C5uPW85g4JPDc9l5BTDuKnTvp90y2oCT5JSiY/edit?usp=sharing

As the title suggested it gives me an error while calibrating the model

“Your lead-field matrix has a # of columns that does not correspond to the # of source vertices."

I have tried to debug the problem and reached to the source of the problem

in flt_sourceLocalize.m the struct state has the fields :

state =

struct with fields:

  leadFieldMatrix: [343×3740 double]
laplacianOperator: [3740×3740 double]
        rmIndices: [1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880]
        nVertices: 3751
        nChannels: 64

The error occurs because number of columns leadFieldMatrix doesn't equal to nVertices

What should I do to make them equal ?

elianasantos commented 5 years ago

I have that problem too. I try to create a headmodel (EEGLAB) to data but that not solve the problem.

aojeda commented 5 years ago

It's been a while since I work on this code, and having so many layers wrapped around the core function makes it difficult for me to assess the ultimate cause of the problem. That is one thing, the other thing is that I see that in this repo, the code that implements LORETA, sometimes may yield a suboptimal source estimate because, depending on how it is called by the upper level wrapper, it may use an optimization procedure to calculate the regularization parameters that is wrong, to be totally fair, it is not that it is wrong but that it is prone to get trapped in a local minima (which is not the same but nevertheless gets you the wrong answer). I remember that we fixed that problem in some version of BCILAB, but it seems that it didn't make it to the master branch.

If you are using Beamforming then what I said about LORETA does not affect you.

In my opinion, if you are willing to write a little bit of code, you are better off implementing a clean source localization function, it's not that difficult. I can help you with that if you specify how you will use such function, e.g., size of EEG data in, montage, etc.

Hope that helps, A

elianasantos commented 5 years ago

I need to analyse EEG signals with a headmodel for each subject (co-register). I'm study motor imagery to improve tasks classification. The signal was record with subjects perform left/right hand motor imagery movement. The MATLAB structure of the EEG (1st to 64th channel) and EMG (65th to 68th channel) data (“∗.mat”) for each subject is following: imagery left: 100 or 120 trials of left hand MI and imagery right: 100 or 120 trials of right hand MI. I'd like to write a code to use BCILAB.

thanks!

HeroDev67 commented 5 years ago

It's been a while since I work on this code, and having so many layers wrapped around the core function makes it difficult for me to assess the ultimate cause of the problem. That is one thing, the other thing is that I see that in this repo, the code that implements LORETA, sometimes may yield a suboptimal source estimate because, depending on how it is called by the upper level wrapper, it may use an optimization procedure to calculate the regularization parameters that is wrong, to be totally fair, it is not that it is wrong but that it is prone to get trapped in a local minima (which is not the same but nevertheless gets you the wrong answer). I remember that we fixed that problem in some version of BCILAB, but it seems that it didn't make it to the master branch.

If you are using Beamforming then what I said about LORETA does not affect you.

In my opinion, if you are willing to write a little bit of code, you are better off implementing a clean source localization function, it's not that difficult. I can help you with that if you specify how you will use such function, e.g., size of EEG data in, montage, etc.

Hope that helps, A

I think the problem in SourceLocalization code .. when I run it without enabling it, it runs perfect.

elianasantos commented 5 years ago

Sorry, i don't understand. Could you explain again with more detail? I am new in matlab and bcilab. Thanks!