Skip to content

Coregistration: Template Brain

Christian Brodbeck edited this page Jul 2, 2024 · 3 revisions

The coregistration utility

Initial experiment setup

When creating a new experiment, the template brain has to be added to the experiment’s files. This needs to be done manually, before staring the coregistration utility.

First create an MRI-directory in the experiment’s root directory. Assuming the experiment’s folder is ~/Data/Experiment:

$ cd ~/Data/Experiment
$ mkdir mri

Next, create the template brain in the new MRI-directory. In Python:

>>> import mne
# First argument: path to your FreeSurfer installation
# subjects_dir: path to your experiment's MRI-directory
>>> mne.create_default_subject('/Applications/freesurfer/7.4.1', subjects_dir='~/Data/Experiment/mri')

Starting the coregistration utility

The coregistration utility is part of MNE-Python. It can be started from a bash terminal (Linux) with:

$ mne coreg -d ~/Data/Experiment/mri

Or from a Python session (Windows and Linux):

>>> import mne
>>> mne.gui.coregistration(subjects_dir='~/Data/Experiment/mri')
Coregistration GUI Overview
Figure 1. The coregistration GUI on macOS. Sections below refer to panel numbers.

1. MRI source

In the top field, specify the directory that contains the brain models. This is probably your_experiment/mri. After that, the existing brain models should appear in the dropdown menu below. If the fsaverage brain does not exist yet, create it with the corresponding button below the menu. After selecting fsaverage in the drop-down menu, the fsaverage head should appear in the GUI as below. If it does not appear, you might need to restart the GUI, and possibly specify the subjects-directory as command-line argument ($ mne coreg -d experiment_root/mri).

Coregistration GUI with fsaverage
Important
If the head shape does not appear in the GUI upon selecting an MRI, try restarting the GUI while specifying the subjects-directory: $ mne coreg -d ~/Data/Experiment/mri

2. Digitization source

This panel is for selecting the head shape associated with the MEG recording. Click the folder icon and find a -raw.fif file for the subject for which you want to generate a brain. If several -raw.fif files were acquired in a single visit, they can be treated interchangeably, as long as the same head shape is embedded in them.

3. Scaling

In the drop-down menu, select how to scale the brain (Uniform: scale the MRI uniformly along all axes; 3-axis: estimate a separate scaling parameter for each axis). Open the fitting options (number 5) to adjust the settings (e.g. like below). These options will stay as long as the GUI is open, but they will reset once you close and re-open the GUI.

Coregistration fitting options

Click Fit Fid. to compute an approximate fit using the fiducial points (the colorful balls). Then, click Fit (ICP) to fin-tune the fit. If necessary you can do manual adjustment using the fields in panels 3 and 4. The Fit buttons in panel 4 will estimate rotation and translation without changing the scaling factor.

6. Save

You might have to scroll down to see the whole panel. Among the three check-boxes, none should be checked. Click Save…​ to save the brain model and *-trans.fif file with the default names. You can then use the bottom right ↩️ button to reset the GUI and start with the next subject.