Slow MEM Process

Hi!
I have been testing Brainstorm and encounter a problem:
When I select Compute Sources [2018] and the option MEM, the process starte, but never ends.
I left it for a day, and only reached 5%, and another day I left it working for another day and never got over 0%.
Any idea of why this may be happening?
Thank you!

The MEM source mapper is quite slow so please make sure you run it on short epochs (~1s for instance).

1 Like

Adding some of the developers of the MEM:
@jafnan @cgrova @edelaire

Hello,

Thanks for the tag @Raymundo.Cassani

Can you give us a bit more detail about the signal you are trying to localize @Patrigoyanes?
Notably, the duration of the cording and the sampling rate. Also, how many vertices is there on your cortical surface? Can you also show us the parameter you used to start MEM?

Edouard

Hi,
I have been running it on epochs of aprox 0.2 s.
I link a picture with the specifications below.


I tried to run it, but almost 21 hours later, it is still on 4%...
Thank you.

Hi,
I am trying to achieve the brain representation with the convolutions, because the cortex representation is not as accurate and does not help for identifying the sources.
Do you nedd any further detail?
Thank you.

I get this errors, and then it stops upgrading the MEM percentage:

Error using message/getString
Unable to load a message catalog 'optim:fminusub'. Please check the file
location and format.

Error in createExitMsg (line 32)
basicMsg = getString(message(basicMsgArgs{:}));

Error in fminusub (line 322)
    output.message = createExitMsg(msgData{:});

Error in fminunc (line 499)
   [x,FVAL,GRAD,HESSIAN,EXITFLAG,OUTPUT] = fminusub(funfcn,x, ...

Error in be_minimize_free_energy (line 56)
    [lambda, entropy, xxx, out]  = fminunc(...

Error in be_solve_mem (line 56)
[mem_struct.lambda, entropy, iter] = be_minimize_free_energy(mem_struct);

Error in be_launch_mem>MEM_mainLoop (line 185)
        [J, mem_results_struct] = be_solve_mem(mem_structure);

Error in be_launch_mem (line 102)
        [R, E, A, S] = MEM_mainLoop(ii, Data, obj, OPTIONS);

Error in be_cmem_solver (line 182)
[obj.ImageGridAmp, OPTIONS] = be_launch_mem(obj, OPTIONS);

Error in be_main_call (line 157)
    [Results, MEMoptions]   = feval(['be_' lower(MEMoptions.mandatory.pipeline) '_solver'], HeadModel, MEMoptions, Results );

Error in be_main (line 60)
    [Results, OPTIONS]  =   be_main_call(varargin{:});

Error in process_inverse_2018>Compute (line 685)
                [Results, OPTIONS] = be_main(HeadModel, OPTIONS);

Error in process_inverse_2018 (line 24)
eval(macro_method);

Error in panel_protocols>TreeInverse (line 1390)
            [OutputFiles, errMessage] = process_inverse_2018('Compute', iStudies, iDatas);

Error in panel_protocols (line 46)
eval(macro_method);

Error in tree_callbacks>@(h,ev)panel_protocols('TreeInverse',bstNodes,'2018') (line 2660)
        gui_component('MenuItem', jPopup, [], 'Compute sources [2018]', IconLoader.ICON_RESULTS, [], @(h,ev)panel_protocols('TreeInverse', bstNodes, '2018'));

It seems you dont have access to the optimisation toolbox. Can you change the optimisation method from fminunc to minFunc for the optimisation routine ? you will need to click on the export mode to change that parameter.

How do I access those parameters?
I only find the export protocol option and there is no optimisation method, as far as I can see...
Thank you!

You need to first click on expert and then change optimisation routine. See screenshot

image

Also note that, if you are using cMEM its is not a good idea to use the entire recording as baseline. As you are trying to find the contrast between the between signal of interest in the data and a baseline/background

Hi,
I tried the same process with another computer and I get the cortex I want, a more detailed version of the brain with the convolutions.
Why could that be?
Thank you!

hello,

i am sorry, i am not sure to understand your question. MEM is using the forward model to define the source space (which is often the cortical surface).

I am not sure what are the convolutions you are mentioning. How was your forward model defined in brainstorm ?

Maybe @Raymundo.Cassani can help on that :slight_smile:
Edouard

Hi,
What I mean is that I try the same process, at the same time, following the same steps as a colleague, and I get this cortex


and my colleague achieves this other one
image
Thank you.

Hi @Patrigoyanes, please ensure that you and your colleague are using the same default cortex (indicated in green). It may be the case that the slower processing is caused by a larger number of vertices in the cortical surface.

image

1 Like

Hi,
Yes, I have checked and we are both selecting the same cortical surfaces...
Thank you.

About the "detailed version of the brain with the convolutions".
Have you tried to reduce change the Smoothness of the surface?
https://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#Surfaces