EGI GSN_Hydrocel_64 channel locations and Error during grand average

Hello All,

I imported my cleaned, averaged ERP data from EEGlab to Brainstorm in order to further run some source localization analysis. My data was already average referenced prior to import during pre-processing, which means that it has an additional channel for Cz, turning 64-channel ERP data to 65 channel ERP data.
(Raw data was recorded with EGI GSN_Hydrocel_64 channel -vertex reference).

I have two questions:

  1. What are coordinates for Cz that aligns with the head model ICBM152?
    I am using the default head model ICBM152, and when I use the default channel locations (Add EEG Positions > ICBM152>EGI>GSN_HydroCel_64_E1, it automatically detects the correct channel locations and adjust it according to the head model; but with a missing electrode for Cz. I tried to add the Cz to the file by 1)manually adding an electrode via GUI>MRI Registration>edit, 2) manually adding a line for "channel 65" in the original mat file "channel_GSN_HydroCel_64_E1.mat" which is located under /Users/ddc/Documents/brainstorm3/defaults/eeg/ICBM152).

However, since I don't know the exact coordinates for Cz for the specific head model, my additions are approximate, which is probably not a very good solution. I was wondering if there was already coordinates established for Cz (for the ICBM152 head model) ? I do have an external .sfp file that includes Cz as the 65th channel (works in EEGlab) but it does not fit the ICBM152 head model when I import it.

  1. Another problem I am having is when I try to average ERPs across subjects for (grand average). I thought it may be related to channel locations so I am including this in the same thread. This is the error I get (any of the averaging options would give me the same error (by trial/subject/folder):

Unfortunately I am not savvy enough to track the error to its origin but I thought this might be due to differences in channel arrays (vertical vs horizontal), but I am not sure if this is the case or there is another problem. I get the same error whether or not I manually edit the channel location file to have the Cz included as the 65th electrode with [1 x 65] structure.

My ERP data has the following structure (one of the ERP categories as an example):

|- F: [65x800 double]
|- Std: [65x800 double]
|- Comment: 'InCongruent_Block(B7)All Trials '
|- ChannelFlag: [65x1 double]
|- Time: [1x800 double]
|- DataType: 'recordings'
|- Device: 'ERPLab'
|- nAvg: 64
|- Leff: 1
|- Events: [0x0 struct]
|- ColormapType: []
|- DisplayUnits: []
|- History: {2x3 cell}
.
I have Matlab 2016a, and MacOS(Catalina)

Thanks so much for your help!
Deniz

I imported my cleaned, averaged ERP data from EEGlab to Brainstorm in order to further run some source localization analysis

We recommend importing the individual epochs, and computing the average in Brainstorm.
This would allow you to compute a much better noise covariance matrix:
https://neuroimage.usc.edu/brainstorm/Tutorials/NoiseCovariance#Variations_on_how_to_estimate_sample_noise_covariance

My data was already average referenced prior to import during pre-processing, which means that it has an additional channel for Cz, turning 64-channel ERP data to 65 channel ERP data.

The data at Cz is the average of the original signal?
I'm not sure it is necessary to include this extra signal for the inverse modeling. This is mostly useful to revert the transformation to the original reference. You could just ignore it.
But I'd like to have a confirmation from @John_Mosher on this point.

However, since I don't know the exact coordinates for Cz for the specific head model, my additions are approximate, which is probably not a very good solution.

You are working with a template anatomy and standard electrodes positions. This is already probably quite far from the actual anatomy of you subjects, and the real position of the elastic EGI nets on their heads... A few millimeters in your approximation of the position of the reference at Cz is negligible compared with your other approximations.

This is the error I get (any of the averaging options would give me the same error (by trial/subject/folder):

What is this process_average 2.m ?
If you want to create new processes yourself, do not use spaces in the filenames.
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess#Create_your_own_process

The problem is in the History field of your input files.
To see what's in there: right-click on the file > File > Export to Matlab > DataMat. In the Matlab command window: type DataMat.History.
Please share one of the files if you want an advice on what the problem might be.

I added an additional error capture so that this kind of error is not blocking anymore:

Thank you very much for your prompt reply Francois!
See my comments below in bold!

Thanks for the advice on including all epochs. I just tried this by importing epoched data (from EEGlab set files), and actually the averaging process works smoothly with this file format, and I don't see the same error I had with the the erp files.

Regarding your feedback on Cz, I think I am okay to leave Cz out for my source analysis per your suggestion. For regular ERP analysis though (amplitude etc), it would be helpful to see the data from Cz, but then I don't really need the coordinates, so in the end an approximation should be fine. I believe EEGlab has 2 options to put the reference back as a channel- First one is through interpolation and the other option is like you said, averaging other channels and then maybe inverting it?, though I am not 100% sure.

This is the error I get (any of the averaging options would give me the same error (by trial/subject/folder):

What is this process_average 2.m ?
If you want to create new processes yourself, do not use spaces in the filenames.
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess#Create_your_own_process

The problem is in the History field of your input files.
To see what's in there: right-click on the file > File > Export to Matlab > DataMat. In the Matlab command window: type DataMat.History.
Please share one of the files if you want an advice on what the problem might be.

I added an additional error capture so that this kind of error is not blocking anymore:
https://github.com/brainstorm-tools/brainstorm3/commit/913752ba6df00313e54483f2eb634aa81755d5ba

I did not created a new process myself (at least on purpose), just dragged the files into the box "File to process" and then Select Run>Average>Average files. Not sure where the process 2 came from. I just reset the Brainstorm thinking maybe I messed up with something, and also to update the last version, but I still get the similar error when I try to average files that were imported from erp. files. I think I will use the epoched that as you suggested above (and in this care averaging process works fine) so I don't necessarily need this to work with my erp files, but I will share a sample data incase you want to take a look at it or if you think this may be helpful to someone else in the future.

Just FYI, After I updated my Brainstorm, I actually get a slightly different error:

This is what I did in Pipeline editor:

This is what get with DatMat.History:

And here is link for the DatMat file and the sample erp data.:
https://www.dropbox.com/sh/o5u80s94j2drrwb/AAAfatD29XBHspQ93jJDQj4Qa?dl=0

I really appreciate your help. Brainstorm is an awesome program. It makes everything very easy. Thank you again for all your efforts.
Deniz

averaging other channels and then maybe inverting it?

Probably Cz = -(average all channels)

After I updated my Brainstorm, I actually get a slightly different error:

Fixed: https://github.com/brainstorm-tools/brainstorm3/commit/fa05a049509ac5c7a8fd66a55dbed0888de870cb

I also fixed the History field in the ERPLAB import, solving the problem at its root: https://github.com/brainstorm-tools/brainstorm3/commit/69215840f6015b0e4e0eb9660a0b19f42ee4a059

And here is link for the DatMat file and the sample erp data.:

How did you end up with an imported file of 400Mb?
When you import a file that is already epoched, use the menu "Import MEG/EEG", not "Review raw file":
https://neuroimage.usc.edu/brainstorm/Tutorials/ChannelFile#Review_vs_Import

Thanks for the fix, now it is working for the erp files without any error!

That's how I had imported though, right click on the subject folder>"Import MEG/EEG > EEG: erpfiles".
I think what happened was I saved my whole workspace by mistake as the DatMat file so my raw (was open via EEGlab) file got saved along with the DatMat....I should have realized this when I saw the file size.....