brainstorm3 icon indicating copy to clipboard operation
brainstorm3 copied to clipboard

[Tutorial] EEG and epilepsy - add cMEM estimate

Open Edouard2laire opened this issue 1 year ago • 9 comments

Hello,

As we will be merging https://github.com/multifunkim/best-brainstorm/pull/13 soon, this PR update the script corresponding to cMEM of the two following tutorials:

  • [x] https://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy Note: I am getting this warning from the script: image

Should we fix the script to get a better head model?

  • [x] https://neuroimage.usc.edu/brainstorm/Tutorials/TutBEst

Edouard2laire avatar Jul 11 '24 20:07 Edouard2laire

When trying to run the pipeline, running:

sAvgSrcMEM = bst_process('CallProcess', 'process_inverse_mem', sFilesAvg, [], ...

gives the error:

Line 16: fminusub
Objective function is undefined at initial point. Fminunc cannot continue.
_______________________________________________
Call stack: 
>fminusub.m at 16 
>fminunc.m at 488 
>be_minimize_free_energy.m at 56 
>be_solve_mem.m at 56 
>be_launch_mem.m>MEM_mainLoop at 185 
>be_launch_mem.m at 79 
>be_cmem_solver.m at 182 
>be_main_call.m at 157 
>be_main.m at 60 
>process_inverse.m>Compute at 696 
>process_inverse.m at 24 
>process_inverse_mem.m>Run at 139 
>process_inverse_mem.m at 24 
>bst_process.m>Run at 236 
>bst_process.m>CallProcess at 2316
>bst_process.m at 38

How can i update the MEM figure from the tutorial ? i would like to change it to

Firs,t login in the in the Brainstorm website, button at upper right corner. (If you do not have an account, please send me an email, so I can give you the necessary info details on creating one)

After login, on the tutorial page to edit, go to the top navigatin bar, then Menu > Attachments. Then update the tutorial, use this use this syntax:

{{attachment:sim_ar_spectra_metrics.png||width="100%"}} More info on working with images on Moinmoin here: http://moinmo.in/HelpOnImages

rcassani avatar Jul 15 '24 16:07 rcassani

When trying to run the pipeline, running:

sAvgSrcMEM = bst_process('CallProcess', 'process_inverse_mem', sFilesAvg, [], ...

gives the error:

Line 16: fminusub
Objective function is undefined at initial point. Fminunc cannot continue.
_______________________________________________
Call stack: 
>fminusub.m at 16 
>fminunc.m at 488 
>be_minimize_free_energy.m at 56 
>be_solve_mem.m at 56 
>be_launch_mem.m>MEM_mainLoop at 185 
>be_launch_mem.m at 79 
>be_cmem_solver.m at 182 
>be_main_call.m at 157 
>be_main.m at 60 
>process_inverse.m>Compute at 696 
>process_inverse.m at 24 
>process_inverse_mem.m>Run at 139 
>process_inverse_mem.m at 24 
>bst_process.m>Run at 236 
>bst_process.m>CallProcess at 2316
>bst_process.m at 38

Did you download the new MEM version https://github.com/Edouard2laire/best-brainstorm/archive/refs/heads/wMEM.zip?

this error is due to the fact that the script is having an error with the forward model image

So for some vertex, G is 0 for all the sensors and it cause issue with MEM. I made the new version of MEM more robust to that https://github.com/multifunkim/best-brainstorm/commit/9fe87409b8472887b87742ba47fa1fdce3c9add7 but I guess we should also fix the forward model from the script :)

How can i update the MEM figure from the tutorial ? i would like to change it to

Firs,t login in the in the Brainstorm website, button at upper right corner. (If you do not have an account, please send me an email, so I can give you the necessary info details on creating one)

After login, on the tutorial page to edit, go to the top navigatin bar, then Menu > Attachments. Then update the tutorial, use this use this syntax:

{{attachment:sim_ar_spectra_metrics.png||width="100%"}} More info on working with images on Moinmoin here: http://moinmo.in/HelpOnImages

Thx. :)

Edouard2laire avatar Jul 15 '24 16:07 Edouard2laire

also @rcassani, what do you think of the idea to move MEM just after sLoreta ? i think it make more sense to do all the Source analysis: Surface at the same time instead of sLoreta, then volume then back to surface with MEM

Edouard2laire avatar Jul 15 '24 16:07 Edouard2laire

I tried with the master branch on https://github.com/Edouard2laire/best-brainstorm which is the one used in Brainstorm when installing and updating the brainentropy plugin

About the order, I think we can move MEM after sLORETA. With its own section with the [Advance] label.

rcassani avatar Jul 15 '24 17:07 rcassani

About the order, I think we can move MEM after sLORETA. With its own section with the [Advance] label.

ok. if I may, the tutorial editor is probably the worst editor i had to use to write text so far. Like, i think it can really remove the will to live to even the most joyous person...

Page took 20 minutes to save and is now full of conflict without even the slightest possibility to go back in time, that pasting doesn't work (what text editor doesn't support ctrl+c, ctrl+v???), or that the editor chooses randomly to put half of the page in bold without possibility to remove it if you select the link at the same time as text... or the attachment system!

image

Edouard2laire avatar Jul 15 '24 21:07 Edouard2laire

Indeed, writing in MoinMoin is a real pain, apologies for all the suffering. Few pointers:

  • Admin users can revert pages (let me know if you need to do so)
  • The slowness things is not on MoinMoin side, but today's issue with the server
  • It helps to edit the text without their fancy editor, but using the "Show Raw Text" editor

rcassani avatar Jul 15 '24 22:07 rcassani

Hi @rcassani

it seems that the change in the BEM surface https://github.com/brainstorm-tools/brainstorm3/pull/721/commits/fcce1d7d10135be1952dc76af09c5d7d40227524 to fix the warning about dipole outside the skull is making quite a difference in the inverse problem solution; including for sLoreta:

Screenshot 2024-07-15 at 21 01 26

Do you know if that is correct ?

Edouard2laire avatar Jul 16 '24 01:07 Edouard2laire

Indeed, writing in MoinMoin is a real pain, apologies for all the suffering. Few pointers:

  • Admin users can revert pages (let me know if you need to do so)
  • The slowness things is not on MoinMoin side, but today's issue with the server
  • It helps to edit the text without their fancy editor, but using the "Show Raw Text" editor

Indeed, the raw text editor is much better ! :)

Edouard2laire avatar Jul 16 '24 03:07 Edouard2laire

https://github.com/multifunkim/best-brainstorm/pull/13 is now merged. The PR is now ready to be reviewed :)

Edouard2laire avatar Sep 05 '24 18:09 Edouard2laire

Done :)

it's ready to review

Edouard2laire avatar Nov 19 '24 19:11 Edouard2laire