4 layer BEM

Dear All,
We are attempting building 4 layer BEMs (the novelty being a CSF layer) outside of brainstorm, but using brainstorm meshes as .tri files.

  1. If feeding two freesurfer ?h.pial surfaces, does the ‘merge surfaces’ utility in brainstorm GUI generate a new, closed bihemispheric surface? I does not seem to be the case by looking at the cortex surfaces in GUI, but please confirm. Our scope is not to generate a unique, if discontinuous, source surface space, but to generate a closed pial surface serving to feed the BEM mesh generator, the end results hoped for being a closed CSF-gray matter boundary (BEM mesh). The actual source surface can be at the white-gray boundary, or an eroded pial.
  2. If not, if importing a closed bihemispheric pial surface created in freesurfer or MNE, is the BEM mesh generator able to create a downsampled, closed mesh nonintersecting with the established (inner skull, outer skull, skin) meshes?
    I know the latter depends to some extent on the number of vertices selected for neighboring meshes, but in principle, the question is whether a highly nonconvex surface (such as merged pial) can be using in brainstorm to generate an acceptable BEM mesh (closed, nonintersecting) to be used for BEM with tools such as openmeeg?

Not directly related,
3. In the case of ecog type BEMs, if having mixed depth (IP) and subdural (convex cortex, ECOG) type sensors, after selecting the sensory types in brainstorm for each electrode (ip and ecog), can one generate a gain matrix with openmeeg via the GUI combining the IP and ECOG type leadfields?

Thank you,


Hi Octavian,

I’m not sure to follow what you are trying to do: you want to export the surfaces from Brainstorm as .tri files, run OpenMEEG on your own, and re-import the gain matrix in Brainstorm?

  1. The “Merge surfaces” menu does nothing but a concatenation of the input surfaces. It literally concatenates the Vertex matrices in input, and update the Faces indices accordingly. If the the input surfaces are closed, the output is a closed surface. Or am I missing the point of your question?
  2. The menu “Generate BEM surfaces” takes the inner skull and outer skull surfaces of the Colin27 template, deform them so that they fit the head envelope of the subject. If a cortex surface is available, it makes sure that the inner skull and the cortex envelope are not intersecting. Nothing else.
    I don’t know if you can use a pial surface as a BEM layer in OpenMEEG. I’m forwarding the question to the OpenMEEG developers for more details.

Note that if you are planning to consider that everything between the FreeSurfer pial and the inner skull surfaces is CSF, it’s most likely a wrong assumption. The FreeSurfer model for generating the pial surface is not growing the volume enough. BrainSuite would probably be a bit more adapted for that purpose. Then what do you do with the meninges? Are you including them in your CSF layer?

  1. If you have multiple sensor types (deep electrodes, ECOG, EEG, MEG), the leadfields are calculated independently for each modality. Then sources can be estimated independently for each sensor type.
    Note that there is no good method yet to reconstruct sources for multiple types of sensors at once.


Dear Francois,

All points well taken, I do not have an answer yet, thanks for your suggestions.

A thought was to generate skin, outer and inner skull with brainsuite, import those in brainstorm as such (dfs) or via MNE (apparently can be converted, I have not personally done it), maybe erode the inner skull some (via MNE), and use a freesurfer pial surface (folded or smooth, as such or dilated, all these can be done in freesurfer) to define the CSF/ gray boundary, and use an eroded (2-3 mm) pial or white/gray junction surface to define source surfaces. Then, all these can be downsampled via brainstorm to the final BEM meshes to be forwarded to openmeeg. At some point, it would be nice if one gets to convert NFT toolbox derived meshes to freesurfer or brainstorm, if it was not done already.
I am sure that there would be intersecting/open surface/ excessive boundary proximity issues, again I have not tried it.

As to your point about too large of a CSF space if using inner skull, I totally agree, but until someone is able to semiautomatically generate a dura surface to be used in a pipeline to define the subarachnoid space to multiple subjects…one may usually use bulk solutions, such as erosions.

You were mentioning that freesurfer pial is not grown enough for a good boundary, can you detail on what basis that would be? Again, this can be dilated, but I am curious.

(the reasons I try to stick with freesurfer for the cortex include backward experiment consistency, good atlases/surface based intersubject coregistration).

Thank you,


A thought was to generate skin, outer and inner skull with brainsuite

The inner/outer skull surfaces generated by BrainSuite can be imported in Brainstorm but cannot be used for BEM modeling, they are to complex and have too many vertices.

use a freesurfer pial surface (folded or smooth, as such or dilated, all these can be done in freesurfer) to define the CSF/ gray boundary, and use an eroded (2-3 mm) pial or white/gray junction surface to define source surfaces

Three problems: 1) Your different layers will be intersecting, 2) some dipoles will be outside of the innermost layer, 3) first try running a 3-layer BEM with OpenMEEG with one layer with 15000 sources, you probably need hundreds of Gb of memory (and you can’t downsample folded surfaces, or you lose the folds…)

Good luck.

Thank you, Francois,

Tough issues, there are several papers on using openmeeg with 4-layer BEMs out there, I will try to find out how they do it,