Regarding Reference channel

Hi!

Is there a way to add the reference channel back into the data? For example, EEGLAB provides an option to add reference channel back into the data while average re-referencing.

Thanks in advance,
Sainath Murali

There is no dedicated menu to add back a flat reference channel before computing the average reference.
This is usually a concern when expecting the possibility to revert the data back to the original reference.
Do you need this for another purpose?

I guess there is one option to do this from the Brainstorm interface:

  • Create a custom montage with all the channels being equal to themselves (eg. "Cz : Cz"), and with an extra line that multiplies any channel by zero ("REF: 0*Cz").
  • Import the entire continuous file as a single epoch
  • Make a full backup of your database, as the following step might damage things
  • Create a new dataset including the extra channel with the process: Standardize > Apply montage
  • Right-click on the file with the extra flat channel > Review as raw
1 Like

Hi Francois,

Thank you for the reply. I tried doing the custom montage and I'm stuck at a step. Actually, in my recordings I had to change the reference electrode for the final half of the subjects as the electrode that I was using as reference was problematic. Hence, I'm trying to add the reference channel back to the data for source estimation later. I tried creating the custom montage by adding the actual channel name instead of 'REF', as I can add the location of the channel later by keeping the original name. But now when I do rereferencing, there is no change in the flat channel. The sensor types in the setting is kept as 'EEG'. How can I include the newly added channel for rereferencing?

Thanks in advance,
Sainath Murali

Hence, I'm trying to add the reference channel back to the data for source estimation later.

The source estimation is done in average reference, the reference used should have no impact on it.
http://neuroimage.usc.edu/forums/showthread.php?1525#post6718

But now when I do rereferencing, there is no change in the flat channel. The sensor types in the setting is kept as 'EEG'. How can I include the newly added channel for rereferencing?

Please post screen captures explaining every step of your current procedure.

I figured out the issue and its actually working. I did all the steps but I forgot to change the montage back to all channels. Hence, even after average re-referencing the REF electrode was flat as it was configured as 0*Cz.

I need another clarification. When you mentioned in the 3rd step to backup before doing the further steps, what did you mean? Can something happen to the raw data while doing this? How can I be sure that these don't alter the raw data?

i.e., Is there any way to check whether I'm doing it correctly?

When you mentioned in the 3rd step to backup before doing the further steps, what did you mean? Can something happen to the raw data while doing this?

This process creates new folders and new files. If something goes wrong during this process (e.g. a bug in the code or a crash of your computer), this might leave some inconsistencies in the database that could be difficult to fix manually.
Having a regular backup of your database (daily or weekly) is always recommended, not only for Brainstorm but for any time-consuming computer work. Don't put yourself at risk to lose entire months of work.

How can I be sure that these don't alter the raw data?

Original files cannot be altered, if you followed the instructions from the tutorials and did not store them inside the brainstorm_db folder.

Okay! Thank you for the explanation. I'll make sure that I do regular backups.

Hi!

I need one more thing. Is there a way for scripting the 'import entire continuous file as a single epoch' step you mentioned?

Thanks in advance,
Sainath Murali

Is there a way for scripting the 'import entire continuous file as a single epoch' step you mentioned?

Select the process "Import > Import recordings > Import MEG/EEG: Time", and check the box "All file".

Thank you. That worked. I have another issue now. Actually, I have two recordings for a subject each corresponding to a different experiment. I applied the montage with flat reference. But when I try to review raw file it creates a folder block001_montage for both recordings and replaces the existing raw file instead of creating another file. How can review both recordings and save them separately?

Thanks in advance.

Add different tags to the file names.
Process File > File tag: Add to file path.

That's great! Thank you.

Hi, Francois,

Sorry for bothering you again. I have another doubt. I have to reject bad trials and keep a note of the number of the trial that I'm rejecting so that I can also remove those trials from the behavioural data. However, my event markers are not incremental to check the number of trial that I'm rejecting. Is there any way I can do this? Or I there a way I can create a script to create new event markers such that they are incremental?

And another thing is I need to reject some of the trials in the middle that don't have certain event markers, for example missing trials. For example, I have markers in the trial for start, stimulus, response, and end. If in some trials the responses are missing I want to reject those trials. Do you have a sample script similar to my case that I can refer to?

Thanks in advance,
Sainath Murali

This is a distinct topic: please start a new forum thread to discuss it.

Please include more information describing what your tagging system look like, and screen captures illustrating each of your question (e.g. showing the files in the database, the markers lists in the Record tab, the time series window with the events of interest...)
Since you talk both of trials and markers, I'm not sure if you work with continuous files or imported files.

Hello Francois,
I am also facing the same issue. I uploaded raw files that used the Cz electrode as a reference electrode, yielding 31 channels for a 32 channel recording. I followed the steps listed in this thread but I am unable to retain the Cz electrode while attempting to use the average reference. Can be more explicit in your step by step instructions?
For example,

  • Create a custom montage with all the channels being equal to themselves (eg. "Cz : Cz"), and with an extra line that multiplies any channel by zero ("REF: 0[asterix]Cz").
    For this step, I opened a Raw file and under the Record Tab I selected "All" > Edit Montages > New Custom Montage. In this blank window I inserted the names of each channel (from the channel file) followed by a colon [:] and another column with each name [e.g. Fp1 (1) : Fp1 (1)].
    I added an additional line for the Cz electrode [REF : 0*Cz (24)]. After saving and then reopening, oddly this last line automatically turns to [Ref : ].
  • Import the entire continuous file as a single epoch
    I import the raw file by right clicking and selecting "Import in database". This creates an time series file with 31 plus a REF channel, although the channel file displays 31 channels and the time series is near zero in voltage, which I assume is due to the subtraction of each electrode from each electrode.
  • Make a full backup of your database, as the following step might damage things
    I am working with a test database, so no issues here.
  • Create a new dataset including the extra channel with the process: Standardize > Apply montage
    I drag and drop the 31 channel data (the additional REF as a montage channel), and select Standardize > Apply montage > 32_test (the name of the new montage I created). This gives the same time series data as before but the channel file includes a 32rd electrode that has montage displayed in the type column.
  • Right-click on the file with the extra flat channel > Review as raw
    This produces a raw file with 32 channels, 31 active electrodes and a montage channel with no information related to Cz. I feel like I am missing a few steps here and I have tried experimenting in multiple ways to get the desired effect.
    Perhaps you can shed light on this problem.
    Thank you,
    Zach

This is because the Cz electrode does not exist.
Use the name of an electrode that exists, otherwise the montage validator would reject it.
Example: Cz : 0 * Fp1

Other than that, you should not include these parentheses ("Fp1 (1) : Fp1 (1)").

Cz : 0 * Fp1
This would assume that I am creating a new electrode substituting Fp1 for Cz.

The way the data acquisition was set up, Cz was used as an offline reference, which suggests that the Cz electrode does exist. I would like to retain the Cz electrode if possible. If that is not possible, I would have no choice but to recreate this information by averaging across the adjacent electrodes.
E.g. Cz : 0.5 * Fz, 0.5 * Pz

What would you recommend?

To follow up, when attempting to recreate Cz using near neighbor electrodes, the channel file assigns this new electrode as 'montage', and does not allow me to assign it in the correct position, thereby adding an additional EEG electrode. How can I then include this new electrode in my analyses?