= 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 [[Tutorials/TutRawViewer|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 updateing 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 [[Tutorials/TutVolSource|Volume source estimation]]. Right-click on (common files) > Compute head model > MRI volume. {{attachment:unconstrHeadmodel.gif}} Right-click on the new head model > Compute sources > keep all the default options. {{attachment: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. {{attachment: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 [[SelectFiles|Selecting files in the database]]. Configure it as following: {{attachment:selectFiles.gif}} Then in the same pipeline, select the process "File > Export to SPM". Configure the process: * Output folder: Select the folder where you want all the .nii files to be saved * {{attachment:exportLeftBaseline.gif}}