Inverse Kernel for Unconstrained EEG Source Estimation

Hello Brainstorm team,

I'm trying to extract the inverse kernel generated from an unconstrained MNE source estimation and I noticed that the ImagingKernel matrix is of size [3417 x 64], while the GridLoc is of size [1139 x 3]. Am I correct in assuming that the imaging kernel has 3 times the number of vertices because the source estimation is unconstrained so we get 3 sources per vertex, one corresponding to the electric field in the x, y, and z directions?

If that's the case, how is the ImagingKernel is ordered, or in other words, reshaped from [3 x 1139 x 64] to [3417 x 64]? Does the matrix store the sources for each vertex (i.e. x1, y1, z1, x2, y2, z2..., x1139, y1139, z1139), or does it store all the sources for each direction (i.e. x1, x2, ... x1139, y1, y2, ... y1139, z1, z2, ..., z1139)?

I'm curious about this because I would like to find the magnitude of the source at each vertex, so perhaps the norm of the x, y, z components. Sorry if this question has already been asked, but I can't seem to find it in the forums.

Thanks a lot for your help in advance!


You can refer to the head model tutorial. For unconstrained source models, the list of sources in the Gain matrix (headmodel.mat) and the ImagingKernel (results_KERNEL.mat) is the same: