Export source maps to SPM8

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 SPM8. It is based on the median nerve tutorial dataset that was used in the tutorials of the section ?Processing continuous recordings. If you have followed those tutorials, this dataset should be available in your database in the protocol TutorialRaw.

SPM8 has an important limitation with respect with SPM12: it cannot work on surfaces. We have to export all the sources to full volumes, which is highly inefficient. If you get the option, consider updating to SPM12.

Calculate unconstrained sources

In the previous tutorial, we have calculated sources constrained to the cortex surface. Because SPM8 works only with full volumes, we are going to estimate the sources in the full head volume, as detailed in the tutorial Volume source estimation.

Right-click on (common files) > Compute head model > MRI volume.

unconstrHeadmodel.gif

Right-click on the new head model > Compute sources > keep all the default options.

unconstrSources.gif

Pick any of the unconstrained source file and drop it in the Process1 box. Run the process "Standardize > Z-score (dynamic)". It creates a new shared source file, available for all the files of Subject01.

zscored.gif

Export source files

We want now to export the z-scored unconstrained sources to volume files in NIfTI1 format (readable by SPM). We are going to get rid of the time information, very difficult to handle with those full volumes in SPM, and keep only two averaged time windows per condition: a baseline [-20,-15]ms and an active state [33,38]ms. We are going to generate 2*101 left + 2*98 right .nii files.

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. To select only the unconstrained/z-scored files, you could simply use the checkbox "zscore", but we are going to illustrate a more generic solution: select the process "File > Select files with tag", illustrated in the tutorial Selecting files in the database. Configure it as following:

selectFiles.gif

Then in the same pipeline, select the process "File > Export to SPM".

exportLeftBaseline.gif

Configure the process:

Add another export process right 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".

exportLeftActive.gif

Click on Run and let it process for a while. It will generate 2*101=202 NIfTI files in the output folder.

Repeat the operation for the right condition: change only the file output names to "subject01_right_baseline" and "subject01_right_active".

exportRightActive.gif

Open you file explorer and check the .nii files that were created in the destination folder.

allNii.gif

You can try open some of those files with a NIfTI file viewer, just to make sure that what is saved is coherent. You can use for instance the free software Mricron to view the file subject01_right_active_02.nii. This a stimulation of the right median nerve, we can see clearly that the response is located in the central regions of the left hemisphere, which is what we expect.

mriCron.gif

Note that you can also you Brainstorm as a NIfTI viewer: go to the anatomy view of the protocol, right-click on Subject01 > Import MRI > Select a .nii file.

Start SPM

Installing SPM is easy: http://www.fil.ion.ucl.ac.uk/spm/software/spm8/

Start Matlab, go to the SPM folder, add it to your path if it is not done already, then type "spm". Select "fMRI" on the SPM startup screen, as we already have all our source volumes reconstructed. Selecting "M/EEG" would lead you to the pre-processing and forward/inverse modeling for the MEG or EEG recordings, which has already been done in Brainstorm.

spmStart1.gif

In the main SPM window, click on "Specify 2nd level".

spmStart2.gif

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:

spmSetupTwoSample.gif

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.

spmDesign.gif

In the SPM8 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.

spmRun.gif

When done click on Results in the SPM8 Menu window, select again the same SPM.mat file. A window pops up, you have to specify the contrast(s) of interest.

spmContrast1.gif

Click on "t-constrasts" and "Define new constrast...". Edit the options to define the t-test post-stim > pre-stim:

spmContrast2.gif

It updates the window "SPM contrast manage".

spmContrast3.gif

Click on "Done", then a list of parameters is asked in the "SPM8: Stats: Results" window.

spmContrast4.gif

Then the typical SPM8 glass brain shows up with a table with all significant voxels. Then in the "overlay" scroll down menu you have various options (sections, render, etc.). For example you can choose section and load your structural MRI or MNI brain (in SPM8 folder there is a folder with canonical) if your activity volumes are in MNI space (see example attached).

The example is based on the data you have sent me for the Florence workshop. I think it would be cool to have the feature to export the Brainstorm results into volumes and then be able to use SPM for the mass univariate statistical approach. You can model very complex stats designs like multiple regressions with holding one variable constant, etc. Or repeated measures ANOVAs with co-variates. etc.

ExportSpm8 (last edited 2013-09-16 15:34:13 by agrippa)