[WARNING: This page is part of the old tutorials, please refer to the new documentation]

Tutorial 3: Importing individual anatomy

Authors: Francois Tadel, Sylvain Baillet

Dataset description

The dataset that will be used for all the introduction tutorials is a somatotopy experiment recorded with a CTF MEG system (151 axial gradiometers, La Salpetriere Hospital, Paris): shuffled electrical stimulations of the thumb fingers from both hands. Data files contain averages of 400 trials for each side. The idea is to get a map of the primary sensory response on the cortex. Data provided courtesy of Sabine Meunier.

Please download sample_ctf.zip from the Download section. Unzip it in a folder you will dedicate to original data. It can be anywhere but not in the Brainstorm database or program folder. Example:

Create protocol

  1. Create a new protocol called TutorialCTF with the following options:

    • "No, use individual anatomy", because the individual subject anatomy is available
    • "No, use one channel file per condition (MEG)", because we have different runs with different head positions to import for the same subject
  2. Create a new subject (let's keep the default name: Subject01)

Import MRI

  1. Go to the Anatomy view of the protocol files (very first button in Brainstorm window toolbar).

  2. Right click on subject node, and select menu "Import MRI"


  3. Select file "sample_ctf/Anatomy/01.nii"
    Make sure to select one of the correct file format: either "All MRI files" or "MRI: NIfTI-1 (*.nii)"

  4. The MRI viewer is displayed, together with a message box that tells you what to do. Follow the instructions. The MRI is already well oriented so you can directly process with the fiducials selection: Nasion, left ear, right ear, anterior commissure, posterior commissure, and inter-hemispheric point.
    • For instructions to find these points, read the following page: CoordinateSystems.

    • Warning: This acquisition was done a long time ago, and the person who digitized the position of the nasion and ears before the MEG acquisition did not follow the indications from the previous page. The person pointed at the three markers that we can easily see on the MRI, that appear next to the real anatomical points as little white dots. In this case, you have to mark the points on the MRI slices in the same way that it was done at the MEG acquisition.

    • The coordinates of the markers should be around the following coordinates (MRI, in mm)
      • NAS = [115.3 207.2 138.8]
      • LPA = [ 45.9 128.4 71.3]
      • RPA = [186.6 123.8 83.4]
      • AC = [115.3 130.3 132.2]
      • PC = [115.3 102.2 133.1]
      • IH = [113.4 109.7 184.7]
    • You can enter directly type the position of the fiducials with the following popup menu:
      right-click anywhere in the MRI Viewer figure > Edit fiducials positions...

    • Click on Save when you're done selecting the fiducials.

    • To check were the fiducials are or change their position later:
      right-click on the MRI file > Edit MRI...

Import surfaces

The MRI is available in the anatomy folder for Subject01. Let's now proceed with the surfaces. The envelopes we are going to import in this tutorial were extracted using BrainVISA, and their names and types may differ from other software solutions. To learn how to get these surfaces by yourself: read the tutorials for BrainVISA, FreeSurfer, BrainSuite or CIVET.

  1. Right click on the subject node again, and click on "Import surfaces...". Select at the same time (holding the Shift, Ctrl or Cmd key) all the files in the directory "sample_ctf/Anatomy/BrainVISA" (head, Lhemi, Rhemi). Click on "Open".
    Make sure to select the correct file format: "All surface files (*.*)" or "BrainVISA (*.mesh)"

  2. You should see the three surfaces in the database tree.


    • One has been identified as a scalp (=head) surface, because its original filename contained the "scalp" keyword. Usually, Brainstorm identifies file types with this kind of tags in the file names.

    • The two other files were not automatically identified. They contain the envelopes of the left and right hemispheres of the brain, but Lhemi and Rhemi are not keywords that are automatically identified by Brainstorm.

    • Try to display the surfaces by double-clicking on them, or with the popup menu Display.

Downsample and merge surfaces

At the bottom of the Surface tab, you can see the numbers of faces and vertices for each surface, and also display their faces (wireframe) with the Edge button. They look great, but their resolution is too high for the algorithms we will apply on them later, so they need to be resampled.

  1. Downsampling:
    • Right-click on 01_head > Less vertices... > 7000 vertices. Ok.
      Select the default resampling method: "Matlab's reducepatch". Ok.

    • Select simultaneously Lhemi and Rhemi > Right-click > Less vertices... > 7500 vertices. Ok.
      Select the default resampling method: "Matlab's reducepatch". Ok.

    • Three new surfaces appeared in the list, with the number of vertices as a suffix.
  2. Group the left and right hemispheres to build a Cortex surface:

    • Select simultaneously Lhemi_7500V and Rhemi_7500V > Right-click > Merge surfaces

    • A file called cortex_15000V appears in the list. Its icon is different from the Lhemi and Rhemi surfaces: the surface was automatically classified as a cortex envelope.

    • To set manually the type of a surface : right-click > Set surface type > Cortex

    • Like all the files in the database, the surface can be renamed: F2 key, or click twice on it (wait between the two clicks), or right-click > Rename.

    • Double-click on it to display it (or right-click > Display), and check in the Surfaces tab that the number of vertices is about 15000.

  3. Multiple surfaces of the same type:
    • You are in a configuration where two surfaces are classified as head.

    • The one displayed in green is considered as the default one. It will be used by all the functions that need the head surface for this subject.
    • Double-click on the other head surface to select it (or right-click > Set as default scalp). It should turn green.

    • However, having multiple surfaces of the same type is not the recommanded way to proceed, as it might be confusing. To make things clear, always set as "Other" the surfaces you are not going to use in the source estimation process (their icon should be a gray dot).

  4. A bit of cleaning:
    • Rename the 01_head_7000V to head. Set it as the default scalp (green).

    • Delete all the surfaces but the MRI, head and cortex (Delete key, or right-click>Delete).

    • Before: treeBeforeCleaning.gif After: treeAfterCleaning.gif

Bug warning

Description: On some operating systems, it may happen that the tree is not refreshed well. Just after adding new files, the database tree can be displayed incompletely or can even appear completely empty. This bug occurs sometimes because the interactions between Matlab and Java are not always well synchronized.

Workaround: If this happens, just refresh the tree display with either pressing the F5 key or changing the display mode.

Automatic import

The import of the MRI and the surfaces was done manually in the previous sections to introduce the tools. However, you will most likely not have to follow all these steps on your own data, as it is now possible to import the entire segmentation folders with just one click, with the menu "Import anatomy folder". It works for FreeSurfer, BainVISA, BrainSuite and CIVET. Additionally, new menus are available to generate head surfaces from the MRI.

Check registration with MRI

Your Subject01 anatomy is ready for source estimation. But before going further, you should always check that surfaces and MRI are well registered. When performing these steps a bit too fast, it is really easy to end up with a cortex envelope that is not aligned with the MRI. None of the following steps in source estimation will check that for you, and the sources estimated would be completely wrong.

Fix registration with MRI

In some rare cases, the surfaces may not be registered correctly with the MRI.

Defining the fiducials on head surface

Manual alignment

What happened on the hard drive

For most manipulations, it is not necessary to know exactly what is going on at the level of the file system, in the Brainstorm database directory. However, many things are not accessible from the Brainstorm interface, you may find sometimes useful to manipulate some piece of data directly from the Matlab command window.

The right-click > File menu, accessible on all the nodes in Brainstorm database explorer, offers many tools to interact with the file system and the Matlab environment.

Where are the files ?

Several ways to reach a file:

Right-click on a surface file: many menus can lead you to the files and their contents:

What are all these other files ?


The anatomy of our subject is ready for source estimation, the next tutorial explains how to import recordings.

Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):

Tutorials/TutImportAnatomy (last edited 2016-07-28 16:30:47 by FrancoisTadel)