Inconsistent number of channels

Dear Francois and other Brainstorm Developers,

I don’t know if this is a bug per se or just a limitation I’ve run into, but BST is telling me that I have an inconsistent number of channels in the condition for which I am trying to calculate the noise covariance. For a particular condition, there are 6 runs, and although I am aware of nothing that changed in the recording setup across those runs, BST believes that there is a different number of channels in at least one of the recordings. Sylvain looked at this with me and seemed as perplexed as I am. He also recommended that I ask you about this issue. Pasted below is the error message I get:


** Error: Line 183:
** Number of channels is not constant.
**
** Call stack:
** >bst_noisecov.m at 183
** >tree_setNoiseCovFile.m at 61
** >bst_safeCall.m at 31
** >tree_callbacks.m>@(h,ev)bst_safeCall(@tree_setNoiseCovFile,bstNodes,‘Compute’) at 1602
**


I have also zipped the data for one of the conditions, which I could send by email file drop if it would help. Just so you know, I tried this on the latest version of BST that I downloaded today, and the behavior I just described is identical to what I saw in previous versions. I’m running Matlab release 2009a in Linux CentOS 5.4.

Thanks in advance for any help you can give.

Best,
Will

One other thing I should mention about this dataset is that the EOG and ECG channels were lost in the last of the 6 runs. It may be reasonable to think that has something to do with the error I’m getting, but I could still use help figuring out a way round this problem. It would be a shame to lose the entire dataset. Also, as with all the subjects I’ve been processing in Brainstorm, the data were first averaged with MNE.

Thanks,
Will

Hi Will,

I was about to send ask you to send me all your files but your last message explains everything. Some operations, like averaging or computing the noise covariance matrix, are performed using ALL the data channels. You apparently have one or more channels missing (= rows in the data.F matrix = entries in the channel file) in the last run.
To fix that, you would have to add manually one or more rows to the F field of the data file, AND the same number of channels in the channel file.

BUT: Before going in this direction, there might be a mistake in the way you imported your files. Each run should identified in your database as a different “condition” (what appear as folders), and you should have one channel file + one noise covariance matrix + one head model + one inverse kernel FOR EACH RUN.

The only case where you can “share” the channel file (+noise cov+headmodel+inverse) is when all the runs have been already registered together on a standard template (which cannot be done in Brainstorm yet).
If it is something you did with MNE, then you can share the same channel file, but in this case the channel definition between the runs must be exactly the same. Each data file in Brainstorm database must have exactly the same number of rows in F as the number of entries in the Channel structure.

If it is not the case:

  1. you reprocess your data with MNE and make sure you do not lose the EOG/ECG channels, or
  2. you re-import your files without sharing the channel file, or
  3. you edit manually the data_…mat files in brainstorm database to add some rows where there are missing, and make sure that the order of the channels is unchanged…

Sorry, there is nothing automatic yet to help people dealing with those kinds of problems… I already heard that question several times, but it depends so much on the setup of each experiment that it is hard to produce a standardized solution…

Francois

Hi Francois. Thanks for the reply. It is definitely helpful and clarifies some things for me.

Best,
Will

Hi Brainstormers,

For the MEG data that i am working on has inconsistent number of EMG channels. Till group analysis it dis'int through up warnings and error. How can i delete or add the other EMG channels to make all the data appear same? Or is there any other solution..

Thank you

You can use the process "Standardize > Uniform list of channels" to either remove the extra channels, or add the missing ones (filled with zeros).
Make a full backup of your database before trying that, it rewrites all the files and can't be undone.

Thank you!