How do i create a common channel file?

Hello,
I am running an EEG average and continue to receive an error on 7 files.
These 7 files, I collected at different times and ran it with a different channel set up. In particular I added 2 eye channels and a HR channel. I tried to turn these channels off by making them bad, but this didn’t work.

My question is:
If the channels files from the different studies do not have the same number of channels, how do I create a common channel file data matrix so that i can run an average over all of my epochs?

Thank you
Josh

Hi Josh,

You can run the process “Standardize > Uniform list of channels” on your recordings.
It defines a common list of channels and rewrites the channel files and the data files to match this new list. You can chose between:

  • keeping only the channels present in all the datasets (some data is losts)
  • keeping all the channels present in all the datasets (adds zeros when the recordings are not available)
  • forcing all the files to match the channel configuration of the first data file in the Process1 list.

You have to run this immediately after you import the recordings as this process does not fix the head models, source maps or frequency files.
If you have a lot of data already imported, make a copy of everything before you start because this process can have a strong destructive power if not used properly.

Cheers,
Francois

1 Like

Thank you very much Francois!
I will try that out and let you know how it goes.

Cheers
Josh

[QUOTE=Francois;6121]Hi Josh,

You can run the process “Standardize > Uniform list of channels” on your recordings.
It defines a common list of channels and rewrites the channel files and the data files to match this new list.
[/QUOTE]

Hi Francois,
I have tried all three standardize options and all came up with errors (see attached)

When i tried to run the average i wasnt able to average them all again due to the different number of channels.
However when I tried to standardize the channels again it said it couldn’t because it had already.
The average came up with a different number of files used in the average when i ran the “keeping all channels present but replacing with a zero” option.

The average came up with the same number of files when i ran the matching to the first data file, which tells me that it didnt necessarily change the channels although it said i had when i tried to run another standardize through the pipeline.

Any thoughts would be most helpful.

Cheers
Josh

Hi Francois,
I have gone into the “CND 2D Channels” and changed over the channel matrix manually to look identical between the 2 different files. The only difference now that I see is the Loc appears to be different. (See attached)
Yet when i run my averages it still says that it has a different data matrix size. (see attached)
I tried to run the standardize option after manually changing the channels and it said that all the channels are the same.
Now i am confused.
Do you have any thoughts?

Cheers
Josh





Hi Josh,

The number and order of the channels has to say exactly the same in:

  • the channel file (field .Channel)
  • the data files (fields .F and .ChannelFlag)
    If you change one without changing the others, it cannot work, it would just damage your database.
    This is probably why you experiments of manual channel file modifications didn’t work out.
    For now you should revert to the backed-up version (copy that you did before trying to run the process, if you followed my recommendations).

The error message you got when running the process “Uniform list of channels” makes me think that is probably a bug in my code.
But it’s very hard to understand where it could come from without knowing what your database structure is.

Could you send me some data, so I could check where is the problem coming from?
The easier would be for you to send me your entire protocol (File > Export protocol > and send me the big .zip file, for instance with dropbox).
If the file is too big, you can alternatively export just two subjects for which you can reproduce the error (Right-click on a subject > File > Export subject).
If it’s still too big, make copies of your two subjects (right click > File > Duplicate subject) and delete unnecessary files, and export it.

Then send me those files with a detailed description of the operations you’re doing to get the error you posted (what files do you select, etc.)
If it’s too complicated, you can also just send me screen captures of your database explorer, and maybe I’ll be able to help just based on this.

Cheers,
Francois

Hi Francois,

I really appreciate your help.

Here are drop box links to the 2 conflicting participants.

Links to Participant 10 (https://www.dropbox.com/sh/0kjimh2c30ig9y1/DZDaQZ2i5s) and the 10sst (https://www.dropbox.com/sh/94zwhnfd23zcyu0/YdUog7t9lR) files

What I find interesting is that the eeg files always have the same matrix and it is only the additional channels such as eog, ecg and misc.

This is my second round of running the protocol. Previously when i ran the different files there was an SST misc channel but no ECG and EOG and these were able to average fine. However when I added the new channels of EOG and ECG they have been rejected.

Many Thanks
Josh

Hi Josh,

Please export the files as I suggested: Right-click on a subject > File > Export subject (or export the entire protocol if not too big), then send me the .zip file.
There is some information I would need in the anatomy folders as well.

Can you also describe exactly the operations I should do with your files to reproduce you error?
(step by step, all the clicks, the selected files, the processes you run).

Thanks
Francois

Hi Francois,

I have included the subject export drop box links for 3 different channel matrices. Participant 003 (no additional channels) was able to average with Participant 010SST (+1 additional SST Misc channel) but neither of these was able to average these with Participant 010 (+1 additional EOG and ECG channel). Even when i removed these additional channels to leave only the same EEG channels, I was not able to average the files. I removed the channels by going into the “CND 2D Channels” and change over the channel matrix manually to look identical between the 3 different files.

The links to the subject exports are:
Participant 003: https://www.dropbox.com/s/3uyg6wredpjmppi/Participant_003_export.zip
Participant 010: https://www.dropbox.com/s/xnd935dq7s23o8v/Participant_010_export.zip
Participant 010SST: https://www.dropbox.com/s/cooghljsae9b7zs/Participant_010SST_export.zip

The pipeline steps are as follows:
Baseline Correct
Filter 0.1-41Hz
Compute: EOG artifact reject

Average: Everything

I normally run the averaging on the “kill” events but i have tried it on other event files and it doesn’t work on these either.

Thanks very much for your help Francois
Josh

Hi Francois,
Upon more investigation I found that once changing the CND channel files i wasnt able to open up the file viewer because it said that the ChannelFile (62) didnt match the DataFile(65) which said to me that it wasnt updating the matlab matrices properly.
So I then exported the file to matlab updated both the F and ChannelFlag elements to reflect 62 file. I reimported it back into brainstorm and then tested to see if this worked in the file viewer, which it did.
I then ran an average now with the new updated file and was still unable to run the file.

I then exported one of the other channel matrices files and noticed that my F element in that other file has a value of [62x1501 double], whereas the F element on the first data file was [62x751 double]. This means it seems to have twice the data points from a change in the sample rate.

Do you know how to change the sample rate of a file?

Many thanks
Josh

Hi Josh,

Looking at the subjects you sent me, I would do the following:

  1. Update Brainstorm: I just posted a few more modifications that will help you understand what is happening
  2. Delete all the files in (Global common files) and (Inter-subject) because what is in there is all messed up, the files where not standardized correctly before averaging.
  3. Fix the sampling rate:
    3.1) Chose only one sampling rate for all the subjects because you’re not going to be able to average files with different sampling rates.
    3.2) Delete all the subjects for which the sampling rate is different.
    3.3) Resample all your files at the same sampling rate (eg. 1000Hz). You need to resample the continuous files, resampling the short epochs would lead to inaccurate results. You can do this either with your acquisition software or with Brainstorm, following the guidelines in the “EEG & epilepsy” tutorial (import full file, process, epoch): http://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy
    3.4) Re-import the correctly sampled files
  4. Delete the folders containing the “Link to raw file”, because they cannot be fixed with the process “Standardize > Uniform list of channels”
  5. Make a copy of your database, just in case something bad happens
  6. Drag all the files from all the subjects to the Process1 tab, and run “Standardize > Uniform list of channels”, and select the option “keep only the common files” (see the two attached screen captures)

A few additional recommendations (that require you start everything over):

  1. I would recommend you band-pass filter the entire continuous file BEFORE you epoch and import it. Filtering small epochs leads to important edge effects, those filters perform much better on long time signals. You can do this either with your acquisition software or with Brainstorm.
  2. When running this band-pass filter, you can add a high-pass filter at 0.5Hz, to get rid of the slow fluctuations in the recordings. This way you also don’t have to select the option “Remove DC offset”
  3. I noticed most of your files contain strong power line contamination. You should run the sinusoid removal process to get rid of the 50Hz contamination before you apply any other filter, as illustrated in the introduction tutorials: http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp

Cheers,
Francois

Hello Francois,

I am encountering a similar problem. I tried to standardize my channels to create sensor level averages, but after following the directions posted in the forum to standardize the channels (How do i create a common channel file?), I still get this error when I try to load the sensor averages:


** Error: Line 553: bst_memory>LoadChannelFile (line 553)
** Number of channels in ChannelFile (326) and DataFile (332) do not match. Aborting...
**
** Call stack:
** >bst_memory.m>LoadChannelFile at 553
** >bst_memory.m>LoadDataFile at 782
** >bst_memory.m at 72
** >view_timeseries.m at 107
** >tree_callbacks.m at 263
** >bst_call.m at 28
** >panel_protocols.m>CreatePanel/protocolTreeClicked_Callback at 123
** >bst_call.m at 28
** >panel_protocols.m>@(h,ev)bst_call(@protocolTreeClicked_Callback,h,ev) at 73
**


I have six averages that I want to look at in sensor space but only the first one will work. I've looked at the number of channels in the individual files and the number of channels in the common files, but, from what I can tell, they should be equal (326 for both the individual Intra-subject channel count and the common channel total).

I noticed that in your original instructions that I should have deleted all of the folders containing "Link to Raw File". I did not follow this step, would this have caused this? If so, why wouldn't it affect all of the averages?

I can also just load one of the databases I've backed up and redo the standardize trials process and delete the folders containing Link to Raw nodes to see if that will work. Before doing that I thought that I should check in with you to see if you had any ideas?

Thank you for your time and expertise!

Best,

Katie

Note that we don't recommend anymore using common channel files, as could probably saw in the interface and the documentation:
https://neuroimage.usc.edu/brainstorm/Tutorials/CreateProtocol#Create_your_first_protocol

From your message, it is difficult to understand what you did to get to the current database state or what you mean with "standardize the channels".
If what you did is 1) using a common channel file (subject-level or global level), then 2) import your various files in the same subject, I guess the problem is that you override the channel file at each new file.

Please delete your subject, create a new one using the option "Default channel file: No", import all your files again.
If you are still having issues, please document step-by-step what you did, and post screen captures showing the files in the database explorer.