Export surface source maps to SPM12
Authors: Francois Tadel
The statistical analysis is still limited in Brainstorm, but you can easily export your source maps and run your tests with an external application. This tutorial explains how to export source maps to SPM12. It is based on the older introduction tutorials (CTF median nerve stimulation, protocol TutorialRaw), but it is easy to translate it to the new tutorials (auditory oddball).
SPM12 can work with source activations represented either as volumes, as illustrated in the tutorial Export to SPM8, or as surfaces, as presented in this tutorial.
Export source files
We want to export the sources estimated for all the trials for the left condition to surface files in GIfTI format (readable by SPM). We are going to get rid of the time information because it cannot be represented in SPM, and keep only two averaged time windows per condition: a baseline [-20,-15]ms and an active state [33,38]ms.
Clear the Process1 box and drop all the trials for condition Left in it. Select the button "Process sources" on the left of the Process1 tab.
Select the process "File > Export to SPM12 (surface)".
Configure the process:
Output folder: Select the file format of the output files (choose "GIfTI-1 (*.gii)"), the select the folder where you want all the .gii files to be saved.
Output file tag: Set the file name of the exported .gii files. If you leave this option empty, the default file names are "SubectName_Condition_*.gii", which in this case would be "Subject01_Left_*.gii". This is not informative enough, given that we want to export two states for the same condition: baseline vs. active. Set this option it manually to "subject01_left_baseline".
Average time window: Segment of the file that we want to export and average in time. We start with the baseline: -20ms to -15ms
Use absolute values of the sources: If this option is selected, the source amplitudes will be all positive instead of positive and negative. This is usually a better way to represent the activation of a brain area, and better adapted for statistical analysis in SPM.
Add another export process after this one, to export the "active" state. Set the time window to [33,38]ms, to capture the peak of the response in the primary somatosensory cortex, and the file name to "subject01_left_active".
Click on Run and let it process for a while. It will generate the following files (total of 12 Mb):
- Subject01_cortex.gii: Contains the definition of the cortex surface (faces and vertices)
- subject01_left_active_*.gii: 101 files, definition of the trials for the active condition
- subject01_left_active_*.dat: 101 files, actual source maps for the active condition
- subject01_left_baseline_*.gii: 101 files, same for the baseline condition
- subject01_left_baseline_*.dat: 101 files, same for the baseline condition
This representation is quite heavy (405 files) for so little information. Hopefully this will get improved in a future release of SPM12.
Installing SPM is easy: http://www.fil.ion.ucl.ac.uk/spm/software/spm12/
Start Matlab, go to the SPM folder, add it to your path if it is not done already, then type "spm". Select "M/EEG" on the SPM startup screen.
Import note: Do not run Brainstorm and SPM at the same time, always close Brainstorm before starting SPM (but you don't need to close Matlab).
In the main SPM window, click on "Specify 2nd level".
Now you can specify your stats design in the Batch Editor window. We are going to start with a simple t-test for the left condition: active state versus baseline. Select the following options:
Directory: Select the folder in which the results to be saved, for instance create a sub-folder "spm" in the folder in which you have saved all the GIfTI files
Design: Two sample t-test
Group 1 scans: Select the 101 post-stim files subject01_left_active_*.gii
Group 2 scans: Select the 101 pre-stim files subject01_left_baseline_*.gii
Grand mean scaling: No
Once you have defined all the options, click on the Run button (the green button in the toolbar on top of the Batch Editor window).
The design matrix window is displayed in the Graphics window, and a file SPM.mat is saved in the output directory you defined in the options.
In the SPM12 Menu window, click on the Estimate button. Select the SPM.mat file that was just created. SPM estimates the parameters, it may take a while.
When done click on Results in the SPM12 Menu window, select again the same SPM.mat file. A window pops up, you have to specify the contrast(s) of interest.
Click on "Define new contrast...". Edit the options to define the t-test post-stim > pre-stim:
Name: Give a name to the contrast, for display. Enter for instance "Active>Baseline".
Contrast: Enter "1 -1" to test for "Group1 (active files) > Group2 (baseline files)"
- Click on "...submit" to update the figure, then "Ok" to add the new contrast.
It updates the window "SPM contrast manager".
Click on "Done", then a list of parameters is asked in the "SPM12: Stats: Results" window.
Apply masking: None
Title for comparison: "Active>Baseline" for instance
p-value adjustment to control: FWE (=Family-Wise Error, to correct for multiple comparisons)
p-value (FWE): 0.01
& extent threshold (voxels): 0
Data type: Volumetric (2D/3D)
You get the final results in the Graphics window. You can click on the cortex surface to rotate.
You can repeat the same operations with the right condition.
The results you get here are very basic, but the logic of exporting source results from Brainstorm to SPM can be extended to any type of analysis.