Size: 3863
Comment:
|
Size: 4917
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
This tutorial will host the steps to use the [[https://github.com/mickcrosse/mTRF-Toolbox|mTRF-Toolbox]] in Brainstorm. ... | This tutorial introduces the Temporal Response Function (TRF) analysis within the Brainstorm environment, employing the [[https://github.com/mickcrosse/mTRF-Toolbox|mTRF-Toolbox]] as plugin. |
Line 9: | Line 9: |
This tutorial introduces the Temporal Response Function (TRF) analysis within the Brainstorm environment, employing the mTRF Toolbox. TRF analysis is instrumental in delineating the dynamics of the brain's response to continuous stimuli, such as speech and music, providing insights into the underlying neural mechanisms. | Temporal Response Function (TRF) analysis is instrumental in delineating the dynamics of the brain's response to continuous stimuli, such as speech and music, providing insights into the underlying neural mechanisms. The present tutorial will show the TRF analysis functionality within the Brainstorm interface using the [[https://github.com/mickcrosse/mTRF-Toolbox|mTRF-Toolbox]] as plugin. For a detailed documentation, more examples and citation for the mTRF-Toolbox, please refer to the [[https://github.com/mickcrosse/mTRF-Toolbox|mTRF-Toolbox GitHub page]]. . {{attachment:bst_mtrf_intro.gif||width="40%"}} This tutorial uses data from the [[https://neuroimage.usc.edu/brainstorm/DatasetIntroduction|introduction dataset]], and can be followed by completing all steps of the [[https://neuroimage.usc.edu/brainstorm/Tutorials#Get_started|Get Stared]] tutorials up to and including [[https://neuroimage.usc.edu/brainstorm/Tutorials/ArtifactsFilter|tutorial 10]]. |
Line 12: | Line 16: |
In order to use the process files required for TRF analysis, you will need to download the [[https://www.frontiersin.org/journals/human-neuroscience/articles/10.3389/fnhum.2016.00604/full|mTRF toolbox]]. First, visit the [[https://github.com/mickcrosse/mTRF-Toolbox.git|mTRF Toolbox GitHub]] page to download the latest version of the toolbox. Click the "Code" button and extract the downloaded zip file into a directory that MATLAB can access. Then, open MATLAB and add the toolbox to your MATLAB path using the addpath function. This ensures MATLAB recognizes the toolbox commands. Alternatively, you can install the mtrf manually from Brainstorm directly. For that, go to Plug-ins > Statistics > mtrf. Or, the plugin will install automatically once you call one of the processes for the first time. {{attachment:Screenshot 2024-07-12 at 2.26.33 PM.png|Screenshot 2024-07-12 at 2.26.33 PM.png|width="50%"}} |
Install '''mTRF-Toolbox''' as a [[https://neuroimage.usc.edu/brainstorm/Tutorials/Plugins|Brainstorm plugin]]. In the main Brainstorm window, go to the menu <<BR>> '''Plug-ins > Statistics > mtrf > Install'''. Or, the plugin will install automatically once you call the process for the first time. |
Line 23: | Line 19: |
Load your continuous EEG or MEG dataset into Brainstorm by going to File > Import data > Raw file, and navigate to the file you want to import. You will also need to have the corresponding continuous stimulus data on hand. This typically involves a file that contains stimulus presentation times and, if relevant, the types of stimuli presented, matched to the sampling rate and time stamps of the EEG/MEG recording. It is crucial that the stimulus information is completely and exactly aligned and synchronized to the neural recordings. This means that both the MEG/EEG matrix should be the same size as the stimulus matrix. Misalignments could lead to inaccurate TRF results. | Using the '''introduction dataset''', you will first need to import the entire recordings for whichever run you want to study into your database. e.g., '''Run01''' Right-click on the raw file, and then 'Import in database'.<<BR>> |
Line 25: | Line 21: |
The Introduction dataset does not contain continuous stimulus data. For that reason, it needs to be transformed to pseudo-continuous data in order to move forward with the TRF analysis. Find the appropriate files at [[https://github.com/anna-zai1/TRFdata.git|this]] link, and feel free to use them to follow this tutorial. | || {{attachment:bst_mtrf_prepare_a.gif}} || {{attachment:bst_mtrf_prepare_b.gif}} || |
Line 27: | Line 23: |
== Plotting the TRF == This first process can be used to plot the TRF for a specific channel, given by the user. Drag the EEG/MEG file in the command tab. Select the 'Run' button, then choose 'Plot Temporal Response Function (TRF)'. You will need to set several parameters for the TRF analysis. Specify the data file for the stimulus, indicate the EEG or MEG channels for response analysis, set the range of time lags to explore, and confirm the sampling rate to ensure temporal accuracy. || {{attachment:Screenshot 2024-07-12 at 3.10.18 PM.png|Screenshot 2024-07-12 at 3.10.18 PM.png}} || {{attachment:Screenshot 2024-07-12 at 3.10.39 PM.png|Screenshot 2024-07-12 at 3.10.39 PM.png}} || |
Once this is done, the recordings will have appeared in a new file '''Raw (0.00s,360.00s)'''. If the [[https://neuroimage.usc.edu/brainstorm/Tutorials/ArtifactsDetect|bad segments were already identified]] in the continuous recording, the new file will be labeled as '''bad''' (), before continuing we need to change its status to '''good'''. right-click on the file and select 'Accept Trial'. |
Line 31: | Line 25: |
{{attachment:bst_mtrf_acept.gif||width="30%"}} | |
Line 32: | Line 27: |
== TRF analysis == In order to start your TRF analysis, you will need to run the '''Temporal Response Function Analysis''' process. First, drag the imported file in the '''Process1''' box. Click '''Run''', then select '''Encoding' > Temporal Response Function Analysis'''. |
|
Line 33: | Line 30: |
{{attachment:bst_mtrf_pipeline.gif||width="60%"}} | |
Line 34: | Line 32: |
Run the TRF plotting script. Brainstorm computes the TRF and displays it, showing the estimated neural response function over your specified time lags for a chosen channel. | In this tutorial, we want to compute the TRF the MEG sensors, in a window from -100 to 200 ms after the two types of tones. To do so set the process options as follows: |
Line 36: | Line 34: |
{{attachment:Screenshot 2024-07-12 at 3.10.49 PM.png}} | {{attachment:bst_mtrf_process_gui.gif||width="60%"}} |
Line 38: | Line 36: |
== Saving the TRF weights == You may decide to save the computed TRF for future reference or further analysis. Navigate back to 'Process1', select 'Run', then choose 'Save Temporal Response Function weights'. Execute this process to save the TRF data into your Brainstorm database, as a matrix containing the weights between stimulus and response data. |
* '''Sensor types or names''' : Signals to be used in the TRF analysis. Set '''`MEG`''' * '''Event names''': Events that indicate the tones. Set '''`deviant,standard`''' * '''Minimum time lag''': Beginning of window of analysis wrt event. Use '''`-100 ms`''' * '''Maximum time lag''': End of window of analysis wrt event. Use '''`200 ms`''' Once your parameters are chosen, hit '''Run'''. Once the process finishes, there will be new two matrix files in your database, these contain the weights between neural and response data. || {{attachment:Screenshot 2024-07-18 at 2.14.13 PM.png|Screenshot 2024-07-18 at 2.14.13 PM.png}} || {{attachment:Screenshot 2024-07-18 at 2.18.42 PM.png|Screenshot 2024-07-18 at 2.18.42 PM.png}} || For visualization purposes, you can also double click the matrix files to open a new window with the TRF time series for all the sensors. == Investigating a specific channel == In order to extract the data for specific channels, you will need to run the process '''Extract Value''' on these output matrices. First, drag the chosen matrix into the '''Process1''' box. Select '''Run''' and then choose '''Extract > Extract Values'''. {{attachment:Screenshot 2024-07-18 at 2.21.38 PM.png|Screenshot 2024-07-18 at 2.21.38 PM.png|width="70%"}} Input your preferred analysis parameters including channel number and time window. For this tutorial, we will choose to analyze channel '''80''' (sensor '''MLP22'''). Set these parameters: {{attachment:Screenshot 2024-07-18 at 2.24.44 PM.png|Screenshot 2024-07-18 at 2.24.44 PM.png|width="60%"}} Click on '''Run'''. A new matrix file containing the weights for the specified channel will have been created. For visualization purposes, you can also double click the file which will open a new window with the TRF time series. {{attachment:Screenshot 2024-07-18 at 2.27.04 PM.png|Screenshot 2024-07-18 at 2.27.04 PM.png}} |
Multivariate Temporal Response Function
Authors: Anna Zaidi, Raymundo Cassani
This tutorial introduces the Temporal Response Function (TRF) analysis within the Brainstorm environment, employing the mTRF-Toolbox as plugin.
Contents
Introduction
Temporal Response Function (TRF) analysis is instrumental in delineating the dynamics of the brain's response to continuous stimuli, such as speech and music, providing insights into the underlying neural mechanisms. The present tutorial will show the TRF analysis functionality within the Brainstorm interface using the mTRF-Toolbox as plugin. For a detailed documentation, more examples and citation for the mTRF-Toolbox, please refer to the mTRF-Toolbox GitHub page.
This tutorial uses data from the introduction dataset, and can be followed by completing all steps of the Get Stared tutorials up to and including tutorial 10.
Install mTRF-Toolbox
Install mTRF-Toolbox as a Brainstorm plugin. In the main Brainstorm window, go to the menu
Plug-ins > Statistics > mtrf > Install. Or, the plugin will install automatically once you call the process for the first time.
Preparing the data
Using the introduction dataset, you will first need to import the entire recordings for whichever run you want to study into your database. e.g., Run01 Right-click on the raw file, and then 'Import in database'.
|
|
Once this is done, the recordings will have appeared in a new file Raw (0.00s,360.00s). If the bad segments were already identified in the continuous recording, the new file will be labeled as bad (), before continuing we need to change its status to good. right-click on the file and select 'Accept Trial'.
TRF analysis
In order to start your TRF analysis, you will need to run the Temporal Response Function Analysis process. First, drag the imported file in the Process1 box. Click Run, then select Encoding' > Temporal Response Function Analysis.
In this tutorial, we want to compute the TRF the MEG sensors, in a window from -100 to 200 ms after the two types of tones. To do so set the process options as follows:
Sensor types or names : Signals to be used in the TRF analysis. Set MEG
Event names: Events that indicate the tones. Set deviant,standard
Minimum time lag: Beginning of window of analysis wrt event. Use -100 ms
Maximum time lag: End of window of analysis wrt event. Use 200 ms
Once your parameters are chosen, hit Run. Once the process finishes, there will be new two matrix files in your database, these contain the weights between neural and response data.
For visualization purposes, you can also double click the matrix files to open a new window with the TRF time series for all the sensors.
Investigating a specific channel
In order to extract the data for specific channels, you will need to run the process Extract Value on these output matrices. First, drag the chosen matrix into the Process1 box. Select Run and then choose Extract > Extract Values.
Input your preferred analysis parameters including channel number and time window. For this tutorial, we will choose to analyze channel 80 (sensor MLP22). Set these parameters:
Click on Run. A new matrix file containing the weights for the specified channel will have been created. For visualization purposes, you can also double click the file which will open a new window with the TRF time series.