DICS beamformer for BS(2)

Dear Francois and all,

I have recently implemented a Fieldtrip-based DICS beamformer source modeling pipeline in BS, suitable to estimate induced activations from single-trial data for a selected time and frequency of interest.

A copy of the pipeline is available on GitHub:
https://github.com/vyoussofzadeh/DICS-beamformer-for-Brainstorm

I would like to share it with the community and possibly make it as an official function of the BS. Happy to hear comments on this.

If interested, I can work on a document to guide users on how to use the pipeline. I can add that to the GitHub repository.

Regards,
Vahab

Dear Vahab,

This is great! It would be indeed a very useful addition to Brainstorm.

For the integration, I think making your process function more independent would be sufficient:

  • Remove all references to anything local on your computer
  • Integrate all the non-FieldTrip sub-functions (vy_*.m) directly at the end of the code of the process function
  • Clean the code and remove everything that is commented
  • Remove all the displays or user interactions: a process must be capable of running on a distant computation node with no display attached. For extra displays: save the relevant files in the database and let the user display after the computation. Replace all interactivity with additional options. If you need display modes that are not available in Brainstorm: please describe precisely what you need and post a few screen captures here.
  • Either reintegrate everything you removed from the original process_ft_sourceanalysis.m (with the goal of replacing the existing one), or do not mention that it is a modified version of this process and make it something something completely different (process_ft_dics.m for instance)

Then open a PR on the brainstorm3 repository to submit your process function. We'll discuss further implementation details there.

For the documentation: The best would be a new online tutorial, if possible based on the existing introduction tutorials (or one of the advanced tutorials), explaining step by step with screen captures how to call your code and how to interpret the results. It would be an advanced tutorial in the section "Source modeling". If you are interested, I'll send you the instruction for creating an account on the wiki, so you can work directly on the online version.
https://neuroimage.usc.edu/brainstorm/Tutorials

Thanks!
Francois

Hi Francois,

Sounds great!

Thanks for the tips. Okay, I'll work on it soon, and will keep you posted on the progress.

Regards,
Vahab

Hi Vahab,

Have you ever made any progress in this direction?

Thanks
Francois

Hi Francois,

Apologies for the long delay in getting back to you. It looks like all the brainstorm emails are being filtered in my email, and that's why I did not see your communication earlier.

Thanks for asking. Yes, I made some edits (thanks to your comments) to make it standalone and less complex but, I did not have further progress. I also did some testing to make sure the pipeline works fine, and I believe it is now ready to be added to BS, of course, if it has not been added yet.

As for the next step, I plan to allocate some time to make it fully compatible with BS, but I need help from you or your team members specially on implementing a GUI to receive the input parameters (eg., frequency range, frequency tampering, the time of interest, etc.). Also, some parameters are selected after the TFR map is generated. Not sure if the TFR (or cross-spectral densities) should be generated (and saved) separately (outside) or on the fly (as is now). And, just to let you know, my implementation is based on a baseline-corrected version of the DICS beamformer (i.e., relative source power with respect to baseline/pre-stim data), and it is more or less consistent with the original implementation, fieldtriptoolbox.org/tutorial/beamformer/ However, output is generated based on decreased power values (desynchrony effects) on the cortical surface.

Best,
Vahab

but I need help from you or your team members specially on implementing a GUI to receive the input parameters (eg., frequency range, frequency tampering, the time of interest, etc.)

The various option types are documented in this tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess#Definition_of_the_options

If there are some that you don't know how to define: keep them hard-coded in your code, and let me know what type of input it should be, and with which possible values.

Not sure if the TFR (or cross-spectral densities) should be generated (and saved) separately (outside) or on the fly (as is now).

I don't know either.
@Sylvain @John_Mosher ?

Thanks, @Francois. I'll work on it, and will keep you posted.

Done, added a pull request to the brainstorm3 repository. Looking forward to hearing your comments.

Thanks, I will review it soon.

Link to the Github pull request:
https://github.com/brainstorm-tools/brainstorm3/pull/414

Hi DICS developers,

One quick question about the DICS interface settings.
I have the following parameters and options:

  • ERD/ERS/both
  • abs/raw
    ERD and ERS both return a positive activation index. Once the hypothesis is fixed, that it is convenient. I could not find any difference in the results between abs and raw. When are they supposed to be used?

Thanks in advance,

Cheers,
Tommaso

Hi Tommaso,

Thanks for using the DICS-BF tool. I hope it has been helpful in your research. Good catch. This is indeed a bug in the script. I agree, it provides absolute value only, regardless of ERD/S selection. I will fix it ASAP. In the meantime, you can do the following: Open up process_ft_sourceanalysis_dics.m, comment out (or remove) lines 306 and 314 (where the absolute values of the ERD and ERS source_diff_dics.pow variables are calculated) and, update line 380 with the following: source_diff_dics.pow = source_diff_dics.pow to keep raw values preserved.

Thank you again, and please let me know if you have any other comments to improve the function.

Best,
Vahab

@vahab
The PR is merged: https://github.com/brainstorm-tools/brainstorm3/pull/468
Thanks for fixing the code!

@Tommaso
Please update Brainstorm and try again.

Thank you both!

Dear Forum, dear @vahab , is there an easy way to use your DICS beamformer implementation in Brainstorm for Coherence source analysis in resting state data? Or is it generally planned to include that into Brainstorm?

Thank you and best wishes,

Bahne

Dear @BahneBahners,

Thank you for your thoughtful inquiry. The active project to implement the DICS beamformer for coherence source analysis in resting-state data presents notable challenges due to the absence of a definitive baseline.

If you're keen to explore this subject, I can offer a preliminary script that might serve as a foundational tool: BS DICS Resting-State Analysis Script.

To utilize the script, copy it into the following directory: brainstorm3/toolbox/process/functions. Then, execute the pipeline using the process window/sources in Brainstorm.

This initial script version is designed to analyze specific frequency bands in comparison to broadband frequencies, specifically around 15±12 Hz. For computational efficiency, the data is downsampled to 500 Hz during analysis. The inputs tested (on BS ver.2022) with this script were 2-second segments extracted from 10-minute intervals of cleaned resting-state data, treating each segment as an independent trial.

For any further questions or detailed information, feel free to reach out to me at vyoussofzadeh@mcw.edu.

With extensive validation and testing on larger datasets, I am hopeful that we will be able to integrate this methodology into the Brainstorm software suite.

Best regards,
Vahab

Dear @vahab , thank you so much! I will look into it and let you know, if I make any progress. thanks again and best wishes, Bahne