Reference of the gain matrix - EEG OPENMEEG BEM in Brainstorm

Hi Rasheeda,

This depends of what you are doing.
The forward models (the .Gain fields) that are produced by Brainstorm and OpenMEEG are calculated for an arbitrary reference.
It doesn't matter much what reference you are using as long as you are using the same for the EEG recordings and the forward operator.
Before using this Gain matrix, you need to convert it to the same type of reference your recordings are using.

Because it's quite complicated in terms of interface to handle multiple reference systems (average / fixed / linked), we decided at some point to convert everything to an average reference. It means less flexibility in the computation model but prevents the recurring reference errors.
In the calculation of the inverse model, we replace the forward operator G with (VG) where V is the average reference operator. If S are the estimated sources and M the EEG measures, you have something like:
S = (GTG + lam.I)-1GTM
S = (GTVTVG + lam.I)-1GTVTM
S = (GTVG + lam.I)-1GTVM (because VT=V and VV=V)
S = (K.V) . M

What is saved in the source files in Brainstorm is ImagingKernel=(KV).
Hence our inverse operator already contains the average reference operator embedded, there is no need to apply it manually to the recordings before the multiplication ImagingKernel*EEG.

If you use directly the Gain matrix for your own computations, you have to take this into consideration.
In Brainstorm, you never have to explicitly convert the EEG to an average reference, but if you do some things manually you may have to.

Hope this helps,
Francois