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.

Install SPM8

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

Fill up the registration form, download the file "spm8.zip" and unzip it.

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

Start Matlab, go to the SPM folder, add it to your path if it is not done already, and type "spm".

ExportSpm8 (last edited 2013-09-16 14:01:25 by agrippa)