Source imaging from intracranial EEG

Dear OpenMEEG experts,

I would like to test source imaging from intracranial EEG data. I was wondering whether OpenMEEG allows me to use inter-hemispheric strip electrodes and eventually also depth electrodes for source reconstruction.
Thanks for your advice!

Best regards,


I tried to calculate an OpenMEEG headmodel using non-interhemispheric ECoG electrodes and experienced the attached error. I selected the OpenMEEG cortex surface method. I am using a windows 7 computer and Matlab 2012b. As you can see on the figure not all electrode contacts are on top of the cortical segmentation. Does this cause the problem?

Thanks for your support!



OpenMEEG should work for EcOG

the position of the strip/electrodes should be projected onto the inner skull surface.

the error says that some previous matrix in the pipeline was not computed correctly.


Hi Marcel,

I’ve added a way to project the ECoG electrodes on the inner skull surface, as Alexandre suggested.
Right-click on the channel file > MRI registration > Edit… (Inner skull). Then click on the button [Project on surface].
Can you try running again OpenMEEG after doing this?

I don’t think the modeling of inter-hemispheric ECoG electrodes was tested before with OpenMEEG or Brainstorm.
Maybe you should classify them as SEEG electrodes instead.


Hi Alexandre and Francois,

I had another try calculating the headmodel after projecting the electrode on the inner skull (using the method that you implemented in brainstorm, Francois), but it failed again. I remember that it worked fine using a cortical surface and electrode positions that were already aligned with that cortical surface in ASA software. So I also tried it with projecting the ECoG electrodes on the cortical surface, but it did not work either. Do you have any further suggestions? I attached the electrode positions and the error logs. They say that the om-gain.exe crashed, while assembling the ECoG leadfield.


Hi Marcel,

This looks like an error due to memory limitations.
Can you try with a lower number of vertices on all the BEM layers?


Hi Francois,

this issue seems to be system dependent. I do not have these problems on my Mac laptop, but I don’t understand it, because I use a windows 7 computer with 16MB RAM.


I tested this yesterday as well, and it seems to be crashing a lot on Windows 7, with very few vertices per layer, and it works on the same computer from a MacOS virtual machine.
There is definitely something wrong with the win64 version of the OpenMEEG binaries…

Let’s see if Alex has anything to suggest.

Hi Marcel,

There are definitely some stability issues in the OpenMEEG binaries. Some crashes seem to be happening only on Windows, other are reproducible on different platforms.
In order to help the OpenMEEG developers fixing these issues, we should send them the files that generated the crashes and the text output of the om_* functions.
I added a simple logging system in Brainstorm to understand better what crashes in OpenMEEG.
I already posted files for a reproducible error I got with SEEG electrodes:

This is how to proceed:

  1. Update Brainstorm to get the latest logging function for OpenMEEG
  2. Run again the computation that crashed
  3. Immediately after the crash, close the error messages and before closing Brainstorm, zip the entire folder C:\Users\username.brainstorm mp
  4. This folder should contain all the input/output files used by OpenMEEG and the logs (openmeeg_logs.txt)
  5. Upload this file somewhere (eg. dropbox)
  6. Send the link to Alexandre, Maureen, Theo and I (“Reply to all” to the last discussion about ECOG electrode positioning)
  7. Add in the email the output of the “ver” command in Matlab (this is an easy way to get lots of the system details)
  8. Add some images showing the position and types of the electrodes, it can help for the first pass of debugging.
  9. Post a bug report on the OpenMEEG github page ( => This we can do for you if you don’t want to spend time creating a github account

Thanks for your help in debugging these tools.

FYI: We improved significantly the tools available in Brainstorm for processing and visualizing SEEG and ECOG data, including new options for volume coregistration. They are now documented in a new tutorial:

Hello everyone,

I would like to localize the source of an ERP-component on a group-level using intracranial EEG. Right now I have a dataset of multiple subjects, with a variety of type of electrodes (sEEG, ECoG and even one subject with epidural EEG) distributed across different locations in the brain.

I have been reading the tutorials trying to come up with some sort of pipeline for this. So far, I have been able to visualize the intracranial data on a single-subject level. My question is how I can continue the source analysis on a group level.

Based on the tutorials I assume I need to perform following steps:

  1. Create a group-analysis + generate a template grid
  2. Compute a head model for each subject in the database, using volume source models (since the variety in type of electrodes) --> using OpenMEEG? Or should I create a FEM model instead?

After that, I am not sure how to continue. Does anyone have any experience doing this type of analysis?

Many thanks in advance!


Maybe the best way to proceed is to create a virtual subject with an implantation montage made of all electrodes in all participants, with the corresponding recordings from each participant ; then compute the source model for this collated set of data.
Alternatively, you may compute the source maps for each participant, then project these maps into the same MRI template and finally, compute the average of all source maps.
Either way, the source model you will obtain can only be a relatively crude approximation.

So should I create a FEM model then of every participant? Or are you talking about a different kind of source model?

If you go with the first option I mentioned, you need to create only one FEM model for the virtual participant.

Yes, but I am not sure how I would be able to define the location of the electrodes of the different participants in one MRI? Or is it possible to coregister multiple CT scans to one MRI template?

Additionally, we would really want to use the individual MRI's of every participant since the organisation of the sulci can have an impact on the ERP-component we're looking at. So maybe in that case I would better go with option 2?

A group analysis of any kind will obliterate the anatomical details proper to each patient. For option#1, I can suggest you create a channel file that is the concatenation of every patient's channel file. You'll have to do this using Matlab outside Brainstorm. Personally, I would try both options to confirm observations.