Error in OpenMEEG in MEG data


I know the OpenMEEG team worked a lot for correcting some bugs lately but it seems that the new version did not solve everything.

I have EEG/MEG data in which I want to compute the head model in EEG and in MEG.

It is working well in EEG, but for the same meshes, I have the following error for MEG:

** Error: No noise covariance matrix available.

Unable to perform assignment because the size of the left side is 294-by-24006 and the size of the right side is 2316-by-24006.

Error in bst_openmeeg (line 450)
    Gain(OPTIONS.iMeg, :) = om_load_full(meggain_file);

Error in bst_headmodeler (line 470)
        [Gain, errMessage] = bst_openmeeg(OPTIONS);

Error in panel_headmodel>ComputeHeadModel (line 647)
        [OPTIONS, errMessage] = bst_headmodeler(OPTIONS);

Error in panel_headmodel (line 27)

Error in panel_protocols>TreeHeadModel (line 1156)
    [OutputFiles, errMessage] = panel_headmodel('ComputeHeadModel', iChanStudies);

Error in panel_protocols (line 44)

Error in tree_callbacks>@(h,ev)panel_protocols('TreeHeadModel',bstNodes) (line 2271)
        gui_component('MenuItem', jPopup, [], 'Compute head model', IconLoader.ICON_HEADMODEL, [], @(h,ev)panel_protocols('TreeHeadModel',

I am using 64-bit Ubuntu, in Matlab 2018b, with an up-to-date version of brainstorm (28-sep-2018) and OpenMEEG (

Thank you


hi Tanguy,

can you share the content of the tmp folder containing the openmeeg files?

3 options I see:

  • another IO Bug on OpenMEEG code
  • bug in the brainstorm wrapper for MEG
  • left over files from old OpenMEEG versions


This tmp folder is in your home folder, something like:

Zip all its contents immediately after getting this error. Restarting a new computation, closing or starting Brainstorm empties this folder.

Here you are:

I could not replicate the crash using the files attached:

I just hacked some MEG sensor locations to complete the computation.

Can it be a pb with brainstorm MEG leadfield? or maybe it's because you did not provide the MEG sensor locations?


I’m not sure what you mean by the brainstorm MEG leadfield. But for sure the MEG sensor locations were provided!

The thing is that with the exact same data, if I use an older version of OpenMEEG (2.2.0), I am able to calculate the gain matrix without crash…

ok so with your squids file I had not seen I do see something weird.

I opened an issue:

thanks a lot for the issue report.

let’s hope we can fix this quickly.


Sorry for my late response. Unfortunately I cannot replicate.

@Francois from the matlab trace I’ve trouble to figure out which om_ binary failed. It seems that it might be om_load_full but I find it weird (actually i don’t even know what that binary is). om_gain is the usual suspect.

@tanguy could you run an ldd of the binary that brainstrom is executing underneath?
this is what I get on my pc:

(base) ❯ ldd ~/.brainstorm/openmeeg/linux64/om_gain (0x00007ffc757fe000) => /usr/lib/x86_64-linux-gnu/ (0x00007f615daf4000) => /home/sik/.brainstorm/openmeeg/linux64/ (0x00007f615d738000) => /home/sik/.brainstorm/openmeeg/linux64/ (0x00007f615c285000) => /usr/lib/x86_64-linux-gnu/ (0x00007f615c055000) => /lib/x86_64-linux-gnu/ (0x00007f615bcb7000) => /usr/lib/x86_64-linux-gnu/ (0x00007f615b929000) => /lib/x86_64-linux-gnu/ (0x00007f615b711000) => /lib/x86_64-linux-gnu/ (0x00007f615b320000) => /lib/x86_64-linux-gnu/ (0x00007f615b11c000) => /lib/x86_64-linux-gnu/ (0x00007f615aefd000) => /lib/x86_64-linux-gnu/ (0x00007f615ace0000)
	/lib64/ (0x00007f615dcfb000)

Here’s what I get:

capulet 119% ldd ~/.brainstorm/openmeeg/linux64/om_gain =>  (0x00007ffcb2c77000) => not found => not found => /usr/lib/x86_64-linux-gnu/ (0x00007fc086f53000) => /lib/x86_64-linux-gnu/ (0x00007fc086c4d000) => /usr/lib/x86_64-linux-gnu/ (0x00007fc086937000) => /lib/x86_64-linux-gnu/ (0x00007fc08671f000) => /lib/x86_64-linux-gnu/ (0x00007fc086356000) => /lib/x86_64-linux-gnu/ (0x00007fc086152000) => /lib/x86_64-linux-gnu/ (0x00007fc085f34000)
	/lib64/ (0x00007fc087182000)

@tanguy we don’t manage to replicate on multiple machines. You get this errors on all subjects? can you try on a different machine to see if you can replicate?


Yes, I get this error in all the machines in the lab (all Linux64) and all my MEG subjects (.ds files). Do you want me to send you some data to test with?

Thank you

@tanguy. My fault, can you export the LD_LIBRAY_PATH and repeat the ldd? I think that this not found would disappear.
Then the next step would be to replicate the call that brainstorm does.

see, these threads:

@Francois the BST error claims a missing covariance matrix, ant the openmeeg_log.txt shows no failure.

I think the error about the missing noise covariance matrix is unrelated, this does not happen in the same tasks.
This is probably something that residual that was in the Matlab command window.

@Francois is right. The missing noise covariance error is an unrelated warning that I’ve copied/pasted by mistake. It is not part of my OpenMEEG problem, my bad.

I am not sure what to do now, I’ve updated my LD_LIBRARY_PATH and now all the libraries are seen by ldd. If I launch om_gain from a terminal, I’ve got no error, but in brainstorm, it is still not working. Any idea?

capulet 159% cd ~/.brainstorm/openmeeg/linux64
capulet 160% ldd ./om_gain =>  (0x00007ffeae976000) (0x00007ff3ed98a000) (0x00007ff3ec4d7000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff3ec2a8000) => /lib/x86_64-linux-gnu/ (0x00007ff3ebfa2000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff3ebc8c000) => /lib/x86_64-linux-gnu/ (0x00007ff3eba74000) => /lib/x86_64-linux-gnu/ (0x00007ff3eb6ab000) => /lib/x86_64-linux-gnu/ (0x00007ff3eb48d000) => /lib/x86_64-linux-gnu/ (0x00007ff3eb289000) => /opt/minc-itk4/lib/ (0x00007ff3eb06e000)
	/lib64/ (0x00007ff3edd46000)
capulet 161% ./om_gain -MEG ~/.brainstorm/tmp/openmeeg_hminv.mat ~/.brainstorm/tmp/openmeeg_dsm.mat ~/.brainstorm/tmp/openmeeg_h2mm.mat ~/.brainstorm/tmp/openmeeg_ds2meg.mat ~/.brainstorm/tmp/openmeeg_gain_meg.mat                                                                                                                                                                       ./om_gain version 2.4.1 compiled at Aug 29 2018 08:19:44 using OpenMP
 Executing using 4 threads.

| ------ ./om_gain
| -MEG
| /home/bic/tanguy/.brainstorm/tmp/openmeeg_hminv.mat
| /home/bic/tanguy/.brainstorm/tmp/openmeeg_dsm.mat
| /home/bic/tanguy/.brainstorm/tmp/openmeeg_h2mm.mat
| /home/bic/tanguy/.brainstorm/tmp/openmeeg_ds2meg.mat
| /home/bic/tanguy/.brainstorm/tmp/openmeeg_gain_meg.mat
| -----------------------
| Elapsed Time: 49.137 s.