Full text
BRAINSTORM TRAINING Takfarinas Medani, Guiomar Niso Raymundo Cassani & Anne-Sophie Dubarry Takfarinas Medani, Research Scientist, Brain Imaging Group, University of Southern California, Los Angeles, USA ([email protected]) Guiomar Niso, Head of the Neuroimaging Group, Cajal Institute, CSIC, Madrid, Spain (guiomar[email protected]) 1
Dear Brainstorm participants, As the 3rd edition of the Practical MEEG event approaches, we would like to share some important information to help you prepare in advance. Preparation Before the Workshop: To ensure a smooth and productive experience, please complete the following tasks before your arrival: 1. Install MATLAB ● If needed, a free trial version of MATLAB is provided by the PracticalMEEG team for the Hands-On sessions. ● Please make sure it is fully installed and activated before the workshop. ● We recommend to add the “Signal Processing Toolbox” 2. Install Brainstorm software: ● Register on the Brainstorm website: Brainstorm Registration. ● Download and install the latest version by following the Brainstorm Installation Guide. ● Please ensure the software is fully installed and thoroughly tested. 2. Download the dataset: ● Please download the datasets in advance to avoid delays during the sessions: ○ Pruned version of the dataset (~1Go) <download from Zenodo> ○ Brainstorm processed data 16 participants (~20Go) <download from Brainstorm> 3. Prepare your laptop: ● Ensure both MATLAB and Brainstorm are installed and tested. ● Have the datasets ready for immediate use. ● Bring your own computer, charger, mouse, and electrical adaptor if needed. ● We also highly recommend bringing an external mouse for better usability. We kindly ask all participants to complete the installations and downloads before the event. If you encounter any issues, please post your questions here so the team can assist you. A detailed walkthrough will be posted here in the coming days. We look forward to seeing you soon and hope you enjoy an engaging and hands-on experience at Practical MEEG! Best, Takfarinas and Guiomar for the Brainstorm team =============================================== Updates to be posted on the forum: 📦 PracticalMEEG 2025 — Data Package Updates We have pruned and reorganized the data to include only the essential files required for the workshop. All necessary datasets are now provided in a smaller, ready-to-use folder that includes the Zenodo data and complementary materials. The following material folder contains: (size ~5Go) ● ds000117_pruned.zip — Pruned version of the original dataset, including T1 MRI and DWI data. ● femmat_tensors.mat — Realistic FEM head model with mesh and conductivity tensors (from DWI). ● PracticalMEEG_sub-01_3-runs.zip — Preprocessed data for subject sub-01 with 3 runs (sensor, forward, source, and TF data). ● PracticalMEEGGroup_pruned.zip — Group-level data from 16 subjects (6 runs each), containing intra-subject folders only; MEG source maps for Face–Scramble retained. ● Readme.txt — Overview and instructions for the PracticalMEEG 2025 workshop materials. 2
Introduction The aim of these hands-on sessions is to guide participants through a comprehensive MEG/EEG preprocessing and analysis pipeline using Brainstorm. The workflow will go from raw data preprocessing to source estimation, group-level statistics, and results visualization, following best practices for open and reproducible neuroimaging research. The workflow presented contributes to a community-wide initiative to document and harmonize MEG/EEG analysis pipelines, as featured in the Frontiers Research Topic “From Raw MEG/EEG to Publication: How to Perform MEG/EEG Group Analysis with Free Academic Software,” where the Brainstorm pipeline was featured in Tadel et al. (2019). The main goal is to introduce Brainstorm to new users. Some of the operations and the analysis presented here are not detailed. For in-depth explanations of the interface and theoretical foundations, please refer to the introduction tutorials. Dataset We will use the W&H dataset, which has been recently reformatted according to the Brain Imaging Data Structure (BIDS) standard. BIDS ensures consistent data organization and facilitates interoperability across neuroimaging analysis tools. The dataset comprises simultaneous MEG and EEG recordings from 16 participants performing a simple visual recognition task that involves the presentation of famous, unfamiliar, and scrambled faces. You can download the data here: [don't download all the data, please read all instructions first] ● Original raw data (~180Go) <Zenodo> or <OpenNeuro (ds000117)> ● Pruned version of the dataset (~1Go) <download from Zenodo (ds000117_pruned)> ● Brainstorm processed data for the 16 participants (~20Go) <download from Brainstorm> ● PracticalMEEG 2025: Data Package Final(~5Go) <PracticalMEEG2025_FinalMaterials.zip> References This dataset is made available under the Creative Commons Attribution 4.0 International Public License. Please cite the following reference if you use these data: ● Wakeman DG, Henson RN, A multi-subject, multi-modal human neuroimaging dataset, Scientific Data (2015). Please cite the following reference if you use the Brainstorm analysis pipeline: ● Tadel F, Bock E, Niso G, Mosher JC, Cousineau M, Pantazis D, Leahy RM, Baillet S, MEG/EEG Group Analysis With Brainstorm, Frontiers in Neuroscience (2019) ● Tadel F, Baillet S, Mosher JC, Pantazis D, Leahy RM, Brainstorm: A user-friendly application for MEG/EEG Analysis Comput Intell Neurosci (2011) Notes This dataset is formatted according to the BIDS-MEG specifications (Niso et al. 2018); therefore, we can import all relevant information (MRI, FreeSurfer segmentation, MEG+EEG recordings) in just one click, with the menu File > Load protocol > Import BIDS dataset. Please follow the online tutorial MEG resting state & OMEGA database. If your data does not follow the BIDS standard, this tutorial provides a step-by-step guide to the manual import process. We also include additional steps required due to data anonymization (defaced MRIs and missing acquisition dates). We will work on importing and processing the first run of subject #01. The same procedure applies to all other participants and runs. Brainstorm download and installation Brainstorm is available in both an open-source MATLAB application (MATLAB license required) and a standalone Java executable (free). Please follow the installation instructions for a complete installation and configuration: https://neuroimage.usc.edu/brainstorm/Installation. For the workshop, we will use the MATLAB version[check the post on the forum]. ⚠ Having any issues: ☞https://neuroimage.usc.edu/brainstorm/WorkshopGeneralInstall 3
Introduction to Brainstorm Interface CLOSE ALL YOUR APPLICATIONS, INCLUDING WEB BROWSERS 4
DAY1: Tuesday, Oct 28 – AM Session Get to know your data 10:10-10:35 Introduction to Brainstorm (lecture) 10:35-11:00 Review recording ● Create a new protocol. File > New protocol: “PracticalMEEG” No, use individual anatomy No, use one channel file per acquisition run (MEG/EEG) ● Introduction to database explorer (list of protocols, exploration modes…) ● Right-click on protocol top node > New subject >sub-01 Leave the default options you defined for the protocol. 📜 You can find more details here: https://neuroimage.usc.edu/brainstorm/Tutorials/CreateProtocol ● Switch to functional view (2nd button above the database explorer) ● Create a link to the continuous file: Right-click on sub-01 > Review raw file File format: MEG/EEG: Elekta-Neuromag (*.fif) Select folder: ds000117_pruned/derivatives/meg_derivatives/sub-01/ses-meg/meg/ File: sub-01_ses-meg_task-facerecognition_run-01_proc-sss_meg.fif Select option: Event channel > STI101 ● Edit the channel types: Right-click on the Neuromag channel file > Edit channel file Change the types: EEG061>Misc, EEG062>EOG, EEG063>ECG, EEG064>Misc. Close and save ● Review MEG: Right-click on “Link to raw file” > MEG (all) > Display time series Display in columns + channel selection (click or montage) => Left Temporal Time: Display windows of 5s Amplitude: Buttons and shortcuts Scroll to detect the beginning of the continuous head localization (248s), Online filters Events: List, figure, time bar, display modes (dots or lines) ● Edit/combine events Select 5+6+7: Events > Merge groups > Famous Select 13+14+15: Events > Merge groups > Unfamiliar Select 17+18+19: Events > Merge groups > Scrambled Delete all the other categories of events Events > Add time offset: Famous, Unfamiliar, Scrambled 34.5ms (delay) ● Add other views EEG: Right-click on “Link to raw file” > EEG > Display time series ECG: Right-click on “Link to raw file” > ECG > Display time series EOG: Right-click on “Link to raw file” > EOG> Display time series Topography: Right-click on “Link to raw file” > EEG > 2D Sensor Cap (or CTRL+T) Layout menu: Alternate between Tiled and Weighted (keep Weighted) ● Close all + Save modification 11:00-11:15 Spectral inspection and filtering ● Drag and drop the “Link to raw file” in Process1 Explain the Process1 tab + Filter box ● Run process: “Frequency > Power spectrum density (Welch)”: Time window: [250, 300]s, Window length: 4s, Sensor type: MEG, EEG, PSD options: Edit… > OK. Click Run. Open the PSD file (double-click) 5
Open topography: EEG > 2D Sensor cap Open topography: MEG (mag) > 2D Sensor cap Open topography: MEG (grad norm) > 2D Sensor cap Explain the noise sources / identify possible bad channels: (~10Hz:alpha, 50Hz: power, ~300Hz: HPC(248s), EEG016 bad) ● Optional: remove line noise (later low-pass filter at 40 will be applied) Keep the "Link to raw file" in Process1. Select process Pre-process > Notch filter (50, 100, 150, 200). Add the process Frequency > Power spectrum density (Welch) Double-click on the PSD for the new continuous file to evaluate the quality of the correction. ● Run process: “Pre-process > Band-pass filter”: MEG, EEG Lower cutoff: 0 Hz (No high-pass filter) Upper cutoff: 40 Hz (Low-pass filter) 📜 Most filters cause edge effects, i.e. unreliable segments of data at the beginning and the end of the signal. When applied to short epochs, they might contaminate all the data of interest. Learn more about filters here: Epoch_length: https://neuroimage.usc.edu/brainstorm/Tutorials/Epoching#Epoch_length What filters to apply: https://neuroimage.usc.edu/brainstorm/Tutorials/ArtifactsFilter#What_filters_to_apply.3F 11:15-11:45 Artifacts detection and cleaning ● Bad channels & Re-reference the EEG recordings Right click on “Raw | low” > EEG > Display time series Mark EEG016 as bad Record tab: Artifacts > Re-reference EEG: AVERAGE ● Detect eye-movement events Open the time series for MEG and EOG In the Record tab, select Artifacts > Detect eye blinks: Channel name = EEG062, Time window = All file, Event name = blink Display MEG signals (along EOG) and see some blink occurrences Merge all the bink event groups in a blinks group ● Detect heartbeat events Open the time series for MEG and ECG (set Duration to 1 s) In the Record tab, select Artifacts > Detect heartbeats, and use the parameters: Channel name = EEG063, Time window = All file, Event name = cardiac ● Handle simultaneous events In the Record tab, select Artifacts > Remove simultaneous: Remove events named: cardiac When too close to events: blinks Minimum delay between events: 250 ms ● Remove heartbeat artifacts from MEG with SSP Open the time series for MEG In the Record tab, select Artifacts > SSP: Heartbeats, and use the parameters: Event name = cardiac, Sensors = MEG Compute using existing = Check In the Select active projectors window, uncheck all components Highlight the first two and plot them ( ) Open MEG (all) and ECG time series, and disable auto scaling in the 3 plots Check Component #1 to verify the impact of removing it from the MEG signal Click on Save, and close all figures ● Optional: Remove blink artifacts from the EEG with ICA Open the time series for EEG In the Record tab, select Artifacts > ICA components, and use the parameters: Time window = [226400], Sensor type: EEG, Band-pass filter = [0, 0], Resample = 0 6
ICA algorithm = Picard, Number of ICA components = 0 Sort components based on correlation with = EOG, ECG In the Select active projectors window, uncheck all ICA components. Highlight a few and plot them. Open EEG and EOG time series and disable auto scaling in the 3 plots (check the shape) Check Component #1 to verify the impact of removing it from the EEG signal Click on Save, and close all figures 11:45-12:00 Epoching and single trials reviewing ● Right-click on the pre-processed file (Raw | low) > Import into database Time window = 226.0 - 716.99 s (this is set automatically) Uncheck Split Check Use events and select Famous, Unfamiliar, and Scrambled Epoch time = from -500 ms to 1200 ms Check Apply SSP/ICA projectors Check Remove DC offset, select Time range [-500, 0] Uncheck Create a separate folder for each type Click on Import A new folder without the 'raw' indication is created DAY1: Tuesday, Oct 28 – PM Session Sensor-level Analysis & frequency space analysis 15:15-15:45 Sensor level averages (ERP/ERF) ● Review trials: Open the first trial MEG+EEG: Switch back to butterfly view, ALL sensors. Open a 2D topography (CTRL+T) Enable auto-scale (button [AS]). Navigate between trials with F3 / Shift+F3 (Fn + F3 on Mac) Trials or channels can be marked as bad independently 📜 Read more about the keyboard shortcuts: https://neuroimage.usc.edu/brainstorm/Tutorials/ExploreRecordings#Keyboard_shortcuts ● Raster plots: Right-click on trials > Display as image > EEG (EEG065) You can change the selected sensor with the drop-down menu in the Display tab, or use the up/down arrows on your keyboard The bad trials are already marked, but if they were not, this view could help you identify them easily. ● Average trials Drag and drop all the trial groups in Process1 Run process “Average > Average files”: By trial group (folder average) ● Review average Open Famous average: MEG + 2D topography view + EEG Review movie of the activity (hold right/left keys/ filter tab) Display with a low-pass filter at 32Hz ● Channel Cluster/Single channel Close all and open EEG: Signals + all topography modes. Open the Cluster tab and create a cluster with the channel EEG065 (button [NEW IND]). Overlay EEG065 for 3 averages with Cluster tab (NEW IND). Overlay averages with 2DLayout Display Mean + Std : “Edit > Set Cluster function > Mean” 📝 Plot the trial average time series for electrode EEG056 7
📜 Read more here about Clusters: https://neuroimage.usc.edu/brainstorm/Tutorials/ChannelClusters Snapshot > Time contact sheet topography with 2D Disc: 0ms, 500ms, 16 images Movies… ● Basic observations for ERP EEG065 (right parieto-occipital electrode): Around 170ms (N170): greater negative deflection for Famous than Scrambled faces. After 250ms: difference between Famous and Unfamiliar faces. 15:45-16:45 TF Wavelets Analysis ● Wavelets Drag-drop all the Famous trials in Process1 Add process: Frequency > Time-frequency (Morlet wavelets) Click on Edit… Time definition = Same as input files, Frequency definition = Linear: 5 : 2 : 60 Central freq = 1 Hz, Time resolution 3 s Measure = Power, Select Save individual Add process: File > Add tag Tag to add = Famous, Select Add to file name Display time-frequency average: Smooth display and hide edge effects for channel EEG056 ● Explore time-frequency results Display 2D Layout (maps): Select a few sensors Change colormap: Maximum -10/+10, colormap type Add views: time series + power spectrum + all the other options ● Processing the time-frequency results Run process: Standardize > Baseline normalization > Z-score: [-200, 0]ms Add process: Extract > Extract time: [-200, 900]ms, Overwrite. [To remove the section of the data with edge effects] 📜 Check this link for more information: https://neuroimage.usc.edu/brainstorm/Tutorials/VisualSingle#Time-frequency_analysis https://neuroimage.usc.edu/brainstorm/Tutorials/TimeFrequency ● Optional: Hilbert transform and Multitaper Select all the Famous trials in Process1 ○ Add process Frequency > Hilbert transform: Sensor type = MEG only Morlet wavelet options: Time definition = Same as input files, Frequency definition = Group [Reset] Measure = Power, Select Save average ○ Add the process: File > Add tag Tag to add = Famous, Select Add to file name Display both time-frequency representations (from wavelets and Hilbert transform): Smooth display and hide edge effects 📜 Read more here Multitaper (through Fieldtrip): https://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Time-frequency_analysis_.28pre-onset_ baseline.29 Optional: Connectivity sensor level [not described in the original data/paper] Select all the Famous Average trials in Process1 Run process: Connectivity> Correlation NxN > 100-500ms, EEG, Right-click on the connectivity node, Display as Graph or as Image 8
Check more options for the graph here: https://neuroimage.usc.edu/brainstorm/Tutorials/ConnectivityGraph 📜 Read more about connectivity in Brainstorm here: https://neuroimage.usc.edu/brainstorm/Tutorials/Connectivity PAC/source level here: https://neuroimage.usc.edu/brainstorm/Tutorials/Resting Discussions: Brainstorm beyond the GUI ● Interaction with other toolboxes: FieldTrip, MNE-Python, EEGLAB, SPM ● Plugins: available plugins ● GitHub: repo and collaboration DAY2: Wednesday, Oct 29 – AM Session Source level estimation I: Getting to source level maps 10:10-10:45 Import anatomy ● Switch to anatomy view (1st button above the database explorer) ● Right-click on sub-01 > Import anatomy folder File format: FreeSurfer Select folder: derivatives/freesurfer/sub-01/ses-mri/anat Number of vertices: 10000 (lower value to make it faster). ● Introduction to the MRI viewer: Exploring the volume (click, mouse wheel, sliders), Colormaps, colorbar, figure popup menu ● Compute MNI transformation, maff8 (sets all the fiducials automatically) ● Check the positions of NAS / LPA / RPA Explain the coordinates (MRI, SCS, MNI) Click save, this will create the “cortex” file 📜 The MNI transformation automatically sets default NAS/LPA/RPA fiducials based on MNI coordinates. Since MEG-MRI coregistration will use digitized head points, precise fiducial placement isn’t critical, unless there’s no good head shape or the coregistration looks poor, in which case the fiducials should be manually marked following the MRI acquisition convention. Head Model Generation 📜 The forward models depend on the subject's anatomy, including head size and geometry, tissue conductivity, the computational method, and sensor characteristics. In the following sections, we will present the two approaches available in Brainstorm for constructing the head model for EEG: the Boundary Element Method (BEM) and the Finite Element Method (FEM). However, only the BEM method is used in the subsequent sections. For the MEG, we will use the overlapping spheres. For more detailed documentation, please refer to: https://neuroimage.usc.edu/brainstorm/Tutorials/HeadModel Generate BEM head surfaces from the MRI: ● Switch to anatomy view: (1st button, on top of the database explorer) Optional: Right-click on sub-01 > MRI segmentation > Generate head surface > OK This will generate a surface file named “head mask” estimated from the T1 MRI. ● Right-click on sub-01 > MRI segmentation > Generate BEM surfaces Select Brainstorm Number of vertices: Scalp = 642, Outer skull = 642, and Inner skull = 642 Thickness of layers, Skull (mm)= 4 Click OK [This process will take ~2min] This will generate three surfaces (head, outer skull, and inner skull) Demo: Generate FEM from BEM surfaces (simplified model): ○ Press and hold “Ctrl”, then select with the mouse the BEM surfaces 9
● EEGLAB: Functions embedded in the Brainstorm distribution (runica.m) ● SPM: Export to .nii or .gii files (online tutorial) 📜 Read more here: Export to SPM: An alternative to running the statistical tests in Brainstorm is to export all the data and compute the tests using an external program (such as R, MATLAB, or SPM). Multiple menus exist to export files to external file formats (right-click on a file > File > Export to file). Two tutorials explain how to export data specifically to SPM: ● Export source maps to SPM8 (volume) ● Export source maps to SPM12 (surface) 📜 Read more about statistics in Brainstorm: https://neuroimage.usc.edu/brainstorm/Tutorials/Statistics If time allows, explain how to generate the scripts and download the data for the next session. How to write your own process: https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess Scripting: https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Loop_over_subjects DAY4: Friday, Oct 31 AM Session: Get and report results with confidence II – Multivariate approach 10:15-12:00 Group level analysis Subject Grand averages: In this session, we will use a precomputed Brainstorm protocol for 16 subjects with 6 sessions. We will conduct group-level analysis across the different conditions. In the Brainstorm window, click on File > Load protocol > Load from zip file and select the precomputed protocol <PracticalMEEGGroup_pruned.zip> from the provided material folder. Once completed, you should see the 16 subjects listed in the Anatomy and Functional tabs. Summary of the analysis: ● Subject and grand averages for each condition (Famous, Unfamiliar, Scrambled). ● Normalization of these averages (Z-score for the sources, or ERS/D for the time-frequency maps). ● Projection of the sources results on a template and spatial smoothing of the source maps. ● Contrast between faces (famous+unfamiliar) and non-faces (scrambled): difference of averages and significance test. ● Contrast between famous faces and unfamiliar faces: differences in averages and significance tests. ● Sensors of interest: EEG070 (or EEG060 or EEG065 if EEG070 is marked as bad) The methodology we will follow for computing averages and other statistics is described in the tutorial "Workflows". Note: This session demonstrates how to run the analysis using the interface (Brainstorm GUI), but for large datasets, manual processing is inefficient and error-prone. Users are encouraged to script group analyses instead, first prototyping the analysis pipeline for a few subjects using the interactive interface, then generating the corresponding MATLAB script, and finally running it on all subjects for reproducibility. Script creation is detailed in the online Scripting tutorial. Subject averages: Filter and normalize Before comparing the averages across subjects, we will low-pass filter the signals below 32Hz (to smooth possible latency differences between subjects) and normalize the source & TF values with respect to a baseline. ● EEG/MEG Sensor In Process 1, select all the Intra-subject folders from all subjects, and then select [Process recordings]. 16
For a faster selection, you can use the "Functional data (sorted by conditions)" view. [64 files] Select process Pre-process > Band-pass filter: 0Hz-32Hz, MEG, EEG, 60dB, 2019, Overwrite. Add process Extract > Extract time: Time window=[-200,900]ms, overwrite Selecting a smaller time window eliminates most of the possible edge effects caused by the filter. Add process Average > Average files: By trial group (grand average) Arithmetic average, not weighted. Click Run. A new item labeled “Group Analysis” will appear in the database explorer that has the same structure as a subject. It contains the average of the 16 files from all 16 subjects for each condition. - For the "Group analysis/Inter-subject" folder: the variable refers to the subjects (average of 16files or subjects) - For the "sub-XX/intra-subject" folder: the variable refers to the runs [sessions] (average of 6 files or sessions) 📝 It is ok to compare EEG sensor subject averages, but it is not the case for MEG sensor subject averages. Why? Note that averaging MEG recordings across subjects is not accurate; however, it can be used to obtain a general idea of the group effects (for more information). ● MEG Sources In Process 1, select all the Intra-subject folders from all subjects, and then select [Process sources] 16 files available, the provided data contains only the MEG [face-scramble] Select process Pre-process > Band-pass filter: 0Hz-32Hz, 60dB, MEG, Overwrite Add process Extract > Extract time: Time window=[-200,900]ms Add process Standardize > Baseline normalization: Baseline=[-200,-5]ms, Z-score, Overwrite. Click Run. Three tags are added to the files: “ low(32Hz) | time (-202ms,900ms) | zscore” ● Optional: Time frequency ○ In Process 1, select all the Intra-subject folders from all subjects, and then select [Process time-freq]. ○ Run process Standardize > Baseline normalization: Baseline=[-200,-5]ms, ERS/ERD, Overwrite One tag is added at the end of the comments of the averaged time-frequency maps. Sensor Difference: Faces - Scrambled: ● Differences of averages We could compute the contrasts directly from the grand averages, but we will do it from the subject averages because the same file selection will be used for the statistics (next step). In Process2: FilesA = all the Faces subject averages (from the Intra-subject folders). In Process2: FilesB = all the Scrambled subject averages (from the Intra-subject folders). Run process: Test > Difference of means: Arithmetic average, Not weighted. Click Run. ● Significance testing In Process2: Keep the same file selection. Run process: Test > Parametric test: Paired: All file, All sensors, No average, two-tailed. Rename the file: Faces - Scrambled: Parametric t-test. Display with α=0.05, FDR-corrected. We can run other tests in a similar way, with almost identical results. Process: Test > Permutation test: Paired: All file, All sensors, Paired t-test, 1000 randomizations. Display with α=0.05, FDR-corrected. Process: Test > FieldTrip: ft_timelockstatistics: All file, EEG, Paired t-test, 1000 randomizations, correction=cluster, cluster alpha=0.05. Note: The cluster-based statistics must be executed on one type of sensor at a time (EEG, MEG, MAG, or MEG GRAD), because it tries to identify spatio-temporal clusters that group adjacent sensors. 17
Bonus: Histograms checking the distribution of the data: In Process1: all the Faces subject averages (from the Intra-subject folders). Run process Extract > Extract values: Options: Time=[160,160]ms, Sensor="MEG2321", Concatenate time (dimension 2) Do the same for the Scrambled To display the distribution of the values in these two files: select them simultaneously, right-click > File > View histograms. Exercice: Famous - Unfamiliar ● Differences of averages In Process2: FilesA = all the Famous subject averages (from the Intra-subject folders). In Process2: FilesB = all the Unfamiliar subject averages (from the Intra-subject folders). Run process: Test > Difference of means: Arithmetic average, Not weighted. Rename the file: Famous - Unfamiliar. ● Significance testing In Process2: Keep the same file selection. Run process: Test > Parametric test: Paired: All file, All sensors, No average, two-tailed. Rename the file: Faces - Scrambled: Parametric t-test. Display with α=0.05, FDR-corrected. In Process2: Keep the same file selection. Run process: Test > Parametric test: Paired: All file, All sensors, No average, two-tailed. Rename the file: Faces - Scrambled: Parametric t-test. Display with α=0.05, FDR-corrected. Group analysis: Sources (only MEG: Faces-Scrambled; online tutorial includes all data) Project sources on template The sources were estimated on the individual anatomy of each subject; the resulting cortical source maps cannot be averaged directly. We first need to re-interpolate all the individual results on a common template (the ICBM152 brain, available in the "default anatomy" folder of the protocol). We also need to extract the absolute values for these source maps: the sign of the minimum norm maps are relative to the orientation of the current with respect to the surface normal, which can vary between subjects. ● In Process1, select all the Intra-subject folders from all the subjects, select [Process sources]. For a faster selection, you can use the view "Functional data (sorted by conditions)". ● Select process Pre-process > Absolute values, Overwrite. ● Add process Sources > Project on default anatomy, select Cortex surface. Click Run. Check the coregistration process ● In subject sub-01 folder Intra-subject sources) 18
Right-click on it > Cortical activations > Display on cortex Right-click on it > Cortical activations > Display on spheres ● In subject Group analysis folder Intra-subject sources Right-click on it > Cortical activations > Display on cortex Right-click on it > Cortical activations > Display on spheres ● Set the back view, tilted towards the front, and use the same view for all plots Reduce the surface smoothness in both cortices to appreciate that they are different Spatial smoothing The source maps estimated with constrained orientations can show very focal activity: two adjacent vertices may have very different normals, and therefore very different current values. When averaging multiple subjects, the peaks of activity may not align very well across subjects. Smoothing spatially the source maps may help obtain better group results. ● In Process 1, select all the source maps in Group Analysis. ● Run process Sources > Spatial smoothing: use absolute, FWHM 3mm, fixed FWHM, overwrite MEG: mean (|Faces-Scrambled|) ● In Process1, select all the source files in Group_analysis/Faces-Scrambled|MEG ● Run process Average > Average files: By folder (grand average), Arithmetic Average, Not weighted ● Click Run Regions of interest: OFA (Occipital Face Area), FFA (Fusiform Face Area), V1 MEG: Chi2-test |Faces-Scrambled|=0 ● In Process1, select all the source files in Group_analysis/Faces-Scrambled|MEG ● Run process Test > Parametric test against zero: All file, One-sample Chi2-test two-tailed ● Screen capture: α=0.05 FDR-corrected 📝 What is the area where the Faces shows a higher activation than Scrambled? Read more: MEG visual tutorial: Group analysis Bonus: Decoding with cross-validation In this session, we will demonstrate how to perform MEG/EEG decoding within Brainstorm, a type of multivariate pattern analysis (MVPA), using support vector machines (SVMs). SVM decoding requires the LibSVM library (website). Brainstorm will install it automatically as a plugin when needed. On Linux and MacOS, you may have to explicitly recompile the library: ● In the MATLAB command window, execute "which svmtrain". If it returns an error message ('svmtrain' not found), you need to compile the library manually. ● Locate the MATLAB sub-folder in the libsvm installation folder: $HOME/.brainstorm/plugins/libsvm/libsvm-master/matlab ● In MATLAB, navigate to this folder and execute the "make.m" function. ● If it doesn't work, please refer to the instructions in the README file located in the same folder. ● You need a C compiler to be available on your computer. Mac users can use XCode. Cross-validation is a model validation technique used to assess how the results of our decoding analysis generalize to an independent dataset. Here we will use the trials from the sub-01; please switch to your previous protocol with one subject. We require individual trials to perform this analysis. Switch to any protocol where you have the individual trials. For example, the “PracticalMEEG” protocol ● Scrambled and Famous trials to the Process1 tab ● Select process "Decoding > SVM decoding" Sensor EEG, Low pass 32Hz, N permutations 50, N folds 5, Decoding pairwise, Run ● Repeat the same steps for MEG Intuitively, you might have expected to use the Process2 tab to decode famous vs. scrambled. However, the decoding process is also designed to handle pairwise decoding of multiple classes (not just two classes) for computational efficiency, allowing more than two 19
categories to be entered in the Process1 tab. The process will take some time. The results are then saved in a file within the decoding folder. The resulting matrix represents the decoding accuracy over time. The left plot shows EEG decoding accuracy, and the right plot shows MEG results for distinguishing between scrambled and famous faces. Both curves illustrate how effectively the classifier distinguishes between the two conditions over time. MEG generally shows a sharper and higher decoding peak than EEG, which is more affected by volume conduction and artifacts. Decoding accuracy increases around 150–250 ms, suggesting that the neural representations of faces and scrambled images differ most during this time window. To explore this further, one could focus the analysis on this specific period. Temporal generalization: Repeat the above process, but select 'Temporal Generalization'. The process will take more time (~10 minutes per modality). The results are then saved in a file in the 'decoding' folder. Both EEG and MEG decoding revealed discrimination between famous and scrambled faces starting around 150 ms. MEG showed stronger and more sustained accuracy (150–600 ms), indicating a stable neural representation of face category information. EEG decoding was weaker and more transient (180–300 ms), reflecting rapid changes in scalp patterns and lower spatial specificity due to volume conduction. Read more here: https://neuroimage.usc.edu/brainstorm/Tutorials/Decoding ======================================================================================== 💬 We’d love to hear your feedback Scan the QR code to help us make Brainstorm even better. 20