Hello. In this case I’m reasonably confident the problem is something I’m doing rather than a bug based on the handful of other threads similar to this, so I’m filing under “Discussions”. I have mixed head models for all subjects, as well as an EEG noise covariance matrix for each subject. I am selecting the option “Compute sources [2018]” for a condition, and selecting the defaults (Method Minimum norm imaging). I get the following output and error at the command line:
BST_INVERSE (2016) > Modified Feb 2018
BST_INVERSE (2018) > Deep Brain Analysis for 5 submodels
BST_INVERSE (2018) > NOTE: Cross Covariance between sensor modalities IS NOT CALCULATED in the noise covariance matrix
BST_INVERSE > Rank of the 'EEG' channels, keeping 255 noise eigenvalues out of 257 original set
BST_INVERSE > Using the 'reg' method of covariance regularization.
BST_INVERSE > Diagonal of 10.0% of the average eigenvalue added to covariance matrix.
BST_INVERSE > Using 'free' surface orientations
BST_INVERSE > Using 'fixed' surface orientations
BST_INVERSE > Using 'fixed' surface orientations
BST_INVERSE > Using 'free' surface orientations
BST_INVERSE > Using 'free' surface orientations
Error using svd
Input to SVD must not contain NaN or Inf.
Error in bst_inverse_linear_2018 (line 764)
[UL,SL2] = svd((L*L'));
Error in process_inverse_2018>Compute (line 638)
[Results, OPTIONS] = bst_inverse_linear_2018(HeadModel, OPTIONS);
Error in process_inverse_2018 (line 24)
eval(macro_method);
Error in panel_protocols>TreeInverse (line 1221)
[OutputFiles, errMessage] = process_inverse_2018('Compute', iStudies, iDatas);
Error in panel_protocols (line 44)
eval(macro_method);
Error in tree_callbacks>@(h,ev)panel_protocols('TreeInverse',bstNodes,'2018') (line 2302)
gui_component('MenuItem', jPopup, [], 'Compute sources [2018]', IconLoader.ICON_RESULTS, [], @(h,ev)panel_protocols('TreeInverse', bstNodes, '2018'));
>>
Let me know if you need more information/data to help me figure this out. Thanks,
Hi Karl,
Maybe there is something wrong with your noise covariance matrix. Display it and make sure it was properly computed (non-zero values for all the EEG channels).
François
The noise covariance looks like what we expect.
Then there is maybe an issue with the forward model. Have you used OpenMEEG?
There are bugs that are currently being identified and fixed with OpenMEEG, which could cause some parts of the gain matrix to be left empty.
Right-click on the head model > File > Export to Matlab > “HeadmodelMat”, and check if HeadmodelMat.Gain contains lots of zeros or NaN value.
If so, this is also a bug you could report to the OpenMEEG team.
Can you try with the 3-shell sphere model instead, to check if it works correctly?
Yes I used OpenMEEG, and yes there are many zeros in the gain matrix, thought that was suspicious:
Data exported as "HeadmodelMat"
>> size(HeadmodelMat.Gain)
ans =
257 44565
>> numel(find(HeadmodelMat.Gain==0))
ans =
10261496
>> figure;imagesc(HeadmodelMat.Gain);colorbar
I will report the issue to the OpenMEEG team, and try the 3-shell sphere model.
@Francois Can you advise which files I should share to reproduce this gain matrix?
Also, I am able to create a head model with the 3-shell sphere method. But when I click on compute sources for one of my stimulus conditions and look at the results, there doesn’t seem to be anything there. If I right-click and look at Cortical activations, there is nothing there and if I click on Project sources it says “Source and destination surfaces are the same for all the selected files. Nothing to project…” Not sure if I’m doing something wrong.
Actually the intermediate matrices should be in .brainstorm/tmp/ as in the previous case. What I’m not sure is when the cleaning is carried out. But if you execute the code step by step it should be possible to stop it right before.
I see what you mean. I’ll create the OpenMEEG head model again and see if the intermediate files remain in the tmp directory. @Francois can you advise where I could a breakpoint etc. right before the tmp files are removed?
I’ve open an issue in openmeeg. Something I did not try was to replicate with previous versions of openmeeg http://openmeeg.gforge.inria.fr/download/ I’m away of the keyboard. Could you check if the issue described in openmeeg replicates with previous versions?
Ok I can confirm that the same result is obtained from version 2.2.0. I used that one since that version was mentioned previously, let me know if you think using some other version might yield something different. I used the three mat files that @sik referenced on the issue report on the OpenMEEG Github. Here is what I did:
@Francois, I am able to create a head model with the 3-shell sphere option from my mixed cortex + subcortical surface. Then I click “Compute sources [2018]” for one of my stimulus conditions and on “MN: EEG(Mixed) 2018” I right click and click on “Cortical activations” but nothing is there, in any of the displays. I see no activations anywhere. Does this indicate what a problem might be?
@Francois the problem is matio i/o. I wanted to do a PR changing all matrix extensions from mat to bin which should solve the problem but I found out that this is already in the code base.
@sik bst_openmeeg_bin.m has not been updated for a long time, I don’t think this is a good idea to recommend using it as is. It would automatically replace openmeeg 2.4 with 2.2…
I think you’d rather submit a new bst_openmeeg_bin.m by copying bst_openmeeg.m and replacing all the .mat with .bin (what you suggested initially). Or adding the file extension as an input parameter to bst_openmeeg.
Thanks @Francois. Actually I was only looking at time zero because I didn’t notice that you can specify a time in the main window to advance through the activations. I now see activations, although they’re not at all what I expect. For example I am expecting largely subcortical sources but am seeing the opposite: Distributed activation all throughout the cortical surface. But I will continue to try to figure that out.
Meanwhile, I have been using the 3-shell sphere head model, but I see that the necessary fixes to OpenMEEG and Brainstorm look to have been merged. @sik and @Francois, can I now use the OpenMEEG head model instead, on both macOS and Linux? Will they update automatically or do I have to do something manually to use the latest versions?
I'd recommend you start by reading all the introduction tutorials using the example dataset before trying to use Brainstorm on your own data. https://neuroimage.usc.edu/brainstorm/Tutorials
In the meantime we'll finish fixing the distribution. Most likely, you'll have to update Brainstorm manually (menu Update > Update Brainstorm), which will then update OpenMEEG automatically.