MNE software User`s Guide - Martinos Center for Biomedical Imaging

Add to my manuals
344 Pages

advertisement

MNE software User`s Guide - Martinos Center for Biomedical Imaging | Manualzz

MNE softw are

User’s Guide

V ersion 2.6

March 2009

Ma tti Hämäläinen

MGH/HMS/MIT Athinoula A. Martinos Center for Biomedical Imaging

Massachusetts General Hospital

Charlestown, Massachusetts, USA

This document contains cop yrighted information. The author reserves the right to make changes in the speciļ¬cations or data shown herein at any time without notice or obligation. The author makes no warranty of any kind with regard to this document. The author shall not be liable for errors contained herein or direct, indirect, incidental or consequential damages in connection with the furnishing, performance, or use of this document.

Printing History

1st edition

2nd edition

3rd edition

4th edition

5th edition

6th edition

7th edition

8th edition

9th edition

10th edition

11th edition

12th edition

Identiļ¬ er

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

MSH-MNE

Version

1.5

1.6

1.7

2.1

1.1

1.2

1.3

1.4

2.2

2.4

2.5

2.6

Date

August 2001

April 2002

July 2002

October 2002

No vember 2002

December 2002

March 2003

April 2005

August 2005

December 2005

December 2006

March 2009

MSH-MNE

Contents

Chapter 1 Introduction 9

Chapter 2 Overview 11

2.1

List of components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.2 File formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.3 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.4 User environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Chapter 3 The Cookbook 19

3.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.2 Selecting the subject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.3 Cortical surface reconstruction with FreeSurfer . . . . . . . . . 20

3.4 Setting up the anatomical MR images for MRIlab . . . . . . . . 20

3.5 Setting up the source space . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.6 Creating the BEM model meshes . . . . . . . . . . . . . . . . . . . . . 24

Setting up the triangulation files . . . . . . . . . . . . . . . . . . . . . . . . 24

3.7

Setting up the boundary-element model . . . . . . . . . . . . . . . 25

3.8 Setting up the MEG/EEG analysis directory . . . . . . . . . . . . . 28

3.9 Preprocessing the raw data . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Cleaning the digital trigger channel . . . . . . . . . . . . . . . . . . . . . . 29

Fixing channel information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Designating bad channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Downsampling the MEG/EEG data . . . . . . . . . . . . . . . . . . . . . . 30

Off-line averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.10

Aligning the coordinate frames . . . . . . . . . . . . . . . . . . . . . . . 31

3.11 Computing the forward solution . . . . . . . . . . . . . . . . . . . . . . 32

3.12 Setting up the noise-covariance matrix . . . . . . . . . . . . . . . . 34

3.13 Calculating the inverse operator decomposition . . . . . . . . . 35

3.14 Analyzing the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Chapter 4 Processing raw data 39

4.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

4.2 Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Common options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Interactive mode options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

Batch-mode options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.3

The user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

4.4 The File menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Open evoked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

MSH-MNE i

ii

4.5

Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Change working directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Read projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Save projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Apply bad channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Load events (text) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Load events (fif) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Save events (text) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Save events (fif) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Load derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Save derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Load channel selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Save channel selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

The Adjust menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Scales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Full view layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

Compensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

Averaging preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

4.6

The Process menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Estimation of a covariance matrix . . . . . . . . . . . . . . . . . . . . . . . 63

Estimation of a covariance matrix from raw data . . . . . . . . . . . 63

4.7

Creating a new SSP operator . . . . . . . . . . . . . . . . . . . . . . . . . . 64

The Windows menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

4.8 The Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

4.9 The raw data display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Browsing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

4.10

Events and annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

The event list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Loading and saving event files . . . . . . . . . . . . . . . . . . . . . . . . . 70

Defining annotated events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Event files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

4.11

The tool bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

4.12 Topographical data displays . . . . . . . . . . . . . . . . . . . . . . . . . 74

4.13 Description files for off-line averaging . . . . . . . . . . . . . . . . . 75

Overall format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Common parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Category definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

4.14

4.15

Description files for covariance matrix estimation . . . . . . . 78

Overall format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Common parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

Covariance definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Managing averages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

MSH-MNE

4.16 The Signal-Space Projection (SSP) method . . . . . . . . . . . . . 82

General concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

4.17

Estimation of the noise subspace . . . . . . . . . . . . . . . . . . . . . . . 84

EEG average electrode reference . . . . . . . . . . . . . . . . . . . . . . . 84

Covariance matrix estimation . . . . . . . . . . . . . . . . . . . . . . . . 85

Continuous raw data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

4.18

Epochs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

Combination of covariance matrix estimates . . . . . . . . . . . . . . 87

SSP information included with covariance matrices . . . . . . . . . 87

Interacting with mne_analyze . . . . . . . . . . . . . . . . . . . . . . . . 87

Chapter 5 The forward solution 89

5.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

5.2 MEG/EEG and MRI coordinate systems . . . . . . . . . . . . . . . . 89

5.3 The head and device coordinate systems . . . . . . . . . . . . . . 93

5.4 Creating a surface-based source space . . . . . . . . . . . . . . . . 94

5.5 Creating a volumetric or discrete source space . . . . . . . . . 95

5.6 Creating the BEM meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Surface options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Tessellation file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

5.7

Topology checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Computing the BEM geometry data . . . . . . . . . . . . . . . . . . 100

5.8 Coil geometry information . . . . . . . . . . . . . . . . . . . . . . . . . . 100

The sensor coordinate system . . . . . . . . . . . . . . . . . . . . . . . . 101

5.9

Calculation of the magnetic field . . . . . . . . . . . . . . . . . . . . . . . 101

Implemented coil geometries . . . . . . . . . . . . . . . . . . . . . . . . . 102

The coil definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

Creating the coil definition file . . . . . . . . . . . . . . . . . . . . . . . . . 108

Computing the forward solution . . . . . . . . . . . . . . . . . . . . . 108

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

5.10

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

Implementation of software gradient compensation . . . . . . . . 111

The EEG sphere model definition file . . . . . . . . . . . . . . . . . . . 112

EEG forward solution in the sphere model . . . . . . . . . . . . . . . 112

Field derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Averaging forward solutions . . . . . . . . . . . . . . . . . . . . . . . . 113

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

Chapter 6 The current estimates 115

6.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

6.2 Minimum-norm estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

The linear inverse operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Regularization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Whitening and scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Regularization of the noise-covariance matrix . . . . . . . . . . . . 117

Computation of the solution . . . . . . . . . . . . . . . . . . . . . . . . . . 118

MSH-MNE iii

iv

Noise normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Predicted data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Cortical patch statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

The orientation constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Depth weighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 fMRI-guided estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

6.3

Effective number of averages . . . . . . . . . . . . . . . . . . . . . . . 122

6.4 Inverse-operator decomposition . . . . . . . . . . . . . . . . . . . . . 123

6.5 Producing movies and snapshots . . . . . . . . . . . . . . . . . . . . 126

General options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

6.6

Input files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Times and baseline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Options controlling the estimates . . . . . . . . . . . . . . . . . . . . . . 128

Visualization options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

Thresholding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Label processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Using stc file input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

Computing inverse from raw and evoked data . . . . . . . . . . 135

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Implementation details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

Chapter 7 Interactive analysis 139

7.1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

7.2 Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

7.3 The main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

7.4 The menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

The File menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

The Adjust menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

The View menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

The Labels menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

The Dipoles menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

7.5

The Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Loading data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

7.6 Loading epochs from a raw data file . . . . . . . . . . . . . . . . . . 148

7.7 Data displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

The topographical display . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

7.8

The sample channel display . . . . . . . . . . . . . . . . . . . . . . . . . . 150

Scale settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

The surface display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

The surface selection dialog . . . . . . . . . . . . . . . . . . . . . . . . . . 153

The patch selection dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

Controlling the surface display . . . . . . . . . . . . . . . . . . . . . . . . 154

Selecting vertices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

Defining viewing orientations . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Adjusting lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Producing output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Image output modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

7.9 Morphing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

MSH-MNE

7.10 The viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

Viewer options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

7.11 Magnetic field and electric potential maps . . . . . . . . . . . . . 167

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Technical description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Field mapping preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

7.12 Working with current estimates . . . . . . . . . . . . . . . . . . . . . . 170

Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

The SNR display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

7.13 Inquiring timecourses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Timecourses at vertices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Timecourses at labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

The timecourse manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

Label timecourse files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

Creating new label files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

7.14 Overlays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

7.15 Fitting current dipoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

Dipole fitting parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

The dipole fitting algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

The dipole list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

Channel selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

7.16 Coordinate frame alignment . . . . . . . . . . . . . . . . . . . . . . . . 186

Using a high-resolution head surface tessellation . . . . . . . . . . 188

Using fiducial points identified by other software . . . . . . . . . . 189

7.17 Viewing continuous HPI data . . . . . . . . . . . . . . . . . . . . . . . . 189

7.18 Working with the MRI viewer . . . . . . . . . . . . . . . . . . . . . . . . 191

7.19 Working with the average brain . . . . . . . . . . . . . . . . . . . . . . 193

7.20 Compatibility with cliplab . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

Chapter 8 Morphing and averaging 195

8.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

8.2 The morphing maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

8.3 About smoothing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

8.4 Precomputing the morphing maps . . . . . . . . . . . . . . . . . . . 197

8.5 Morphing label data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

8.6 Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

The averager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

The description file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

Chapter 9 Data conversion 203

9.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

9.2 Importing data from other MEG/EEG systems . . . . . . . . . . 203

Importing 4-D Neuroimaging data . . . . . . . . . . . . . . . . . . . . . . 203

Importing CTF data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

Importing CTF Polhemus data . . . . . . . . . . . . . . . . . . . . . . . . 206

Applying software gradient compensation . . . . . . . . . . . . . . . 207

MSH-MNE v

vi

Importing Magnes compensation channel data . . . . . . . . . . . . 208

Creating software gradient compensation data . . . . . . . . . . . . 209

Importing KIT MEG system data . . . . . . . . . . . . . . . . . . . . . . . 210

Importing EEG data saved in the EDF, EDF+, or BDF format 213

Importing EEG data saved in the Tufts University format . . . . 215

Importing BrainVision EEG data . . . . . . . . . . . . . . . . . . . . . . . 216

Converting eXimia EEG data . . . . . . . . . . . . . . . . . . . . . . . . . 217

9.3 Converting digitization data . . . . . . . . . . . . . . . . . . . . . . . . . 218

The hpts format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

9.4 Converting volumetric data into an MRI overlay . . . . . . . . 219

9.5 Listing source space data . . . . . . . . . . . . . . . . . . . . . . . . . . 220

9.6 Listing BEM mesh data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

9.7 Converting surface data between different formats . . . . . 222

command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

9.8 Converting MRI data into the fif format . . . . . . . . . . . . . . . . 225

9.9 Collecting coordinate transformations into one file . . . . . 225

9.10 Converting an ncov covariance matrix file to fiff . . . . . . . . 226

9.11 Converting a lisp covariance matrix to fiff . . . . . . . . . . . . . 227

9.12 The MNE data file conversion tool . . . . . . . . . . . . . . . . . . . . 227

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

Guide to combining options . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Matlab data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

9.13 Converting raw data to Matlab format . . . . . . . . . . . . . . . . . 234

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

Matlab data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

9.14 Converting epochs to Matlab format . . . . . . . . . . . . . . . . . . 237

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

The binary epoch data file . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Matlab data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Chapter 10 The Matlab toolbox 243

10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

10.2 Some data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

10.3 On-line documentation for individual routines . . . . . . . . . . 263

Chapter 11 Miscellaneous utilities 265

11.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

11.2 Finding software versions . . . . . . . . . . . . . . . . . . . . . . . . . . 265

11.3 Listing contents of a fif file . . . . . . . . . . . . . . . . . . . . . . . . . . 265

11.4 Data file modification utilities . . . . . . . . . . . . . . . . . . . . . . . . 266

Designating bad channels: mne_mark_bad_channels . . . . . . 266

Fixing the encoding of the trigger channel: mne_fix_stim14 . . 266

Updating EEG location info: mne_check_eeg_locations . . . . . 267

Updating magnetometer coil types: mne_fix_mag_coil_types 268

Modifying channel names and types: mne_rename_channels 268

Modifying trigger channel data: mne_add_triggers . . . . . . . . . 270

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

MSH-MNE

Removing identifying information . . . . . . . . . . . . . . . . . . . . . . 270

Copying the processing history . . . . . . . . . . . . . . . . . . . . . . . . 271

11.5 Creating a derivation file . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

Derivation file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

11.6 Creating a custom EEG layout . . . . . . . . . . . . . . . . . . . . . . . 274

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274

11.7 Adding topology information to a source space . . . . . . . . 276

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

11.8 Converting covariance data into an SSP operator . . . . . . 277

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

11.9 Fitting a sphere to a surface . . . . . . . . . . . . . . . . . . . . . . . . 278

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

11.10 Computing sensitivity maps . . . . . . . . . . . . . . . . . . . . . . . . 279

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

Available sensitivity maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

11.11 Transforming locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

11.12 Inquiring and changing baselines . . . . . . . . . . . . . . . . . . . . 281

11.13 Data simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

Noise simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Simulated data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Source waveform expressions . . . . . . . . . . . . . . . . . . . . . . . . 285

11.14 Converting parcellation data into labels . . . . . . . . . . . . . . . 288

Chapter 12 The sample data set 289

12.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

12.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

12.3 Setting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

12.4 Contents of the data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

12.5 Setting up subject-specific data . . . . . . . . . . . . . . . . . . . . . 292

Structural MRIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Source space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Boundary-element models . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

12.6 Setting up a custom EEG layout . . . . . . . . . . . . . . . . . . . . . 293

12.7 Previewing the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

12.8 Off-line averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

Using the averaging script interactively . . . . . . . . . . . . . . . . . . 295

Using the averaging script in batch mode . . . . . . . . . . . . . . . . 295

12.9 Viewing the off-line average . . . . . . . . . . . . . . . . . . . . . . . . . 296

Loading the averages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

MSH-MNE vii

viii

Inspecting the auditory data . . . . . . . . . . . . . . . . . . . . . . . . . . 296

Inspecting the visual data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

12.10 Computing the noise-covariance matrix . . . . . . . . . . . . . . . 297

12.11 MEG-MRI coordinate system alignment . . . . . . . . . . . . . . . 298

Initial alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

Refining the coordinate transformation . . . . . . . . . . . . . . . . . . 299

Saving the transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

12.12 The forward solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

12.13 The inverse operator decomposition . . . . . . . . . . . . . . . . . 301

12.14 Interactive analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Load surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Load the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Show field and potential maps . . . . . . . . . . . . . . . . . . . . . . . . 302

Show current estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Labels and timecourses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Morphing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Chapter 13 Useful reading 305

13.1 General MEG reviews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

13.2 Cortical surface reconstruction and morphing . . . . . . . . . 305

13.3 Forward modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

13.4 Signal-space projections . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

13.5 Minimum-norm estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

13.6 fMRI-weighted estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

Appendix A Creating the BEM meshes 309

A.1 Using the watershed algorithm . . . . . . . . . . . . . . . . . . . . . . 309

A.2 Using FLASH images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

Organizing MRI data into directories . . . . . . . . . . . . . . . . . . . . 310

Creating the surface tessellations . . . . . . . . . . . . . . . . . . . . . . 311

Inspecting the meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

A.3 Using seglab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

A.4 Using BrainSuite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

Appendix B Setup at the Martinos Center 315

B.1 User environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

B.2 Using Neuromag software . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Software overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Using MRIlab for coordinate system alignment . . . . . . . . . . . . 316

B.3 Mature software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

mne_compute_mne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

Appendix C Installation and configuration 321

C.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Create a directory to hold the software . . . . . . . . . . . . . . . . . . 321

MSH-MNE

Unpack the archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

C.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Set up a link to Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Run the configuration script . . . . . . . . . . . . . . . . . . . . . . . . . . 322

Modify the login scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

Add open source software . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

Optional: Remove unnecessary binaries . . . . . . . . . . . . . . . . 323

Testing the performance of your OpenGL graphics . . . . . . . . 323

C.3 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

C.4 Obtain FreeSurfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

C.5 How to get started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

Appendix D Release notes 325

D.1 Release notes for MNE software 2.4 . . . . . . . . . . . . . . . . . . 325

Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

General software changes . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

File conversion utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

mne_browse_raw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 mne_analyze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 mne_make_movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

D.2 Release notes for MNE software 2.5 . . . . . . . . . . . . . . . . . . 326

Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

mne_browse_raw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 mne_epochs2mat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 mne_analyze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

mne_ctf2fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 mne_make_movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 mne_surf2bem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 mne_forward_solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

mne_inverse_operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 mne_compute_raw_inverse . . . . . . . . . . . . . . . . . . . . . . . . . . 329

Time range settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 mne_change_baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

New utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 mne_show_fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 mne_make_cor_set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

mne_compensate_data . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 mne_insert_4D_comp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 mne_ctf_dig2fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 mne_kit2fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 mne_make_derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

BEM mesh generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

Matlab toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

D.3 Release notes for MNE software 2.6 . . . . . . . . . . . . . . . . . . 331

Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Changes to existing software . . . . . . . . . . . . . . . . . . . . . . . . . 331 mne_add_patch_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

MSH-MNE ix

x

mne_analyze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

mne_average_forward_solutions . . . . . . . . . . . . . . . . . . . . 332 mne_browse_raw and mne_process_raw . . . . . . . . . . . . . 332

mne_compute_raw_inverse . . . . . . . . . . . . . . . . . . . . . . . . 333 mne_convert_surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 mne_dump_triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

mne_epochs2mat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_forward_solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_list_bem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_make_cor_set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_make_movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_make_source_space . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_mdip2stc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 mne_project_raw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

mne_rename_channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 mne_setup_forward_model . . . . . . . . . . . . . . . . . . . . . . . . . 335 mne_simu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 mne_transform_points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Matlab toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

New utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 mne_collect_transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 mne_convert_dig_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

mne_edf2fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_brain_vision2fiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_anonymize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_opengl_test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_volume_data2mri . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_volume_source_space . . . . . . . . . . . . . . . . . . . . . . . . 336 mne_copy_processing_history . . . . . . . . . . . . . . . . . . . . . . 336

Appendix E Licence agreement 337

E.1 License agreement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

MSH-MNE

1

C H A P T E R 1

Introduction

This document describes a set of programs for preprocessing and averaging of MEG and EEG data and for constructing cortically-constrained minimum-norm estimates. This software package will in the sequel referred to as MNE software. The software is based on anatomical MRI processing, forward modelling, and source estimation methods published in Dale, Fischl, Hämäläinen, and others. The software depends on anatomical MRI processing tools provided by the FreeSurfer software.

Chapter 2 of this manual gives an overview of the software modules

included with MNE software. Chapter 3 is a concise cookbook describing

a typical workļ¬‚ow for a novice user employing the convenience scripts as

far as possible. Chapters 4 to 11 give more detailed information about the

software modules. Chapter 12 discusses processing of the sample data set

included with the MNE software. Chapter 13 lists some useful back-

ground material for the methods employed in the MNE software.

Appendix A is an overview of the BEM model mesh generation methods,

Appendix B contains information speciļ¬c to the setup at Martinos Center

of Biomedical Imaging, Appendix C is a software installation and conļ¬g-

uration guide, Appendix D summarizes the software history, and

Appendix E contains the End-User License Agreement.

Note: The most recent version of this manual is available at

$MNE_ROOT/doc/MNE-manual-

<version>.pdf. For the present manual, <version> = 2.6. For deļ¬nition of the MNE_ROOT environment

variable, see Section 2.4.

I want to thank all MNE Software users at the Martinos Center and in other institutions for their collaboration during the creation of this software as well as for useful comments on the software and its documentation.

The development of this software has been supported by the NCRR Cen-

ter for Functional Neuroimaging Technologies P41RR14075-06, the NIH grants R01 EB006385-A101, 1R01 HD40712-A1, 1R01 NS44319-01, and 2R01 NS37462-05, ell as by Department of Energy under Award

Number DE-FG02-99ER62764 to The MIND Institute.

MSH-MNE 9

1

Introduction

10 MSH-MNE

2

C H A P T E R 2

Overview

2.1 List of components

The principal components of the MNE Software and their functions are

listed in Table 2.1. Documented software is listed in italics. Table 2.2 lists

various supplementary utilities.

mne_analyze

Name

mne_average_estimates mne_browse_raw mne_compute_mne mne_compute_raw_inverse mne_convert_mne_data mne_do_forward_solution mne_do_inverse_operator mne_forward_solution mne_inverse_operator mne_make_movie mne_make_source_space

Purpose

An interactive analysis tool for computing source esti-

mates, see Chapter 7.

Average data across subjects, see Section 8.6.2.

Interactive raw data browser. Includes ļ¬ltering, ofļ¬‚ine averaging, and computation of covariance matrices, see

Chapter 4.

Computes the minimum-norm estimates, see

Section B.3.1. Most of the functionality of

mne_compute_mne is included in mne_make_movie.

Compute the inverse solution from raw data, see

Section 6.6.

Convert MNE data ļ¬les to other ļ¬le formats, see

Section 9.12.

Convenience script to calculate the forward solution

matrix, see Section 3.11.

Convenience script to compute the inverse operator

decomposition, see Section 3.13.

Calculate the forward solution matrix, see Section 5.9.

Compute the inverse operator decomposition, see

Section 6.4.

Make movies in batch mode, see Section 6.5.

Create a ļ¬f source space description ļ¬le, see Section 5.4.

Table 2.1 The software components.

MSH-MNE 11

2

Overview

Name

mne_process_raw

mne_redo_ļ¬le mne_redo_ļ¬le_nocwd

mne_setup_forward_model mne_setup_mri mne_setup_source_space

mne_show_environment

Purpose

A batch-mode version of mne_browse_raw, see

Chapter 4.

Many intermediate result ļ¬les contain a description of their ‘production environment’. Such ļ¬les can be recreated easily with this utility. This is convenient if, for example, the selection of bad channels is changed and the inverse operator decomposition has to be recalculated.

Works like mne_redo_ļ¬le but does not try to change in to the working directory speciļ¬ed in the ‘production environment’

Set up the BEM-related ļ¬f ļ¬les, see Section 3.7.

A convenience script to create the ļ¬f ļ¬les describing the

anatomical MRI data, see Section 3.4.

A convenience script to create a source space description

ļ¬le, see Section 3.5.

Show information about the production environment of a ļ¬le.

Table 2.1 The software components.

Name Purpose

mne_add_to_meas_info

Add patch information to a source space ļ¬le, see

Section 11.7.

Utility to add new information to the measurement info block of a ļ¬f ļ¬le. The source of information is another ļ¬f ļ¬le.

mne_add_triggers mne_annot2labels mne_anonymize

Modify the trigger channel STI 014 in a raw data ļ¬le, see

Section 11.4.6. The same effect can be reached by using an

event ļ¬le for averaging in mne_process_raw and

mne_browse_raw.

Convert parcellation data into label ļ¬les, see Section 11.14.

Remove subject-speciļ¬c information from a ļ¬f data ļ¬le, see

Section 11.4.7.

mne_average_forward_solutions

Calculate an average of forward solutions, see Section 5.10.

mne_brain_vision2ļ¬ff

Convert EEG data from BrainVision format to ļ¬f format,

see Section 9.2.10.

Table 2.2 Utility programs.

12 MSH-MNE

Name

mne_change_baselines

mne_change_nave

mne_check_eeg_locations

mne_check_surface

mne_collect_transforms mne_compensate_data mne_convert_lspcov mne_convert_ncov mne_convert_surface mne_cov2proj mne_create_comp_data mne_ctf2ļ¬ff mne_ctf_dig2ļ¬ff mne_dicom_essentials mne_edf2ļ¬ff mne_epochs2mat

Overview

2

Purpose

Change the dc offsets according to speciļ¬cations given in a

text ļ¬le, see Section 11.12.

Change the number of averages in an evoked-response data ļ¬le. This is often necessary if the ļ¬le was derived from several ļ¬les.

Checks that the EEG electrode locations have been correctly transferred from the Polhemus data block to the

channel information tags, see Section 11.4.3.

Check the validity of a FreeSurfer surface ļ¬le. This program simply checks for topological errors in surface ļ¬les.

Collect coordinate transformations from several sources

into a single ļ¬f ļ¬le, see Section 9.9.

Change the applied software gradient compensation in an

evoked-response data ļ¬le, see Section 9.2.4.

Convert the LISP format noise covariance matrix output by

graph into ļ¬f, see Section 9.11.

Convert the ncov format noise covariance ļ¬le to ļ¬f, see

Section 9.10.

Convert FreeSurfer and text format surface ļ¬les into Matlab

mat ļ¬les, see Section 9.7.

Pick eigenvectors from a covariance matrix and create a signal-space projection (SSP) ļ¬le out of them, see

Section 11.9.

Create a ļ¬f ļ¬le containing software gradient compensation

information from a text ļ¬le, see Section 9.2.6.

Convert a CTF ds folder into a ļ¬f ļ¬le, see Section 9.2.2.

Convert text format digitization data to ļ¬f format, see

Section 9.2.3.

List essential information from a DICOM ļ¬le. This utility is used by the script mne_organize_dicom, see

Section A.2.1.

Convert EEG data from the EDF/EDF+/BDF formats to the

ļ¬f format, see Section 9.2.8.

Apply bandpass ļ¬lter to raw data and extract epochs for

subsequent processing in Matlab, see Section 9.14.

Table 2.2 Utility programs.

MSH-MNE 13

2

Overview

Name

mne_evoked_data_summary

mne_eximia2ļ¬ff mne_ļ¬t_sphere_to_surf mne_ļ¬x_mag_coil_types mne_ļ¬x_stim14 mne_ļ¬‚ash_bem mne_insert_4D_comp mne_list_bem mne_list_coil_def

mne_list_proj

mne_list_source_space mne_list_versions mne_make_cor_set mne_make_derivations mne_make_eeg_layout mne_make_morph_maps

mne_make_uniform_stc

Purpose

List summary of averaged data from a ļ¬f ļ¬le to the standard output.

Convert EEG data from the Nexstim eXimia system to ļ¬f

format, see Section 9.2.11.

Fit a sphere to a surface given in either ļ¬f or FreeSurfer for-

mat, see Section 11.9.

Update the coil types for magnetometers in a ļ¬f ļ¬le, see

Section 11.4.4.

Fix coding errors of trigger channel STI 014, see

Section 3.9.1.

Create BEM tessellation using multi-echo FLASH MRI

data, see Section A.2.

Read Magnes compensation channel data from a text ļ¬le and merge it with raw data from other channels in a ļ¬f ļ¬le,

see Section 9.2.5

List BEM information in text format, see Section 9.6.

Create the coil description ļ¬le. This is run automatically at

when the software is set up, see Section 5.8.5.

List signal-space projection data from a ļ¬f ļ¬le.

List source space information in text format suitable for importing into Neuromag MRIlab software, see

Section 9.5.

List versions and compilation dates of MNE software mod-

ules, see Section 11.2.

Used by mne_setup_mri to create ļ¬f format MRI description ļ¬les from COR or mgh/mgz format MRI data, see

Section 3.4. The mne_make_cor_set utility is described in

Section 9.8.

Create a channel derivation data ļ¬le, see Section 11.5.

Make a topographical trace layout ļ¬le using the EEG electrode locations from an actual measurement, see

Section 11.6.

Precompute the mapping data needed for morphing

between subjects, see Section 8.4.

Create a spatially uniform stc ļ¬le for testing purposes.

Table 2.2 Utility programs.

14 MSH-MNE

Name

mne_mark_bad_channels mne_morph_labels mne_organize_dicom mne_prepare_bem_model

mne_process_stc

mne_raw2mat mne_rename_channels mne_sensitivity_map

mne_sensor_locations

mne_show_ļ¬ff mne_simu mne_smooth_w mne_surf2bem

mne_toggle_skips

mne_transform_points mne_tufts2ļ¬ff

mne_view_manual

mne_volume_data2mri mne_volume_source_space mne_watershed_bem

MSH-MNE

Overview

2

Purpose

Update the list of unusable channels in a data ļ¬le, see

Section 11.4.1.

Morph label ļ¬le deļ¬nitions between subjects, see

Section 8.5.

Organized DICOM MRI image ļ¬les into directories, see

Section A.2.1.

Perform the geometry calculations for BEM forward solu-

tions, see Section 5.7.

Manipulate stc ļ¬les.

Convert raw data into a Matlab ļ¬le, see Section 9.13.

Change the names and types of channels in a ļ¬f ļ¬le, see

Section 11.4.5.

Compute a sensitivity map and output the result in a w-ļ¬le,

see Section 11.10.

Create a ļ¬le containing the sensor locations in text format.

List contents of a ļ¬f ļ¬le, see Section 11.3

Simulate MEG and EEG data, see Section 11.13.

Smooth a w ļ¬le.

Create a ļ¬f ļ¬le describing the triangulated compartment boundaries for the boundary-element model (BEM), see

Section 5.6.

Change data skip tags in a raw ļ¬le into ignored skips or vice versa.

Transform between MRI and MEG head coordinate frames,

see Section 11.11.

Convert EEG data from the Tufts University format to ļ¬f

format, see Section 9.2.9.

Starts a PDF reader to show this manual from its standard location.

Convert volumetric data deļ¬ned in a source space created with mne_volume_source_space into an MRI overlay, see

Section 9.4.

Make a volumetric source space, see Section 5.5.

Do the segmentation for BEM using the watershed algo-

rithm, see Section A.1.

Table 2.2 Utility programs.

15

2

Overview

2.2 File formats

The MNE software employs the ļ¬f ļ¬le format whenever possible. New tags have been added to incorporate information speciļ¬c to the calculation of cortically contained source estimates. FreeSurfer ļ¬le formats are also employed when needed to represent cortical surface geometry data as well as spatiotemporal distribution of quantities on the surfaces. Of particular interest are the w ļ¬les, which contain static overlay data on the cortical surface and stc ļ¬les, which contain dynamic overlays (movies).

2.3 Conventions

When command line examples are shown, the backslash character (\) indicates a continuation line. It is also valid in the shells. In most cases, however, you can easily ļ¬t the commands listed in this manual on one line and thus omit the backslashes. The order of options is irrelevant. Entries to be typed literally are shown like this. Italicized text indicates conceptual entries. For example, <dir> indicates a directory name.

In the description of interactive software modules the notation <menu>/

<item>

is often used to denotes menu selections. For example, File/Quit stands for the Quit button in the File menu.

All software modules employ the double-dash (--) option convention, i.e., the option names are preceded by two dashes.

Most of the programs have two common options to obtain general information:

--help

Prints concise usage information.

--version

Prints the program module name, version number, and compilation date.

2.4 User environment

The system-dependent location of the MNE Software will be here referred to with the symbol <MNE>. There are two scripts for setting up user environment so that the software can be used conveniently:

<MNE>/mne/setup/mne/mne_setup_analysis_sh and

16 MSH-MNE

MSH-MNE

Overview

2

<MNE>/mne/setup/mne/mne_setup_analysis_csh compatible with the POSIX and csh/tcsh shells, respectively. Among other things these scripts assign the environment variable $MNE_ROOT the value <MNE>/mne. Since the scripts set environment variables they should be ‘sourced’ to the present shell. You can ļ¬nd which type of a shell you are using by saying echo $SHELL

If the output indicates a POSIX shell (bash or sh) you should say:

.

<MNE>/mne/setup/mne/mne_setup_analysis_sh with <MNE> replaced by the directory where you have installed the

MNE software. For csh/tcsh the corresponding command is: source

<MNE>/mne/setup/mne/mne_setup_analysis_csh

For BEM mesh generation using the watershed algorithm or on the basis

of multi-echo FLASH MRI data (see Appendix A) and for accessing the

tkmedit program from mne_analyze, see Section 7.18, the MNE software

needs access to a FreeSurfer license and software. Therefore, to use these features it is mandatory that you set up the FreeSurfer environment as described in the FreeSurfer documentation.

The environment variables relevant to the MNE software are listed in 2.3

Name of the variable Description

MNE_ROOT

FREESURFER_HOME

Location of the MNE software, see above

Location of the FreeSurfer software. Needed during FreeSurfer reconstruction and if the FreeSurfer

MRI viewer is used with

mne_analyze, see Section 7.18.

SUBJECTS_DIR

SUBJECT

Location of the MRI data

Name of the current subject

MNE_TRIGGER_CH_NAME Name of the trigger channel in raw

data, see Section 4.2.1.

MNE_TRIGGER_CH_MASK Mask to be applied to the trigger

channel values, see Section 4.2.1.

Table 2.3 Environment variables

17

2

Overview

Tip: A convenient way to provide a shortcut for MNE analysis setup is to create an alias called mne_setup in the shell startup ļ¬le. If you are using tcsh, add the following line to your .tcshrc ļ¬le, located in your home directory: alias mne_setup ‘source

\

<MNE>/mne/setup/mne/mne_setup_analysis_csh’

For bash, you can add alias mne_setup=’. \

<MNE>/mne/setup/mne/mne_setup_analysis_sh

Again <MNE> should be replaced by the directory where you installed the MNE software.

Note: Appendix B contains information speciļ¬c to the setup at the Marti-

nos Center including instructions to access the Neuromag software.

18 MSH-MNE

3

C H A P T E R 3

The Cookbook

3.1 Overview

This section describes the typical workļ¬‚ow needed to produce the minimum-norm estimate movies using the MNE software. The workļ¬‚ow is

summarized in Figure 3.1.

MRI data (raw) [ mne_setup_analysis_csh (2.5)]

MEG data (raw)

MRI data (reconstructed)

[FreeSurfer (3.3)]

COR.fif (T1) COR.fif (brain)

[mne_setup_mri (3.4)] source space

[mne_setup_source_space (3.5)]

COR-aligned.fif (T1)

[mne_analyze (7)]

[Mrilab]

BEM mesh (inner skull)

[mne_watershed (A.1)]

[mne_flash_bem (A.2)]

[Seglab (A.3)]

BEM model

[mne_setup_forward_model (3.7)]

MEG data (filtered + averaged) noise-covariance

[mne_browse_raw (4)] forward solution

[mne_do_forward_solution (3.11)] inverse operator

[mne_do_inverse_operator (3.13)]

Analyze and make movies and snapshots

[mne_analyze (7)]

[mne_make_movie (6.5)] movie files snapshots stc and w files

Figure 3.1 Workļ¬‚ow of the MNE software. References in parenthesis indicate sections and chapters of this manual.

MSH-MNE 19

3

The Cookbook

3.2 Selecting the subject

Before starting the data analysis, setup the environment variable

SUBJECTS_DIR to select the directory under which the anatomical MRI data are stored. Optionally, set SUBJECT as the name of the subject’s

MRI data directory under SUBJECTS_DIR. With this setting you can avoid entering the --subject option common to many MNE programs and scripts. In the following sections, ļ¬les in the FreeSurfer directory hierarchy are usually referred to without specifying the leading directories.

Thus, bem/msh-7-src.ļ¬f is used to refer to the ļ¬le $SUBJECTS_DIR/

$SUBJECT/bem/msh-7-src.ļ¬f.

It is also recommended that the FreeSurfer environment is set up before using the MNE software.

3.3 Cortical surface reconstruction with FreeSurfer

The ļ¬rst processing stage is the creation of various surface reconstructions with FreeSurfer. The recommended FreeSurfer workļ¬‚ow is summarized on the FreeSurfer wiki pages: https://surfer.nmr.mgh.harvard.edu/ fswiki/RecommendedReconstruction. Please refer to the FreeSurfer wiki pages (https://surfer.nmr.mgh.harvard.edu/fswiki/) and other FreeSurfer documentation for more information.

Important: Only the latest (4.0.X and later) FreeSurfer distributions contain a version of tkmedit which is compatible with mne_analyze, see

Section 7.18.

3.4 Setting up the anatomical MR images for MRIlab

If you have the Neuromag software installed, the Neuromag MRI viewer,

MRIlab, can be used to access the MRI slice data created by FreeSurfer.

In addition, the Neuromag MRI directories can be used for storing the

MEG/MRI coordinate transformations created with mne_analyze, see

Section 7.16. Furthermore, mne_do_forwand_solution searches for the

coordinate transformations in the Neuromag MRI directories by default,

see Section 3.11.

These functions require running the script mne_setup_mri which requires that the subject is set with the --subject option or by the SUBJECT environment variable. The script processes one or more MRI data sets from $SUBJECTS_DIR/$SUBJECT/mri, by default they are T1 and brain. This default can be changed by specifying the sets by one or more -

-mri

options.

20 MSH-MNE

MSH-MNE

The Cookbook

3

The script creates the directories mri/<name>-neuromag/slices and mri/<name>-neuromag/sets. If the the input data set is in COR format, mne_setup_mri makes symbolic links from the COR ļ¬les in the directory mri/<name> into mri/<name>-neuromag/slices, and creates a corresponding ļ¬f ļ¬le COR.ļ¬f in mri/<name>-neuromag/ sets

.. This “description ļ¬le” contains references to the actual MRI slices.

If the input MRI data are stored in the newer mgz format, the ļ¬le created in the mri/<name>-neuromag/sets directory will include the MRI pixel data as well. If available, the coordinate transformations to allow conversion between the MRI (surface RAS) coordinates and MNI and

FreeSurfer Talairach coordinates are copied to the MRI description ļ¬le.

mne_setup_mri invokes mne_make_cor_set, described in Section 9.8 to

convert the data.

For example: mne_setup_mri --subject duck_donald --mri T1

This command processes the MRI data set T1 for subject duck_donald.

Tip: If the SUBJECT environment variable is set it is usually sufļ¬cient to run mne_setup_mri without any options.

Tip: If the name speciļ¬ed with the --mri option contains a slash, the

MRI data are accessed from the directory speciļ¬ed and the SUBJECT and

SUBJECTS_DIR

environment variables as well as the --subject option are ignored.

3.5 Setting up the source space

This stage consists of the following:

1. Creating a suitable decimated dipole grid on the white matter surface.

2. Creating the source space ļ¬le in ļ¬f format.

3. Creating ascii versions of the source space ļ¬le for viewing with

MRIlab.

All of the above is accomplished with the convenience script

mne_setup_source_space. This script assumes that:

1. The anatomical MRI processing has been completed as described in

Section 3.3.

2. The environment variable SUBJECTS_DIR is set correctly.

The script accepts the following options:

21

3

The Cookbook

--subject <subject>

Deļ¬nes the name of the subject. If the environment variable SUB-

JECT is set correctly, this option is not required.

--spacing <spacing/mm>

Speciļ¬es the grid spacing for the source space in mm. If not set, a default spacing of 7 mm is used. Either the default or a 5-mm spacing is recommended.

--ico <number>

Instead of using the traditional method for cortical surface decimation it is possible to create the source space using the topology of a recursively subdivided icosahedron (<number> > 0) or an octahedron (<number> < 0). This method uses the cortical surface inļ¬‚ated to a sphere as a tool to ļ¬nd the appropriate vertices for the source space. The beneļ¬t of the --ico option is that the source space will have triangulation information for the decimated vertices included, which future versions of MNE software may be able to utilize. The number of triangles increases by a factor of four in each subdivision, starting from 20 triangles in an icosahedron and 8 triangles in an octahedron. Since the number of vertices on a closed surface is

n

vert

=

(

n

tri

+

4

, the number of vertices in the kth subdivision of an icosahedron and an octahedron are

k

+

2

and

4

k

+ 1

+

2

, respectively. The recommended values for <number> and the corre-

sponding number of source space locations are listed in Table 3.1.

--surface <name>

Name of the surface under the surf directory to be used. Defaults to

‘white’. mne_setup_source_space looks for ļ¬les rh.

<name> and lh.<name> under the surf directory.

--overwrite

An existing source space ļ¬le with the same name is overwritten only if this option is speciļ¬ed.

--cps

Compute the cortical patch statistics. This is need if current-density

estimates are computed, see Section 6.2.8. If the patch information

is available in the source space ļ¬le the surface normal is considered to be the average normal calculated over the patch instead of the normal at each source space location. The calculation of this infor-

22 MSH-MNE

MSH-MNE

The Cookbook

3

mation takes a considerable amount of time because of the large number of Dijkstra searches involved.

<number>

Sources per hemisphere

Source spacing / mm

-5

4

-6

5

1026

2562

4098

10242

9.9

6.2

4.9

3.1

Surface area per source / mm

2

97

39

24

9.8

Table 3.1 Recommended subdivisions of an icosahedron and an octahedron for the creation of source spaces. The approximate source spacing and corresponding surface area have been calculated assuming a

1000-cm

2

surface area per hemisphere.

For example, to create the reconstruction geometry for Donald Duck with a 5-mm spacing between the grid points, say mne_setup_source_space --subject duck_donald \

--spacing 5

As a result, the following ļ¬les are created into the bem directory:

1. <subject>-<spacing>-src.fif containing the source space description in ļ¬f format.

2. <subject>-<spacing>-lh.pnt and <subject>-<spacing>-rh.pnt

containing the source space points in MRIlab compatible ascii format.

3. <subject>-<spacing>-lh.dip and <subject>-<spacing>-rh.dip

containing the source space points in MRIlab compatible ascii format.

These ļ¬les contain ‘dipoles’, i.e., both source space points and cortex normal directions.

4. If cortical patch statistics is requested, another source space ļ¬le called

<subject>-<spacing>p-src.fif will be created.

Note: <spacing> will be the suggested source spacing in millimeters if the --spacing option is used. For source spaces based on kth subdivision of an icosahedron, <spacing> will be replaced by ico-k or oct-k, respectively.

Tip: After the geometry is set up it is possible to check that the source space points are located on the cortical surface. This can be easily done with by loading the COR.fif ļ¬le from mri/T1/neuromag/sets into

MRIlab and by subsequently overlaying the corresponding pnt or dip ļ¬les using Import/Strings or Import/Dipoles from the File menu, respectively.

23

3

The Cookbook

Tip: If the SUBJECT environment variable is set correctly it is usually sufļ¬cient to run mne_setup_source_space without any options.

3.6 Creating the BEM model meshes

Calculation of the forward solution using the boundary-element model

(BEM) requires that the surfaces separating regions of different electrical conductivities are tessellated with suitable surface elements. Our BEM software employs triangular tessellations. Therefore, prerequisites for

BEM calculations are the segmentation of the MRI data and the triangulation of the relevant surfaces.

For MEG computations, a reasonably accurate solution can be obtained by using a single-compartment BEM assuming the shape of the intracranial volume. For EEG, the standard model contains the intracranial space, the skull, and the scalp.

At present, no bulletproof method exists for creating the triangulations.

Feasible approaches are described in Appendix A.

3.6.1 Setting up the triangulation files

The segmentation algorithms described in Appendix A produce either

FreeSurfer surfaces or triangulation data in text. Before proceeding to the creation of the boundary element model, standard ļ¬les (or symbolic links created with the ln -s command) have to be present in the subject’s bem directory. If you are employing ASCII triangle ļ¬les the standard ļ¬le names are:

inner_skull.tri

Contains the inner skull triangulation.

outer_skull.tri

Contains the outer skull triangulation.

outer_skin.tri

Contains the head surface triangulation.

The corresponding names for FreeSurfer surfaces are:

inner_skull.surf

Contains the inner skull triangulation.

outer_skull.surf

Contains the outer skull triangulation.

24 MSH-MNE

MSH-MNE

The Cookbook

3 outer_skin.surf

Contains the head surface triangulation.

Tip: Different methods can be employed for the creation of the individual surfaces. For example, it may turn out that the watershed algorithm produces are better quality skin surface than the segmentation approach based on the FLASH images. If this is the case, outer_skin.surf can set to point to the corresponding watershed output ļ¬le while the other surfaces can be picked from the FLASH segmentation data.

Tip: The mne_convert_surface utility described in Section 9.7 can be

used to convert text format triangulation ļ¬les into the FreeSurfer surface format.

Important: “Aliases” created with the Mac OSX ļ¬nder are not equivalent to symbolic links and do not work as such for the UNIX shells and MNE programs.

3.7 Setting up the boundary-element model

This stage sets up the subject-dependent data for computing the forward solutions:

1. The ļ¬f format boundary-element model geometry ļ¬le is created. This step also checks that the input surfaces are complete and that they are topologically correct, i.e., that the surfaces do not intersect and that the surfaces are correctly ordered (outer skull surface inside the scalp and inner skull surface inside the outer skull). Furthermore, the range of triangle sizes on each surface is reported. For the three-layer model, the minimum distance between the surfaces is also computed.

2. Text ļ¬les containing the boundary surface vertex coordinates are created.

3. The the geometry-dependent BEM solution data are computed. This step can be optionally omitted. This step takes several minutes to complete.

This processing stage is automated with the script

mne_setup_forward_model. This script assumes that:

1. The anatomical MRI processing has been completed as described in

Section 3.3.

2. The BEM model meshes have been created as outlined in Section 3.6.

3. The environment variable SUBJECTS_DIR is set correctly.

mne_setup_forward_model accepts the following options:

25

3

The Cookbook

26

--subject <subject>

Deļ¬nes the name of the subject. This can be also accomplished by setting the SUBJECT environment variable.

--surf

Use the FreeSurfer surface ļ¬les instead of the default ASCII trian-

gulation ļ¬les. Please consult Section 3.6.1 for the standard ļ¬le nam-

ing scheme.

--noswap

Traditionally, the vertices of the triangles in ‘tri’ ļ¬les have been ordered so that, seen from the outside of the triangulation, the vertices are ordered in clockwise fashion. The ļ¬f ļ¬les, however, employ the more standard convention with the vertices ordered counterclockwise. Therefore, mne_setup_forward_model by default reverses the vertex ordering before writing the ļ¬f ļ¬le. If, for some reason, you have counterclockwise-ordered tri ļ¬les available this behavior can be turned off by deļ¬ning --noswap. When the ļ¬f ļ¬le is created, the vertex ordering is checked and the process is aborted if it is incorrect after taking into account the state of the swapping.

Should this happen, try to run mne_setup_forward_model again including the --noswap ļ¬‚ag. In particular, if you employ the

seglab software to create the triangulations (see Appendix A), the -

-noswap

ļ¬‚ag is required. This option is ignored if --surf is speciļ¬ed

--ico <number>

This option is relevant (and required) only with the --surf option and if the surface ļ¬les have been produced by the watershed algorithm. The watershed triangulations are isomorphic with an icosahedron, which has been recursively subdivided six times to yield

20480 triangles. However, this number of triangles results in a long computation time even in a workstation with generous amounts of memory. Therefore, the triangulations have to be decimated. Specifying --ico 4 yields 5120 triangles per surface while --ico 3 results in 1280 triangles. The recommended choice is --ico 4.

--homog

Use a single compartment model (brain only) instead a three layer one (scalp, skull, and brain). Only the inner_skull.tri triangulation is required. This model is usually sufļ¬cient for MEG but invalid for EEG. If you are employing MEG data only, this option is recommended because of faster computation times. If this ļ¬‚ag is speciļ¬ed, the options --brainc, --skullc, and --scalpc are irrelevant.

--brainc <conductivity/ S/m>

Deļ¬nes the brain compartment conductivity. The default value is

0.3 S/m.

MSH-MNE

MSH-MNE

The Cookbook

3

--skullc <conductivity/ S/m>

Deļ¬nes the skull compartment conductivity. The default value is

0.06 S/m corresponding to a conductivity ratio 1/50 between the brain and skull compartments.

--scalpc <conductivity/ S/m>

Deļ¬nes the brain compartment conductivity. The default value is

0.3 S/m.

--innershift <value/mm>

Shift the inner skull surface outwards along the vertex normal directions by this amount.

--outershift <value/mm>

Shift the outer skull surface outwards along the vertex normal directions by this amount.

--scalpshift <value/mm>

Shift the scalp surface outwards along the vertex normal directions by this amount.

--nosol

Omit the BEM model geometry dependent data preparation step.

This can be done later by running mne_setup_forward_model without the --nosol option.

--model <name>

Name for the BEM model geometry ļ¬le. The model will be created into the directory bem as <name>-bem.fif.If this option is missing, standard model names will be used (see below).

As a result of running the mne_setup_foward_model script, the following ļ¬les are created into the bem directory:

1. BEM model geometry speciļ¬cations <subject>-<ntri-scalp>-<ntri-

outer_skull>-<ntri-inner_skull>-bem.fif

or

<subject>-<ntri-

inner_skull>-bem.fif

containing the BEM geometry in ļ¬f format.

The latter ļ¬le is created if -homog option is speciļ¬ed. Here, <ntri-xxx> indicates the number of triangles on the corresponding surface.

2. <subject>-<surface name>-bem.pnt ļ¬les are created for each of the surfaces present in the BEM model. These can be loaded to MRIlab to check the location of the surfaces.

3. The BEM ‘solution’ ļ¬le containing the geometry dependent solution data will be produced with the same name as the BEM geometry speciļ¬cations with the ending -bem-sol.fif. These ļ¬les also contain all the information in the -bem.fif ļ¬les.

After the BEM is set up it is advisable to check that the BEM model meshes are correctly positioned. This can be easily done with by loading the COR.ļ¬f ļ¬le from mri/T1-neuromag/sets into MRIlab and by subse-

27

3

The Cookbook quently overlaying the corresponding pnt ļ¬les using Import/Strings from the File menu.

Tip: The FreeSurfer format BEM surfaces can be also viewed with the

tkmedit program which is part of the FreeSurfer distribution.

Tip: If the SUBJECT environment variable is set, it is usually sufļ¬cient to run mne_setup_forward_model without any options for the threelayer model and with the --homog option for the single-layer model. If the input ļ¬les are FreeSurfer surfaces, --surf and --ico 4 are required as well.

Tip: With help of the --nosol option it is possible to create candidate

BEM geometry data ļ¬les quickly and do the checking with respect to the anatomical MRI data. When the result is satisfactory, mne_setup_forward_model can be run without --nosol to invoke the time-consuming calculation of the solution ļ¬le as well.

Note: The triangle meshes created by the seglab program have counterclockwise vertex ordering and thus require the --noswap option.

Note: Up to this point all processing stages depend on the anatomical

(geometrical) information only and thus remain identical across different

MEG studies.

3.8 Setting up the MEG/EEG analysis directory

The remaining steps require that the actual MEG/EEG data are available.

It is recommended that a new directory is created for the MEG/EEG data processing. The raw data ļ¬les collected should not be copied there but rather referred to with symbolic links created with the ln -s command.

Averages calculated on-line can be either copied or referred to with links.

Tip: If you don’t know how to create a directory, how to make symbolic links, or how to copy ļ¬les from the shell command line, this is a perfect time to learn about this basic skills from other users or from a suitable elementary book before proceeding.

3.9 Preprocessing the raw data

The following MEG and EEG data preprocessing steps are recommended:

1. The coding problems on the trigger channel STI 014 may have to ļ¬xed,

see Section 3.9.1.

2. EEG electrode location information and MEG coil types may need to

be ļ¬xed, see Section 3.9.2.

28 MSH-MNE

MSH-MNE

The Cookbook

3

3. The data may be optionally downsampled to facilitate subsequent pro-

cessing, see Section 3.9.4.

4. Bad channels in the MEG and EEG data must be identiļ¬ed, see

Section 3.9.3

5. The data has to be ļ¬ltered to the desired passband. If mne_browse_raw or mne_process_raw is employed to calculate the ofļ¬‚ine averages and covariance matrices, this step is unnecessary since the data are ļ¬ltered on the ļ¬‚y. For information on these programs, please consult

Chapter 4.

6. For evoked-response analysis, the data has to be re-averaged off line,

see Section 3.9.5.

3.9.1 Cleaning the digital trigger channel

The calibration factor of the digital trigger channel used to be set to a value much smaller than one by the Neuromag data acquisition software.

Especially to facilitate viewing of raw data in graph it is advisable to change the calibration factor to one. Furthermore, the eighth bit of the trigger word is coded incorrectly in the original raw ļ¬les. Both problems can be corrected by saying: mne_fix_stim14

<raw ļ¬le>

More information about mne_ļ¬x_stim14 is available in Section 11.4.2. It

is recommended that this ļ¬x is included as the ļ¬rst raw data processing step. Note, however, the mne_browse_raw and mne_process_raw always sets the calibration factor to one internally.

Note: If your data ļ¬le was acquired on or after November 10, 2005 on the

Martinos center Vectorview system, it is not necessary to use

mne_ļ¬x_stim14.

3.9.2 Fixing channel information

There are two potential discrepancies in the channel information which need to be ļ¬xed before proceeding:

1. EEG electrode locations may be incorrect if more than 60 EEG channels are acquired.

2. The magnetometer coil identiļ¬ers are not always correct.

These potential problems can be ļ¬xed with the utilities

mne_check_eeg_locations and mne_ļ¬x_mag_coil_types, see Sections

11.4.3 and 11.4.4.

29

3

The Cookbook

3.9.3 Designating bad channels

Sometimes some MEG or EEG channels are not functioning properly for various reasons. These channels should be excluded from the analysis by marking them bad using the mne_mark_bad_channels utility, see

Section 11.4.1. Especially if a channel is not show a signal at all (ļ¬‚at) it is

most important to exclude it from the analysis, since its noise estimate will be unrealistically low and thus the current estimate calculations will give a strong weight to the zero signal on the ļ¬‚at channels and will essentially vanish. It is also important to exclude noisy channels because they can possibly affect others when signal-space projections or EEG average electrode reference is employed. Noisy bad channels can also adversely affect off-line averaging and noise-covariance matrix estimation by causing unnecessary rejections of epochs.

Recommended ways to identify bad channels are:

1. Observe the quality of data during data acquisition and make notes of observed malfunctioning channels to your measurement protocol sheet.

2. View the on-line averages and check the condition of the channels.

3. Compute preliminary off-line averages with artefact rejection, signalspace projection, and EEG average electrode reference computation off and check the condition of the channels.

4. View raw data in mne_process_raw or the Neuromag signal processor

graph without signal-space projection or EEG average electrode reference computation and identify bad channels.

Important: It is strongly recommended that bad channels are identiļ¬ed and marked in the original raw data ļ¬les. If present in the raw data ļ¬les, the bad channel selections will be automatically transferred to averaged ļ¬les, noise-covariance matrices, forward solution ļ¬les, and inverse operator decompositions.

3.9.4 Downsampling the MEG/EEG data

The minimum practical sampling frequency of the Vectorview system is

600 Hz. Lower sampling frequencies are allowed but result in elevated noise level in the data. It is advisable to lowpass ļ¬lter and downsample the large raw data ļ¬les often emerging in cognitive and patient studies to speed up subsequent processing. This can be accomplished with the

mne_process_raw and mne_browse_raw software modules. For details,

see Sections 4.2.3 and 4.4.3.

Tip: It is recommended that the original raw ļ¬le is called <name>_raw.ļ¬f and the downsampled version <name>_ds_raw.ļ¬f, respectively.

30 MSH-MNE

The Cookbook

3

3.9.5 Off-line averaging

The recommended tools for off-line averaging are mne_browse_raw and

mne_process_raw. mne_browse_raw is an interactive program for averaging and noise-covariance matrix computation. It also includes routines for ļ¬ltering so that the downsampling and ļ¬ltering steps can be skipped.

Therefore, with mne_browse_raw you can produce the off-line average and noise-covariance matrix estimates directly. The batch-mode version of mne_brawse_raw is called mne_process_raw. Detailed information on

mne_browse_raw and mne_process_raw can be found in Chapter 4.

MSH-MNE

3.10 Aligning the coordinate frames

The calculation of the forward solution requires knowledge of the relative location and orientation of the MEG/EEG and MRI coordinate systems.

The MEG/EEG head coordinate system is deļ¬ned in Section 5.3. The

conversion tools included in the MNE software take care of the idiosyncrasies of the coordinate frame deļ¬nitions in different MEG and EEG systems so that the ļ¬f ļ¬les always employ the same deļ¬nition of the head coordinate system.

Ideally, the head coordinate frame has a ļ¬xed orientation and origin with respect to the head anatomy. Therefore, a single MRI-head coordinate transformation for each subject should be sufļ¬cient. However, as

explained in Section 5.3, the head coordinate frame is deļ¬ned by identify-

ing the ļ¬ducial landmark locations, making the origin and orientation of the head coordinate system slightly user dependent. As a result, the most conservative choice for the deļ¬nition of the coordinate transformation computation is to re-establish it for each experimental session, i.e., each time when new head digitization data are employed.

The interactive source analysis software mne_analyze provides tools for

coordinate frame alignment, see Chapter 7. Section 12.11 also contains

tips for using mne_analyze for this purpose.

Another useful tool for the coordinate system alignment is MRIlab, the

Neuromag MEG-MRI integration tool. Section 3.3.1 of the MRIlab

User’s Guide, Neuromag P/N NM20419A-A contains a detailed description of this task. Employ the images in the set mri/T1-neuromag/ sets/COR.fif

for the alignment. Check the alignment carefully using the digitization data included in the measurement ļ¬le as described in Section 5.3.1 of the above manual. Save the aligned description ļ¬le in the same directory as the original description ļ¬le without the alignment information but under a different name.

Warning: This step is extremely important. If the alignment of the coordinate frames is inaccurate all subsequent processing steps suffer from the error. Therefore, this step should be performed by the person in charge of

31

3

The Cookbook the study or by a trained technician. Written or photographic documentation of the alignment points employed during the MEG/EEG acquisition can also be helpful.

3.11 Computing the forward solution

After the MRI-MEG/EEG alignment has been set, the forward solution,

i.e., the magnetic ļ¬elds and electric potentials at the measurement sensors and electrodes due to dipole sources located on the cortex, can be calculated with help of the convenience script mne_do_forward_solution. This utility accepts the following options:

--subject <subject>

Deļ¬nes the name of the subject. This can be also accomplished by setting the SUBJECT environment variable.

--src <name>

Source space name to use. This option overrides the --spacing option. The source space is searched ļ¬rst from the current working directory and then from $SUBJECTS_DIR/<subject>/bem. The source space ļ¬le must be speciļ¬ed exactly, including the fif extension.

--spacing <spacing/mm> or ico-<number or oct-<number>

This is an alternate way to specify the name of the source space ļ¬le.

For example, if --spacing 6 is given on the command line, the source space ļ¬les searched for are./<subject>-6-src.ļ¬f and

$SUBJECTS_DIR/$SUBJECT/ bem/<subject>-6-src.ļ¬f. The ļ¬rst ļ¬le found is used. Spacing defaults to 7 mm.

--bem <name>

Speciļ¬es the BEM to be used. The name of the ļ¬le can be any of

<name>, <name>-bem.ļ¬f, <name>-bem-sol.ļ¬f. The ļ¬le is searched for from the current working directory and from bem. If this option is omitted, the most recent BEM ļ¬le in the bem directory is used.

--mri <name>

The name of the MRI description ļ¬le containing the MEG/MRI coordinate transformation. This ļ¬le was saved as part of the align-

ment procedure outlined in Section 3.10. The ļ¬le is searched for

from the current working directory and from mri/T1-neuromag/sets

. If this option is omitted, the newest ļ¬le of the form

COR-

<user>-<date>.fif in mri/T1-neuromag/sets will be used.

32 MSH-MNE

MSH-MNE

The Cookbook

3

--trans <name>

The name of a text ļ¬le containing the 4 x 4 matrix for the coordinate transformation from head to mri coordinates, see below. If the option --trans is present, the --mri option is not required.

--meas <name>

This ļ¬le is the measurement ļ¬f ļ¬le or an off-line average ļ¬le produced thereof. It is recommended that the average ļ¬le is employed for evoked-response data and the original raw data ļ¬le otherwise.

This ļ¬le provides the MEG sensor locations and orientations as well as EEG electrode locations as well as the coordinate transformation between the MEG device coordinates and MEG head-based coordinates.

--fwd <name>

This ļ¬le will contain the forward solution as well as the coordinate transformations, sensor and electrode location information, and the source space data. A name of the form <name>-fwd.fif is recommended. If this option is omitted the forward solution ļ¬le name is automatically created from the measurement ļ¬le name and the source space name.

--mindist <dist/mm>

Omit source space points closer than this value to the inner skull surface. Any source space points outside the inner skull surface are automatically omitted. The use of this option ensures that numerical inaccuracies for very superļ¬cial sources do not cause unexpected effects in the ļ¬nal current estimates. Suitable value for this parameter is of the order of the size of the triangles on the inner skull surface. If you employ the seglab software to create the triangulations, this value should be about equal to the wish for the side length of the triangles.

--megonly

Omit EEG forward calculations.

--eegonly

Omit MEG forward calculations.

--all

Compute the forward solution for all vertices on the source space.

--overwrite

Overwrite the possibly existing forward model ļ¬le.

--help

Show usage information for the script.

Tip: If the standard MRI description ļ¬le and BEM ļ¬le selections are appropriate and the 7-mm source space grid spacing is appropriate, only

33

3

The Cookbook

34 the --meas option is necessary. If EEG data is not used --megonly option should be included.

Tip: If it is conceivable that the current-density transformation will be incorporated into the inverse operator, specify a source space with patch information for the forward computation. This is not mandatory but saves a lot of time when the inverse operator is created, since the patch information does not need to be created at that stage.

Tip: The MEG head to MRI transformation matrix speciļ¬ed with the -trans

option should be a text ļ¬le containing a 4-by-4 matrix:

T

=

R

11

R

12

R

13

x

0

R

13

R

13

R

13

y

0

R

13

R

13

R

13

z

0

0 0 0 1 deļ¬ned so that if the augmented location vectors in MRI head and MRI coordinate systems are denoted by

r

MRI

=

x

MRI

y

MRI

z

MRI

1

r

head

, respectively,

=

x

head

y

head

z

head

1

and

r

MRI

=

Tr

head

Note: It is not possible to calculate an EEG forward solution with a single-layer BEM.

3.12 Setting up the noise-covariance matrix

The MNE software employs an estimate of the noise-covariance matrix to weight the channels correctly in the calculations. The noise-covariance matrix provides information about ļ¬eld and potential patterns representing uninteresting noise sources of either human or environmental origin.

The noise covariance matrix can be calculated in several ways:

1. Employ the individual epochs during off-line averaging to calculate the full noise covariance matrix. This is the recommended approach for evoked responses.

2. Employ empty room data (collected without the subject) to calculate the full noise covariance matrix. This is recommended for analyzing ongoing spontaneous activity.

3. Employ a section of continuous raw data collected in the presence of the subject to calculate the full noise covariance matrix. This is the recommended approach for analyzing epileptic activity. The data used for

MSH-MNE

The Cookbook

3

this purpose should be free of technical artifacts and epileptic activity of interest. The length of the data segment employed should be at least

20 seconds. One can also use a long (> 200 s) segment of data with epileptic spikes present provided that the spikes occur infrequently and that the segment is apparently stationary with respect to background brain activity.

The new raw data processing tools, mne_browse_raw or

mne_process_raw include computation of noise-covariance matrices both

from raw data and from individual epochs. For details, see Chapter 4.

MSH-MNE

3.13 Calculating the inverse operator decomposition

The MNE software doesn’t calculate the inverse operator explicitly but rather computes an SVD of a matrix composed of the noise-covariance matrix, the result of the forward calculation, and the source covariance matrix. This approach has the beneļ¬t that the regularization parameter

(‘SNR’) can be adjusted easily when the ļ¬nal source estimates or dSPMs are computed. For mathematical details of this approach, please consult

Section 6.2.

This computation stage is facilitated by the convenience script

mne_do_inverse_operator. It invokes the program mne_inverse_operator with appropriate options, derived from the command line of

mne_do_inverse_operator.

mne_do_inverse_operator assumes the following options:

--fwd <name of the forward solution ļ¬le>

This is the forward solution ļ¬le produced in the computations step

described in Section 3.11.

--meg

Employ MEG data in the inverse calculation. If neither --meg nor

--eeg

is set only MEG channels are included.

--eeg

Employ EEG data in the inverse calculation. If neither --meg nor -

-eeg

is set only MEG channels are included.

--ļ¬xed

Use ļ¬xed source orientations normal to the cortical mantle. By default, the source orientations are not constrained. If --fixed is speciļ¬ed, the --loose ļ¬‚ag is ignored.

--loose <amount>

Use a ‘loose’ orientation constraint. This means that the source covariance matrix entries corresponding to the current component

35

3

The Cookbook

36 normal to the cortex are set equal to one and the transverse components are set to <amount>. Recommended value of amount is

0.1…0.6.

--depth

Employ depth weighting with the standard settings. For details, see

Sections 6.2.10 and 6.4.

--bad <name>

Speciļ¬es a text ļ¬le to designate bad channels, listed one channel name (like MEG 1933) on each line of the ļ¬le. Be sure to include both noisy and ļ¬‚at (non-functioning) channels in the list. If bad channels were designated using mne_mark_bad_channels in the measurement ļ¬le which was speciļ¬ed with the --meas option when the forward solution was computed, the bad channel information will be automatically included. Also, any bad channel information in the noise-covariance matrix ļ¬le will be included.

--senscov <name>

Name of the noise-covariance matrix ļ¬le computed with one of the

methods described in Section 3.12. By default, the script looks for a

ļ¬le whose name is derived from the forward solution ļ¬le by replacing its ending -<anything>-fwd.fif by -cov.fif. If this ļ¬le contains a projection operator, which will automatically attached to the noise-covariance matrix by mne_browse_raw and

mne_process_raw, no --proj option is necessary because

mne_inverse_operator will automatically include the projectors from the noise-covariance matrix ļ¬le.

--megreg <value>

Regularize the MEG part of the noise-covariance matrix by this amount. Suitable values are in the range 0.05...0.2. For details, see

Section 6.2.4.

--eegreg <value>

Like --megreg but applies to the EEG channels.

--diagnoise

Omit the off-diagonal terms of the noise covariance matrix. This option is irrelevant to most users.

--fmri <name>

With help of this w ļ¬le, an a priori weighting can be applied to the source covariance matrix. The source of the weighting is usually fMRI but may be also some other data, provided that the weighting can be expressed as a scalar value on the cortical surface, stored in a w ļ¬le. It is recommended that this w ļ¬le is appropriately smoothed

(see Section 8.3) in mne_analyze, tksurfer or with mne_smooth_w

to contain nonzero values at all vertices of the triangular tessellation of the cortical surface. The name of the ļ¬le given is used as a stem

MSH-MNE

The Cookbook

3

of the w ļ¬les. The actual ļ¬les should be called <name>-lh.pri

and <name>-rh.pri for the left and right hemisphere weight files, respectively. The application of the weighting is discussed in

Section 6.2.11.

--fmrithresh <value>

This option is mandatory and has an effect only if a weighting function has been speciļ¬ed with the --fmri option. If the value is in the a priori ļ¬les falls below this value at a particular source space point, the source covariance matrix values are multiplied by the value speciļ¬ed with the --fmrioff option (default 0.1). Otherwise it is left unchanged.

--fmrioff <value>

The value by which the source covariance elements are multiplied if the a priori weight falls below the threshold set with -fmrithresh

, see above.

--srccov <name>

Use this diagonal source covariance matrix. By default the source covariance matrix is a multiple of the identity matrix. This option is irrelevant to most users.

--proj <name>

Include signal-space projection information from this ļ¬le.

--inv <name>

Save the inverse operator decomposition here. By default, the script looks for a ļ¬le whose name is derived from the forward solution ļ¬le by replacing its ending -fwd.fif by <options>-inv.fif, where <options> includes options --meg, --eeg, and --ļ¬xed with the double dashes replaced by single ones.

Important: If bad channels are included in the calculation, strange results may ensue. Therefore, it is recommended that the data to be analyzed is carefully inspected with to assign the bad channels correctly.

Tip: For convenience, the MNE software includes bad-channel designation ļ¬les which can be used to ignore all magnetometer or all gradiometer channels in Vectorview measurements. These ļ¬les are called vv_grad_only.bad

and vv_mag_only.bad, respectively. Both ļ¬les are located in $MNE_ROOT/setup/mne/templates.

MSH-MNE

3.14 Analyzing the data

Once all the preprocessing steps described above have been completed, the inverse operator computed can be applied to the MEG and EEG data and the results can be viewed and stored in several ways:

37

3

The Cookbook

1. The interactive analysis tool mne_analyze can be used to explore the data and to produce quantitative analysis results, screen snapshots, and

QuickTime™ movie ļ¬les. For comprehensive information on

mne_analyze, please consult Chapter 7.

2. The command-line tool mne_make_movie can be invoked to produce

QuickTime movies and snapshots. mne_make_movie can also output the data in the stc (movies) and w (snapshots) formats for subsequent processing. Furthermore, subject-to-subject morphing is included in

mne_make_movie to facilitate cross-subject averaging and comparison

of data among subjects. mne_make_movie is described in Section 6.5,

3. The command-line tool mne_make_movie can be employed to interrogate the source estimate waveforms from labels (ROIs).

4. The mne_make_movie tool can be also used to create movies from stc ļ¬les and to resample stc ļ¬les in time.

5. The mne_compute_raw_inverse tool can be used to produce ļ¬f ļ¬les containing source estimates at selected ROIs. The input data ļ¬le can be

either a raw data or evoked response MEG/EEG ļ¬le, see Section 6.6.

6. Using the MNE Matlab toolbox, it is possible to perform many of the above operations in Matlab using your own Matlab code based on the

MNE Matlab toolbox. For more information on the MNE Matlab tool-

box, see Chapter 10.

7. It is also possible to average the source estimates across subjects as

described in Chapter 8.

38 MSH-MNE

4

C H A P T E R 4

Processing raw data

4.1 Overview

The raw data processor mne_browse_raw is designed for simple raw data viewing and processing operations. In addition, the program is capable of off-line averaging and estimation of covariance matrices.

mne_browse_raw can be also used to view averaged data in the topographical layout. Finally, mne_browse_raw can communicate with

mne_analyze described in Chapter 7 to calculate current estimates from

raw data interactively.

mne_browse_raw has also an alias, mne_process_raw. If

mne_process_raw is invoked, no user interface appears. Instead, command line options are used to specify the ļ¬ltering parameters as well as averaging and covariance-matrix estimation command ļ¬les for batch processing. This chapter discusses both mne_browse_raw and

mne_process_raw.

4.2 Command-line options

This section ļ¬rst describes the options common to mne_browse_raw and

mne_process_raw. Thereafter, options unique to the interactive

(mne_browse_raw) and batch (mne_process_raw) modes are listed.

4.2.1 Common options

--version

Show the program version and compilation date.

--help

List the command-line options.

--cd <dir>

Change to this directory before starting.

MSH-MNE 39

4

Processing raw data

--raw <name>

Speciļ¬es the raw data ļ¬le to be opened. This option is required for batch version, mne_process_raw. If a raw data ļ¬le is not speciļ¬ed for the interactive version, mne_browse_raw, and empty interactive browser will open.

--grad <number>

Apply software gradient compensation of the given order to the data loaded with the --raw option. This option is effective only for data acquired with the CTF and 4D Magnes MEG systems. If orders different from zero are requested for Neuromag data, an error message appears and data are not loaded. Any compensation already existing in the ļ¬le can be undone or changed to another order by using an appropriate --grad options. Possible orders are 0 (No compensation), 1 - 3 (CTF data), and 101 (Magnes data). The same compensation will be applied to all data ļ¬les loaded by mne_process_raw.

For mne_browse_raw, this applies only to the data ļ¬le loaded by specifying the --raw option. For interactive data loading, the software gradient compensation is speciļ¬ed in the corresponding ļ¬le

selection dialog, see Section 4.4.1.

--ļ¬ltersize <size>

Adjust the length of the FFT to be applied in ļ¬ltering. The number corresponding length of time is

s

, where

f s

is the sampling frequency of your data. The ļ¬ltering procedure includes overlapping tapers of length

2N

so that the total FFT length will actually be

. This value cannot be changed after the program has been started.

--highpass <value/Hz>

Highpass ļ¬lter frequency limit. If this is too low with respect to the selected FFT length and, the data will not be highpass ļ¬ltered. It is best to experiment with the interactive version to ļ¬nd the lowest applicable ļ¬lter for your data. This value can be adjusted in the interactive version of the program. The default is 0, i.e., no highpass ļ¬lter apart from that used during the acquisition will be in effect.

--highpassw <value/Hz>

The width of the transition band of the highpass ļ¬lter. The default is

6 frequency bins, where one bin is

f s

⁄ (

2N

)

. This value cannot be adjusted in the interactive version of the program.

--lowpass <value/Hz>

Lowpass ļ¬lter frequency limit. This value can be adjusted in the interactive version of the program. The default is 40 Hz.

40 MSH-MNE

MSH-MNE

Processing raw data

4

--lowpassw <value/Hz>

The width of the transition band of the lowpass ļ¬lter. This value can be adjusted in the interactive version of the program. The default is

5 Hz.

--ļ¬lteroff

Do not ļ¬lter the data. This initial value can be changed in the interactive version of the program.

--digtrig <name>

Name of the composite digital trigger channel. The default value is

‘STI 014’. Underscores in the channel name will be replaced by spaces.

--digtrigmask <number>

Mask to be applied to the trigger channel values before considering them. This option is useful if one wants to set some bits in a don’t care state. For example, some ļ¬nger response pads keep the trigger lines high if not in use, i.e., a ļ¬nger is not in place. Yet, it is convenient to keep these devices permanently connected to the acquisition system. The number can be given in decimal or hexadecimal format

(beginning with 0x or 0X). For example, the value 255 (0xFF) means that only the lowest order byte (usually trigger lines 1 - 8 or bits 0 - 7) will be considered.

Note: Multiple raw data ļ¬les can be speciļ¬ed for mne_process_raw.

Note: Strictly speaking, trigger mask value zero would mean that all trigger inputs are ignored. However, for convenience, setting the mask to zero or not setting it at all has the same effect as 0xFFFFFFFF, i.e., all bits set.

Tip: The digital trigger channel can also be set with the

MNE_TRIGGER_CH_NAME environment variable. Underscores in the variable value will not be replaced with spaces by mne_browse_raw or

mne_process_raw. Using the --digtrig option supersedes the

MNE_TRIGGER_CH_NAME environment variable.

Tip: The digital trigger channel mask can also be set with the

MNE_TRIGGER_CH_MASK environment variable. Using the -digtrigmask

option supersedes the MNE_TRIGGER_CH_MASK environment variable.

4.2.2 Interactive mode options

These options apply to the interactive (mne_browse_raw) version only.

41

4

Processing raw data

--allowmaxshield

Allow loading of unprocessed Elekta-Neuromag data with Max-

Shield on. These kind of data should never be used for source localization without further processing with Elekta-Neuromag software.

--deriv <name>

Speciļ¬es the name of a derivation ļ¬le. This overrides the use of a

standard derivation ļ¬le, see Section 4.4.12.

--sel <name>

Speciļ¬es the channel selection ļ¬le to be used. This overrides the use

of the standard channel selection ļ¬les, see Section 4.5.5.

4.2.3 Batch-mode options

These options apply to the batch-mode version, mne_process_raw only.

--proj <name>

Specify the name of the ļ¬le of the ļ¬le containing a signal-space projection (SSP) operator. If --proj options are present the data ļ¬le is not consulted for an SSP operator. The operator corresponding to average EEG reference is always added if EEG data are present.

--projon

Activate the projections loaded. One of the options --projon or -

-projoff

must be present on the mne_processs_raw command line.

--projoff

Deactivate the projections loaded. One of the options --projon or

--projoff

must be present on the mne_processs_raw command line.

--makeproj

Estimate the noise subspace from the data and create a new signalspace projection operator instead of using one attached to the data ļ¬le or those speciļ¬ed with the --proj option. The following eight options deļ¬ne the parameters of the noise subspace estimation.

More information on the signal-space projection can be found in

Section 4.16.

--projtmin <time/s>

Specify the beginning time for the calculation of the covariance matrix which serves as the basis for the new SSP operator. If this time is not speciļ¬ed, it defaults to the beginning of the raw data ļ¬le.

This option is effective only if --makeproj or --saveprojtag options are present.

42 MSH-MNE

MSH-MNE

Processing raw data

4

--projtmax <time/s>

Specify the ending time for the calculation of the covariance matrix which serves as the basis for the new SSP operator. If this time is not speciļ¬ed, it defaults to the end of the raw data ļ¬le. This option is effective only if --makeproj or --saveprojtag options are present.

--projngrad <number>

Number of SSP components to include for planar gradiometers

(default = 5). This value is system dependent. For example, in a well-shielded quiet environment, no planar gradiometer projections are usually needed.

--projnmag <number>

Number of SSP components to include for magnetometers / axial gradiometers (default = 8). This value is system dependent. For example, in a well-shielded quiet environment, 3 – 4 components are need while in a noisy environment with light shielding even more than 8 components may be necessary.

--projgradrej <value/ fT/cm>

Rejection limit for planar gradiometers in the estimation of the covariance matrix from which the new SSP operator is derived. The default value is 2000 fT/cm. Again, this value is system dependent.

--projmagrej <value/ fT>

Rejection limit for planar gradiometers in the estimation of the covariance matrix from which the new SSP operator is derived. The default value is 3000 fT. Again, this value is system dependent.

--saveprojtag <tag>

This option deļ¬nes the names of ļ¬les to hold the SSP operator. If this option is present the --makeproj option is implied. The SSP operator ļ¬le name is formed by removing the trailing .fif or

_raw.fif

from the raw data ļ¬le name by appending <tag>.ļ¬f to this stem. Recommended value for <tag> is -proj.

--saveprojaug

Specify this option if you want to use the projection operator ļ¬le output in the Elekta-Neuromag Signal processor (graph) software.

--eventsout <name>

List the digital trigger channel events to the speciļ¬ed ļ¬le. By default, only transitions from zero to a non-zero value are listed. If multiple raw data ļ¬les are speciļ¬ed, an equal number of --eventsout

options should be present. If the ļ¬le name ends with .ļ¬f, the output will be in ļ¬f format, otherwise a text event ļ¬le will be output.

--allevents

List all transitions to ļ¬le speciļ¬ed with the --eventsout option.

43

4

Processing raw data

--events <name>

Speciļ¬es the name of a ļ¬f or text format event ļ¬le (see

Section 4.10.5) to be associated with a raw data ļ¬le to be processed.

If multiple raw data ļ¬les are speciļ¬ed, the number of --events options can be smaller or equal to the number of raw data ļ¬les. If it is equal, the event ļ¬lenames will be associated with the raw data ļ¬les in the order given. If it is smaller, the remaining raw data ļ¬les for which an event ļ¬le is not speciļ¬ed will not have an event ļ¬le associated with them. The event ļ¬le format is recognized from the ļ¬le name: if it ends with .fif, the ļ¬le is assumed to be in ļ¬f format, otherwise a text ļ¬le is expected.

--ave <name>

Speciļ¬es the name of an off-line averaging description ļ¬le. For

details of the format of this ļ¬le, please consult Section 4.13. If mul-

tiple raw data ļ¬les are speciļ¬ed, the number of --ave options can be smaller or equal to the number of raw data ļ¬les. If it is equal, the averaging description ļ¬le names will be associated with the raw data ļ¬les in the order given. If it is smaller, the last description ļ¬le will be used for the remaining raw data ļ¬les.

--saveavetag <tag>

If this option is present and averaging is evoked with the --ave option, the outļ¬le and logļ¬le options in the averaging description ļ¬le are ignored. Instead, trailing .fif or _raw.fif is removed from the raw data ļ¬le name and <tag>.fif or <tag>.log is appended to create the output and log ļ¬le names, respectively.

--gave <name>

If multiple raw data ļ¬les are speciļ¬ed as input and averaging is requested, the grand average over all data ļ¬les will be saved to

<name>.

--cov <name>

Specify the name of a description ļ¬le for covariance matrix estima-

tion. For details of the format of this ļ¬le, please see Section 4.14. If

multiple raw data ļ¬les are speciļ¬ed, the number of --cov options can be smaller or equal to the number of raw data ļ¬les. If it is equal, the averaging description ļ¬le names will be associated with the raw data ļ¬les in the order given. If it is smaller, the last description ļ¬le will be used for the remaining raw data ļ¬les.

--savecovtag <tag>

If this option is present and covariance matrix estimation is evoked with the --cov option, the outļ¬le and logļ¬le options in the covariance estimation description ļ¬le are ignored. Instead, trailing .fif

or _raw.fif is removed from the raw data ļ¬le name and <tag>.ļ¬f or <tag>.log is appended to create the output and log ļ¬le names, respectively. For compatibility with other MNE software scripts, -savecovtag -cov

is recommended.

44 MSH-MNE

MSH-MNE

Processing raw data

4

--savehere

If the --saveavetag and --savecovtag options are used to generate the ļ¬le output ļ¬le names, the resulting ļ¬les will go to the same directory as raw data by default. With this option the output ļ¬les will be generated in the current working directory instead.

--gcov <name>

If multiple raw data ļ¬les are speciļ¬ed as input and covariance matrix estimation is requested, the grand average over all data ļ¬les will be saved to <name>. The details of the covariance matrix esti-

mation are given in Section 4.17.

--save <name>

Save a ļ¬ltered and optionally down-sampled version of the data ļ¬le to <name>. If multiple raw data ļ¬les are speciļ¬ed, an equal number of --save options should be present. If <ļ¬lename> ends with

.fif

or _raw.fif, these endings are deleted. After these modiļ¬cations, _raw.fif is inserted after the remaining part of the ļ¬le name. If the ļ¬le is split into multiple parts (see --split option below), the additional parts will be called <name>-<num-

ber>_raw.fif

--split <size/MB>

Speciļ¬es the maximum size of the raw data ļ¬les saved with the -save

option. By default, the output is split into ļ¬les which are just below 2 GB so that the ļ¬f ļ¬le maximum size is not exceed.

--anon

Do not include any subject information in the output ļ¬les created with the --save option.

--decim <number>

The data are decimated by this factor before saving to the ļ¬le speciļ¬ed with the --save option. For decimation to succeed, the data must be lowpass ļ¬ltered to less than third of the sampling frequency effective after decimation.

45

4

Processing raw data

4.3 The user interface

1.

2.

3.

4

Figure 4.1 The user interface of mne_browse_raw

The mne_browse_raw user interface contains the following areas:

1. The menu bar.

2. The data display area.

3. Viewing and averaging tools.

4. Message line.

The viewing and averaging tools allow quick browsing of the raw data with triggers, adding new triggers, and averaging on a single trigger.

46 MSH-MNE

4.4 The File menu

Processing raw data

4

MSH-MNE

Figure 4.2 The contents of the File menu.

The File menu pane is shown in Figure 4.2.

4.4.1 Open

Selecting Open from ļ¬le menu pops up the dialog shown in Figure 4.3.

The Raw ļ¬les and Maxļ¬lter output buttons change the ļ¬le name ļ¬lter to include names which end with _raw.fif or sss.fif, respectively, to facilitate selection of original raw ļ¬les or those processed with the Neuromag Maxļ¬lter™ software

The options under Software gradient compensation allow selection of the compensation grade for the data. These selections apply to the CTF data only. The standard choices are No compensation and Third-order gradient.

If other than No compensation is attempted for non-CTF data, an error will be issued. The compensation selection affects the averages and noisecovariance matrices subsequently computed. The desired compensation takes effect independent of the compensation state of the data in the ļ¬le,

i.e., already compensated data can be uncompensated and vice versa. For more information on software gradient compensation please consult

Section 9.2.4.

The Keep the initial skip button controls how the initial segment of data not stored in the raw data ļ¬le is handled. During the MEG acquisition data are collected continuously but saving to the raw data ļ¬le is controlled by the Record raw button. Initial skip refers to the segment of data between the start of the recording and the ļ¬rst activation of Record raw. If Keep

initial skip

is set, this empty segment is taken into account in timing, otherwise time zero is set to the beginning of the data stored to disk.

47

4

Processing raw data

When a raw data ļ¬le is opened, the digital trigger channel is scanned for events. For large ļ¬les this may take a while.

Note: After scanning the trigger channel for events, mne_browse_raw and

mne_process_raw produce a ļ¬f ļ¬le containing the event information. This ļ¬le will be called <raw data ļ¬le name without ļ¬f extension>-eve.fif.

If the same raw data ļ¬le is opened again, this ļ¬le will be consulted for event information thus making it unnecessary to scan through the ļ¬le for trigger line events.

Tip: You can produce the ļ¬f event ļ¬le by running mne_process_raw as follows: mne_process_raw --raw <raw data ļ¬le>. The ļ¬f format event ļ¬les can be read and written with the mne_read_events and

mne_write_events functions in the MNE Matlab toolbox, see Chapter 10.

48

Figure 4.3 The Open dialog.

4.4.2 Open evoked

This menu item brings up a standard ļ¬le selection dialog to load evokedresponse data from ļ¬les. All data sets from a ļ¬le are loaded automatically

and display in the average view window, see Section 4.12. The data

loaded are affected by the scale settings, see, Section 4.5.2, the ļ¬lter, see

MSH-MNE

MSH-MNE

Processing raw data

4

Section 4.5.1, and the options selected in the Manage averages dialog, see

Section 4.15.

4.4.3 Save

It is possible to save ļ¬ltered and projected data into a new raw data ļ¬le.

When you invoke the save option from the ļ¬le menu, you will be prompted for the output ļ¬le name and a down-sampling factor. The sampling frequency after down-sampling must be at least three times the lowpass ļ¬lter corner frequency. The output will be split into ļ¬les which are just below 2 GB so that the ļ¬f ļ¬le maximum size is not exceed.

If <ļ¬lename> ends with .fif or _raw.fif, these endings are deleted.

After these modiļ¬cations, _raw.fif is inserted after the remaining part of the ļ¬le name. If the ļ¬le is split into multiple parts, the additional parts will be called <name>-<number>_raw.fif. For downsampling and

saving options in mne_process_raw, see Section 4.2.3.

4.4.4 Change working directory

Brings up a ļ¬le selection dialog which allows changing of the working directory.

4.4.5 Read projection

Selecting Read projection... from the File menu, pops up a dialog to enter a name of a ļ¬le containing a signal-space projection operator to be applied to the data. There is an option to keep existing projection items.

Note: Whenever EEG channels are present in the data, a projection item corresponding to the average EEG reference is automatically added.

4.4.6 Save projection

The Save projection... item in the File menu pops up a dialog to save the present projection operator into a ļ¬le. Normally, the EEG average reference projection is not included. If you want to include it, mark the Include

EEG average reference

option. If your MEG projection includes items for both magnetometers and gradiometers and you want to use the projection operator ļ¬le output from here in the Neuromag Signal processor (graph) software, mark the Enforce compatibility with graph option.

49

4

Processing raw data

4.4.7 Apply bad channels

Applies the current selection of bad channels to the currently open raw ļ¬le.

4.4.8 Load events (text)

Reads a text format event ļ¬le. For more information on events, see

Section 4.10.

4.4.9 Load events (fif)

Reads a ļ¬f format event ļ¬le. For more information on events, see

Section 4.10.

4.4.10 Save events (text)

Brings up a a dialog to save all or selected types of events into a text ļ¬le.

This ļ¬le can be edited and used in the averaging and covariance matrix estimation as an input ļ¬le to specify the time points of events, see

Section 4.10.5. For more information on events, see Section 4.10.

4.4.11 Save events (fif)

Save the events in ļ¬f format. These binary event ļ¬les can be read and written with the mne_read_events and mne_write_events functions in the

MNE Matlab toolbox, see Chapter 10.For more information on events, see

Section 4.10.

4.4.12 Load derivations

This menu choice allows loading of channel derivation data ļ¬les created

with the mne_make_derivations utility, see Section 11.5, or using the

interactive derivations editor in mne_browse_raw, see Section 4.5.4, Most

common use of derivations is to calculate differences between EEG channels, i.e., bipolar EEG data. Since any number of channels can be included in a derivation with arbitrary weights, other applications are possible as well. Before a derivation is accepted to use, the following criteria have to be met:

50 MSH-MNE

MSH-MNE

Processing raw data

4

1. All channels to be combined into a single derivation must have identical units of measure.

2. All channels in a single derivation have to be of the same kind, e.g.,

MEG channels or EEG channels.

3. All channels speciļ¬ed in a derivation have to be present in the currently loaded data set.

Multiple derivation data ļ¬les can be loaded by specifying the Keep previ-

ous derivations option in the dialog that speciļ¬es the derivation ļ¬le to be loaded. After a derivation ļ¬le has been successfully loaded, a list of available derivations will be shown in a message dialog.

Each of the derived channels has a name speciļ¬ed when the derivation ļ¬le was created. The derived channels can be included in channel selections,

see Section 4.5.5. At present, derived channels cannot be displayed in

topographical data displays. Derived channels are not included in averages or noise covariance matrix estimation.

Note: If the ļ¬le $HOME/.mne/mne_browse_raw-deriv.fif exists and contains derivation data, it is loaded automatically when

mne_browse_raw starts unless the --deriv option has been used to

specify a nonstandard derivation ļ¬le, see Section 4.2.2.

4.4.13 Save derivations

Saves the current derivations into a ļ¬le.

4.4.14 Load channel selections

This choice loads a new set of channel selections. The default directory for the selections is $HOME/.mne. If this directory does not exist, it will be created before bringing up the ļ¬le selection dialog to load the selections.

4.4.15 Save channel selections

This choice brings up a dialog to save the current channel selections. This is particularly useful if the standard set of selections has been modiļ¬ed as

explained in Section 4.5.5. The default directory for the selections is

$HOME/.mne. If this directory does not exist, it will be created before bringing up the ļ¬le selection dialog to save the selections. Note that all currently existing selections will be saved, not just those added to the ones initially loaded.

51

4

Processing raw data

4.4.16 Quit

Exits the program without questions asked.

4.5 The Adjust menu

Figure 4.4 The contents of the Adjust menu.

The contents of the Adjust menu is shown in Figure 4.4. This menu allows

the manipulation of various settings of the program,

4.5.1 Filter

Selecting Filter... from the Adjust menu pops up the dialog shown in

Figure 4.5.

52

Figure 4.5 The ļ¬lter adjustment dialog.

The items in the dialog have the following functions:

Highpass (Hz)

The half-amplitude point of the highpass ļ¬lter. The width of the transition from zero to one can be speciļ¬ed with the --highpassw

command-line option, see Section 4.2. Lowest feasible

highpass value is constrained by the length of the ļ¬lter and sampling frequency. You will be informed when you press OK or Apply if the

MSH-MNE

Processing raw data

4

selected highpass could not be realized. The default value zero means no highpass ļ¬lter is applied in addition to the analog highpass present in the data.

Lowpass (Hz)

The half-amplitude point of the lowpass ļ¬lter.

Lowpass transition (Hz)

The width of the cos

2

-shaped transition from one to zero, centered at the Lowpass value.

Filter active

Selects whether or not the ļ¬lter is applied to the data.

The ļ¬lter is realized in the frequency domain and has a zero phase shift.

When a ļ¬lter is in effect, the value of the ļ¬rst sample in the ļ¬le is subtracted from the data to correct for an initial dc offset. This procedure also eliminates any ļ¬lter artifacts in the beginning of the data.

Note: The ļ¬lter affects both the raw data and evoked-response data loaded from ļ¬les. However, the averages computed in mne_browse_raw and shown in the topographical display are not reļ¬ltered if the ļ¬lter is changed after the average was computed.

4.5.2 Scales

Selecting Scales... from the Adjust menu pops up the dialog shown in

Figure 4.6.

MSH-MNE

Figure 4.6 The Scales dialog.

53

4

Processing raw data

The items in the dialog have the following functions:

MEG (fT/cm)

Sets the scale for MEG planar gradiometer channels in fT/cm. All scale values are deļ¬ned from zero to maximum, i.e., the viewport where signals are plotted in have the limits ±<scale value>.

MEG axmult (cm)

The scale for MEG magnetometers and axial gradiometers is deļ¬ned by multiplying the gradiometer scale by this number, yielding units of fT.

EEG (

µV

)

The scale for EEG channels in

µV

.

EOG (

µV

)

The scale for EOG channels in

µV

.

ECG (mV)

The scale for ECG channels in mV.

EMG (mV)

The scale for EMG channels in mV.

MISC (V)

The scale for MISC channels in V.

Time span (s)

The length of raw data displayed in the main window at a time.

Show stimulus markers

Draw vertical lines at time points where the digital trigger channel has a transition from zero to a nonzero value.

Segment min. time (s)

It is possible to show data segments in the topographical (full view) layout, see below. This parameter sets the starting time point, relative to the selected time, to be displayed.

Segment max. time (s)

This parameter sets the ending time point, relative to the current time, to be displayed in the topographical layout.

Show segments in full view

Switches on the display of data segments in the topographical layout.

Show segments in sample view

Switches on the display of data segments in a “sidebar” to the right of the main display.

54 MSH-MNE

MSH-MNE

Processing raw data

4

Show channel names

Show the names of the channels in the topographical displays.

Text size

Size of the channel number text as a fraction of the height of each viewport.

Show viewport frames

Show the boundaries of the viewports in the topographical displays.

Show zeroline and zerolevel

Show the zero level, i.e., the baseline level in the topographical displays. In addition, the zero time point is indicated in the average views if it falls to the time range, i.e., if the minimum of the time scale is negative and the maximum is positive.

Scale magniļ¬cation for averages

For average displays, the scales are made more sensitive by this factor.

Average display baseline min (ms)

Sets the lower time limit for the average display baseline. This setting does not affect the averages stored.

Average display baseline max (ms)

Sets the upper time limit for the average display baseline. This setting does not affect the averages stored.

Use average display baseline

Switches the application of a baseline to the displayed averages on and off.

Average time range min (ms)

Sets the minimum time for the average display. This setting is inactive if Autoscale time range is on.

Average time range max (ms)

Sets the maximum time for the average data display. This setting is inactive if Autoscale time range is on.

Autoscale time range

Set the average display time range automatically to be long enough to accommodate all data.

4.5.3 Colors

Shows a dialog which allows changes to the default colors of various display items.

55

4

Processing raw data

4.5.4 Derivations

Brings up the interactive derivations editor. This editor can be used to add or modify derived channels, i.e., linear combinations of signals actually recorded. Channel derivations can be also created and modiļ¬ed using the

mne_make_derivations tool, see Section 11.5. The interactive editor con-

tains two main areas:

1. Interactive tools for specifying a channel linear combination. This tool is limited to combining up to ļ¬ve channels in each of the derivations.

Clicking Add after deļ¬ning the name of the new derivation, the weights of the component channels and their names, adds the corresponding arithmetic expression to the text area.

2. Text area which contains the currently deļ¬ned derivations as arithmetic expressions in a format identical to that used by

mne_make_derivations. These expressions can be manually edited before accepting the new set of derivations. Initially, the text area will contain the derivations already deļ¬ned.

The Deļ¬ne button interprets the arithmetic expressions in the text area as new derivations and closes the dialog. The Cancel button closes the dialog without any change in the derivations.

Recommended workļ¬‚ow for deļ¬ning derived EEG channels and associated selections interactively involves the following steps:

1. If desired, EEG channels can be relabeled with descriptive names using

the mne_rename_channels utility, see Section 11.4.5. It is strongly rec-

ommended that you keep a copy of the channel alias ļ¬le used by

mne_rename_channels. If necessary, you can then easily return to the original channel names by running mne_rename_channels again with the --revert option.

2. Load the data ļ¬le into mne_browse_raw and use the interactive derivations editor to create the desired derived channels. These are usually differences between the signals in two EEG electrodes.

3. Save the derivations from the ļ¬le menu.

4. If desired, move the derivations ļ¬le to the standard location ($HOME/

.mne/mne_browse_raw-deriv.fif

).

5. Create new channel selections employing the original and derived

channels using the channel selection tool described in Section 4.5.5.

6. Save the new channel selections from the ļ¬le menu.

7. If desired, change the order of the channels in the selections in the selection ļ¬le by editing it in a text editor and move it to the standard location $HOME/.mne/mne_browse_raw.sel.

56 MSH-MNE

MSH-MNE

Processing raw data

4

4.5.5 Selection

Brings up a dialog to select channels to be shown in the main raw data display. This dialog also allows modiļ¬cation of the set of channel selections as described below.

By default, the available selections are deļ¬ned by the ļ¬le $MNE_ROOT/ setup/mne/mne_browse_raw/mne_browse_raw.sel

. This default channel selection ļ¬le can be modiļ¬ed by copying the ļ¬le into

$HOME/.mne/mne_browse_raw.sel

. The format of this text ļ¬le should be self explanatory.

The channel selection dialog is shown in Figure 4.7. The number of items

in the selection list depends on the contents of your selection ļ¬le. If the list has the keyboard focus you can easily move from one selection to another with the up and down arrow keys.

The two buttons below the channel selection buttons facilitate the modiļ¬cation of the selections:

Add...

Brings up the selection dialog shown in Figure 4.8 to create new

channel selections.

Omit current

Delete the current channel selection. Deletion only affects the selections in the memory of the program. To save the changes permanently into a ļ¬le, use Save channel selections... in the File menu, see

Section 4.4.15.

57

4

Processing raw data

58

Figure 4.7 The channel selection dialog.

The components of the selection creation dialog shown in Figure 4.8 have

the following functions:

List of channel names

The channels selected from this list will be included in the new channel selection. A selection can be extended with the control key.

A range of channels can be selected with the shift key. The list contains both the original channels actually present in the ļ¬le and the names of the channels in currently loaded derivation data, see

Section 4.4.12.

Regexp:

This provides another way to select channels. By entering here a regular expression as deļ¬ned in IEEE Standard 1003.2 (POSIX.2), all channels matching it will be selected and added to the present selection. An empty expression deselects all items in the channel

list. Some useful regular expressions are listed in Table 4.1. In the

present version, regular matching does not look at the derived channels.

Name:

This text ļ¬eld speciļ¬es the name of the new selection.

MSH-MNE

Processing raw data

4

Select

Select the channels speciļ¬ed by the regular expression. The same effect can be achieved by entering return in the Regexp:.

Add

Add a new channel selection which contains the channels selected from the channel name list. The name of the selection is speciļ¬ed with the Name: text ļ¬eld.

MSH-MNE

Figure 4.8 Dialog to create a new channel selection.

Regular expression

MEG

EEG

Meaning

Selects all MEG channels.

Selects all EEG channels.

Table 4.1 Examples of regular expressions for channel selections

59

4

Processing raw data

Regular expression

MEG.*1$

MEG.*[2,3]$

EEG|STI 014

^M

Meaning

Selects all MEG channels whose names end with the number 1, i.e., all magnetometer channels.

Selects all MEG gradiometer channels.

Selects all EEG channels and stimulus channel STI 014.

Selects all channels whose names begin with the letter M.

Table 4.1 Examples of regular expressions for channel selections

Note: The interactive tool for creating the channel selections does not allow you to change the order of the selected channels from that given by the list of channels. However, the ordering can be easily changed by manually editing the channel selection ļ¬le in a text editor.

60

4.5.6 Full view layout

Shows a selection of available layouts for the topographical views (full view and average display). The system-wide layout ļ¬les reside in

$MNE_ROOT/setup/mne_analyze/lout

. In addition any layout ļ¬les residing in $HOME/.mne/lout are listed. The default layout is

Vectorview-grad. If there is a layout ļ¬le in the user’s private layout directory ending with -default.lout, that layout will be used as the default instead. The Default button returns to the default layout.

The format of the layout ļ¬les is:

<plot area limits>

<viewport deļ¬nition #1>

...

<viewport deļ¬nition #N>

The <plot area limits> deļ¬ne the size of the plot area (

y

max

x

min

x

max

y

min

) which should accommodate all view ports. When the layout is used, the plot area will preserve its aspect ratio; if the plot window has a different aspect ratio, there will be empty space on the sides.

The viewports deļ¬ne the locations of the individual channels in the plot.

Each viewport deļ¬nition consists of

<number>

x

0

y

0

<width> <height> < name>[:<name>]...

where number is a viewport number (not used by the MNE software),

y

0

x

0 and are the coordinates of the lower-left corner of the viewport,

MSH-MNE

MSH-MNE

Processing raw data

4

<width> and <height> are the viewport dimensions, and <name> is a name of a channel. Multiple channel names can be speciļ¬ed by separating them with a colon.

When a measurement channel name is matched to a layout channel name, all spaces are removed from the channel names and the both the layout channel name and the data channel name are converted to lower case. In addition anything including and after a hyphen (-) is omitted. The latter convention facilitates using CTF MEG system data, which has the serial number of the system appended to the channel name with a dash.

Removal of the spaces is important for the Neuromag Vectorview data because newer systems do not have spaces in the channel names like the original Vectorview systems did.

Tip: The mne_make_eeg_layout utility can be employed to create a layout

ļ¬le matching the positioning of EEG electrodes, see Section 11.6.

4.5.7 Projection

Lists the currently available signal-space projection (SSP) vectors and allows the activation and deactivation of items. For more information on

SSP, see Section 4.16.

4.5.8 Compensation

Brings up a dialog to select software gradient compensation. This over-

rides the choice made at the open time. For details, see Section 4.4.1,

above.

61

4

Processing raw data

4.5.9 Averaging preferences

62

Figure 4.9 Averaging preferences.

Selecting Averaging preferences... from the Adjust menu pops up the dia-

log shown in Figure 4.9. These settings apply only to the simple averages

calculated with help of tools residing just below the main raw data dis-

play, see Section 4.11.

The items in the dialog have the following functions:

Starting time (ms)

Beginning time of the epoch to be averaged (relative to the trigger).

Ending time (ms)

Ending time of the epoch to be averaged.

MEG grad rejection (fT/cm)

Rejection criterion for MEG planar gradiometers. If the peak-topeak value of any planar gradiometer epoch exceed this value, it will be omitted. A negative value turns off rejection for a particular channel type.

MEG mag rejection (fT)

Rejection criterion for MEG magnetometers.

Rejection criterion for EEG channels.

Rejection criterion for EOG channels.

MSH-MNE

Processing raw data

4

ECG rejection (mV)

Rejection criterion for ECG channels.

Trace color

The color assigned for the averaged traces in the display can be adjusted by pressing this button.

4.6 The Process menu

Figure 4.10 The contents of the Process menu.

The contents of the Process menu is shown in Figure 4.10. This menu

accesses the following operations:

1. Averaging according to a description ļ¬le,

2. Estimation of a covariance matrix according to a description ļ¬le,

3. Estimation of a covariance matrix from continuous raw data, and

4. Estimation of the noise subspace for SSP.

4.6.1 Averaging

The Average... menu item pops up a ļ¬le selection dialog to access a description ļ¬le for batch-mode averaging. The structure of these ļ¬les is

described in Section 4.13. All parameters for the averaging are taken from

the description ļ¬le, i.e., the parameters set in the averaging preferences

dialog (Section 4.5.9) do not effect the result.

4.6.2 Estimation of a covariance matrix

The Compute covariance... menu item pops up a ļ¬le selection dialog to access a description ļ¬le which speciļ¬es the options for the estimation of a

covariance matrix. The structure of these ļ¬les is described in Section 4.14.

MSH-MNE

4.6.3 Estimation of a covariance matrix from raw data

The Compute raw data covariance... menu item pops up a dialog which speciļ¬es a time range for raw data covariance matrix estimation and the ļ¬le to hold the result. If a covariance matrix is computed in this way, the rejection parameters speciļ¬ed in averaging preferences are in effect. For

description of the rejection parameters, see Section 4.5.9. The time range

63

4

Processing raw data can be also selected interactively from the main raw data display by doing a range selection with shift left button drag.

4.6.4 Creating a new SSP operator

The Create a new SSP operator... menu choice computes a new SSP oper-

ator as discussed in Section 4.16.2. This process involves the following

steps:

1. Calculate a covariance matrix from either a long continuous segment of raw data or concatenated short epochs time locked to an event.

2. Pick two diagonal blocks from this matrix, corresponding to planar gradiometers and magnetometers/axial gradiometers.

3. Compute the eigenvalue decompositions of these two matrices.

4. Interactively pick the basis for the noise subspace from the new basis vectors created and the existing ones.

64

Figure 4.11 Time range speciļ¬cation for SSP operator calculation

When Create a new SSP operator... selected, a window shown in

Figure 4.11 is popped up. It allows the speciļ¬cation of a time range to be

employed in the calculation of a raw data covariance matrix. The time range can be also selected interactively from the main raw data display by doing a range selection with shift left button drag. Normally, you should use empty room data for this computation. For the estimation of the covariance matrix any existing projection will be temporarily switched off.

Remember to inspect your data for bad channels and select an appropriate ļ¬lter setting before creating a new SSP operator. It is usually desirable to employ a generous passband.

Instead of using continuous raw data, it is also possible to employ short epochs around triggers (events) in the calculation of the new SSP operator by specifying a positive event number in the time speciļ¬cation dialog.

This option is very useful, e.g., to remove MCG artifacts from the data to facilitate detection of epileptic spikes:

1. Select left or right temporal channels to the display.

2. Mark several peaks of the MCG signal in the data: click on the ļ¬rst one and control click on the subsequent ones to extend the selection.

MSH-MNE

Processing raw data

4

3. Select an event number next to the Picked to button in the tool bar, see

Section 4.11, and click Picked to. As a result the lines marking the

events will change color (by default from green to blue) indicating transition to user-created events.

4. Specify an epoch time range to be employed and the event number selected in the previous step for the SSP operator calculation.

Once the covariance matrix is ready, the parts corresponding to magnetometer or axial gradiometer and planar gradiometer channels are separated and the corresponding eigenvectors and eigenvalues are computed.

Once complete, a projection selector with eight magnetometer eigenvectors and ļ¬ve planar gradiometer eigenvectors as well as the existing projection items is displayed.

Using the projection selector, you can experiment which vectors have a signiļ¬cant effect on the noise level of the data. You should strive for using a minimal number of vectors. When the selection is complete, you can click Accept to introduce this selection of vectors as the new projection operator. Discard abandons the set of calculated vectors. Whenever EEG channels are present in the data, a projection item corresponding to the average EEG reference is automatically added when a new projection operator is introduced. More information on the SSP method can be found

in Section 4.16.

Note: The new projection data created in mne_browse_raw is not automatically copied to the data ļ¬le. You need to create a standalone projection ļ¬le from File/Save projection... to save the new projection data and load it manually after the data ļ¬le has been loaded if you want to include in any subsequent analysis.

Tip: The command-line options for mne_process_raw allow calculation of the SSP operator from continuous data in the batch mode, see

Section 4.2.3.

4.7 The Windows menu

MSH-MNE

Figure 4.12 The Windows menu.

The Windows menu shown in Figure 4.12 contains the following items

65

4

Processing raw data

Show full view...

Brings up the topographical display of epochs extracted from the

raw data, see Section 4.12.

Show averages...

Brings up the topographical display showing averaged data. These data may include data averaged in the current mne_browse_raw ses-

sion or those loaded from ļ¬les, see Section 4.4.2.

Show event list...

Brings up a window containing a list of the currently deļ¬ned events.

Clicking on an event in the list, the event is selected, a green cursor appears at the event, and the event is brought to the middle of the raw data display. The event list displayed can be also restricted to user-deļ¬ned events (annotations) and user-deļ¬ned events can be

deleted. For further information, see Section 4.10.

Show annotator...

Brings up a window which allows adding new events to the data

with annotations or comments. For details, see Section 4.10.

Manage averages...

Brings up a dialog to control the averaged data sets, see

Section 4.15.

Start mne_analyze...

Start interaction between mne_browse_raw and mne_analyze . For

details, see Section 4.18.

Quit mne_analyze...

Quits the mne_analyze program started with Start mne_analyze...

4.8 The Help menu

The contents of the Help menu is shown in Figure 4.13:

66

Figure 4.13 The Help menu.

On version...

Displays the version and compilation date of the program.

MSH-MNE

MSH-MNE

Processing raw data

4

On license...

Displays the license information.

About current data...

Displays essential information about the currently loaded data set.

Why the beep?

In some simple error situations, mne_browse_raw does not pop up an error dialog but refuses the action and rings the bell. The reason for this can be displayed through this help menu item.

4.9 The raw data display

The main data displays shows a section of the raw data in a strip-chart recorder format. The names of the channels displayed are shown on the left. The selection of channels is controlled from the selection dialog, see

Section 4.5.5. The length of the data section displayed is controlled from

the scales dialog (Section 4.5.2) and the ļ¬ltering from the ļ¬lter dialog

(Section 4.5.1). A signal-space projection can be applied to the data by

loading a projection operator (Section 4.4.5). The selection of the projec-

tion operator items is controlled from the projection dialog described in

Section 4.5.7.

The control and browsing functions of the main data display are:

Selection of bad channels

If you click on a channel name the corresponding channel is marked bad or reinstated as an acceptable one. A channel marked bad is not considered in the artefact rejection procedures in averaging and it is omitted from the signal-space projection operations.

Browsing

Browsing through the data. The section of data displayed can be selected from the scroll bar at the bottom of the display. Additional browsing functionality will be discussed n In addition, if the stripchart display has the keyboard focus, you can scroll back and forth with the page up and page down keys.

Selection of time points

When you click on the data with the left button, a vertical marker appears. If Show segments in full view and/or Show segments in

sample view

is active in the scales dialog (see Section 4.5.2), a dis-

play of an epoch of data speciļ¬ed in the scales dialog will appear.

For more information on full view, see Section 4.12. Multiple time

points can be selected by holding the control key down when clicking. If multiple time points are selected several samples will be shown in the sample and/or full view, aligned at the picked time

67

4

Processing raw data point. The tool bar offers functions to operate on the selected time

points, see Section 4.11.

Range selection

Range selection. If you drag on the signals with the left mouse button and the shift key down, a range of times will be selected and displayed in the sample and/or full view. Note: All previous selections are cleared by this operation.

Saving a copy of the display

The right mouse button invokes a popup menu which allows saving of the display in various formats. Best quality is achieved with the

Illustrator format. This format has the beneļ¬t that it is object oriented and can be edited in Adobe Illustrator.

Drag and drop

Graphics can be moved to one of the Elekta-Neuromag report composer (cliplab) view areas with the middle mouse button.

Note: When selecting bad channels, switch the signal-space projection off from the projection dialog. Otherwise bad channels may not be easily recognizable.

Note: The cliplab drag-and-drop functionality requires that you have the proprietary Elekta-Neuromag analysis software installed.

mne_browse_raw is compatible with cliplab versions 1.2.13 and later.

4.9.1 Browsing data

If the strip-chart display has the input focus (click on it, if you are unsure) the keyboard and mouse can be used to browse the data as follows:

Up and down arrow keys

Activate the previous or next selection in the selection list.

Left and right arrow keys

If a single time point is selected (green line), move the time point forward and backward by point is moved by

±

10ms

±

1ms

. If the shift key is down, the time

. If the control key is down (with or without shift), the time point is moved by

±

100ms

. If mne_browse_raw

is controlling mne_analyze (see Section 4.18), the mne_analyze dis-

plays will be updated accordingly. If the picked time point falls outside the currently displayed section of data, the display will be automatically scrolled backwards or forwards as needed.

Rotate the mouse wheel or rotate the trackball up/down

Activate the previous or next selection in the selection list.

68 MSH-MNE

Processing raw data

4

Rotate the trackball left/right or rotate the wheel with shift down

Scroll backward or forward in the data by one screen. With Alt key

(Command or Apple key in the Mac keyboard), the amount of scrolling will be

1s

instead of the length of one screen. If shift key is held down with the trackball, both left/right and up/down movements scroll the data in time.

Note: The trackball and mouse wheel functionality is dependent on your

X server settings. On Mac OSX these settings are normally correct by default but on a LINUX system some adjustments to the X server settings maybe necessary. Consult your system administrator or Google for details.

MSH-MNE

4.10 Events and annotations

4.10.1 Overview

In mne_browse_raw and mne_process_raw events mark interesting time points in the data. When a raw data ļ¬le is opened, a standard event ļ¬le is consulted for the list of events. If this ļ¬le is not present, the digital trigger channel, deļ¬ned by the --digtrig option or the MNE_TRIGGER_CH_NAME environment variable is scanned for events. For more information, see

Sections 4.2.1 and 4.4.1.

In addition to the events detected on the trigger channel, it is possible to associate user-deļ¬ned events to the data, either by marking data points

interactively as described in Section 4.10.4 or by loading event data from

ļ¬les, see Section 4.10.3. Especially if there is a comment associated with

a user-deļ¬ned event, we will sometimes call it an annotation.

If a data ļ¬les has annotations (user-deļ¬ned events) associated with it in

mne_browse_raw, information about them is automatically saved to an

annotation ļ¬le when a data ļ¬le is closed, i.e., when you quit

mne_browse_raw or load a new data ļ¬le. This annotation ļ¬le is called

<raw data ļ¬le name without ļ¬f extension>-annot.fif and will be stored in the same directory as the raw data ļ¬le. Therefore, write permission to this directory is required to save the annotation ļ¬le.

Both the events deļ¬ned by the trigger channel and the user-deļ¬ned events have three properties:

1. The time when the event occurred.

2. The value on the trigger channel just before the change and now. For user-deļ¬ned events the value before is always zero and the current value is user deļ¬ned and does not necessarily reļ¬‚ect a change on the trigger channel. The trigger channel events may also indicate changes between two non-zero values and from a non-zero to zero. The event

list described in Section 4.10.2 shows only transitions from zero to a

69

4

Processing raw data non-zero value. Similarly, the Jump to item in the tool bar, described in

Section 4.11, only detects transitions from zero to a nonzero value.

3. An optional comment text, which is especially helpful in associating user-deļ¬ned events with real-world activity, e.g., the subject closing or opening his/her eyes or an epileptic patient showing indications of a seizure.

4.10.2 The event list

The Windows/Show event list... menu choice shows a window containing a list of currently deļ¬ned events. The list can be restricted to user-deļ¬ned events by checking User-deļ¬ned events only. When an event is selected from the list, the main display jumps to the corresponding time. If a userdeļ¬ned event is selected, it can be deleted with the Delete a user-deļ¬ned

event

button.

70

4.10.3 Loading and saving event files

Using the Load/Save events choices in the ļ¬le menu, events can be saved

in text and ļ¬f formats, see Section 4.10.5, below. The loading dialogs

have the following options:

Match comment with

Only those events which will contain comments and in which the comment matches the entered text are loaded. This ļ¬ltering option is useful, e.g., in loading averaging or covariance matrix computa-

tion log ļ¬les, see Sections 4.13.2 and page 79. If the word omit is

entered as the ļ¬lter, only events corresponding to discarded epochs are loaded and the reason for rejection can be investigated in detail.

Add as user events

Add the events as if they were user-deļ¬ned events. As a result, the annotation ļ¬le saved next time mne_browse_raw closes this raw ļ¬le will contain these events.

Keep existing events

By default, the events loaded will replace the currently deļ¬ned ones.

With this option checked, the loaded event will be merged with the currently existing ones.

The event saving dialogs have the following options controlling the data saved:

Save events read from the data ļ¬le

Save only those event which are not designated as user deļ¬ned.

These are typically the events corresponding to changes in the digital trigger channel. Another possible source for these events is an event ļ¬le manually loaded without the Add as user events option.

MSH-MNE

MSH-MNE

Processing raw data

4

Save events created here

Save the user-deļ¬ned events.

Save all trigger line transitions

By default only those events which are associate with a transition from zero to non-zero value are saved. These include the userdeļ¬ned events and leading edges of pulses on the trigger line. When this option is present, all events included with the two above options are saved, regardless the type of transition indicated (zero to nonzero, non-zero to another non-zero value, and non-zero value to zero).

Tip: If you have a text format event ļ¬le whose content you want to include as user-deļ¬ned events and create the automatic annotation ļ¬le

described in Section 4.10.1, proceed as follows:

1. Load the event ļ¬le with the option Add as user events set.

2. Open another data ļ¬le or quit mne_browse_raw.

3. Optionally remove unnecessary events using the event list dialog.

The directory in which the raw data ļ¬le resides now contains an annotation ļ¬le which will be automatically loaded each time the data ļ¬le is opened. A text format event ļ¬le suitable for this purpose can be created manually, extracted from an EDF+ ļ¬le using the --tal option in

mne_edf2ļ¬ff discussed in Section 9.2.8, or produced by custom software

used during data acquisition.

4.10.4 Defining annotated events

The Windows/Show annotator... shows a window to add annotated userdeļ¬ned events. In this window, the buttons in ļ¬rst column mark one or more selected time points with the event number shown in the second column with an associated comment speciļ¬ed in the third column. Marking also occurs when return is pressed on any of the second and third column text ļ¬elds.

When the dialog is brought up for the ļ¬rst time, the ļ¬le $HOME/.mne/ mne_browse_raw.annot is consulted for the deļ¬nitions of the second and third column values, i.e., event numbers and comments. You can save the current deļ¬nitions with the Save defs button and reload the annotation deļ¬nition ļ¬le with Load defs. The annotation deļ¬nition ļ¬le may contain comment lines starting with ‘%’ or ‘#’ and data lines which contain an event number and an optional comment, separated from the event number by a colon.

Tip: If you want to add a user-deļ¬ned event without an a comment, you

can use the Picked to item in the tool bar, described in Section 4.11.

71

4

Processing raw data

4.10.5 Event files

A text format event ļ¬le contains information about transitions on the digital trigger line in a raw data ļ¬le. Any lines beginning with the pound sign

(#) are considered as comments. The format of the event ļ¬le data is:

<sample> <time> <from> <to> <text> where

<sample> is the sample number. This sample number takes into account the initial empty space in a raw data ļ¬le as indicated by the

FIFF_FIRST_SAMPLE and/or FIFF_DATA_SKIP tags in the beginning of raw data. Therefore, the event ļ¬le contents are independent of the Keep initial skip setting in the open dialog.

<time>

is the time from the beginning of the ļ¬le to this sample in seconds.

<from>

is the value of the digital trigger channel at <sample>-1.

<to>

<text>

is the value of the digital trigger channel at <sample>.

is an optional annotation associated with the event. This comment will be displayed in the event list and on the message line when you move to an event.

When an event ļ¬le is read back, the <sample> value will be primarily used to specify the time. If you want the <time> to be converted to the sample number instead, specify a negative value for <sample>.

Each event ļ¬le starts with a “pseudo event” where both <from> and <to> ļ¬elds are equal to zero.

Warning: In previous versions of the MNE software, the event ļ¬les did not contain the initial empty pseudo event. In addition the sample numbers did not take into account the initial empty space in the raw data ļ¬les.

The present version of MNE software is still backwards compatible with the old version of the event ļ¬les and interprets the sample numbers appropriately. However, the recognition of the old and new event ļ¬le formats depends on the initial pseudo event and, therefore, this ļ¬rst event should never be removed from the new event ļ¬les. Likewise, if an initial pseudo event with <from> and <to> ļ¬elds equal to zero is added to and old event ļ¬le, the results will be unpredictable.

Note: If you have created Matlab, Excel or other scripts to process the event ļ¬les, they may need revision to include the initial pseudo event in order for mne_browse_raw and mne_process_raw to recognize the edited event ļ¬les correctly.

Note: Events can be also stored in ļ¬f format. This format can be read and written with the Matlab toolbox functions mne_read_events and

mne_write_events.

72 MSH-MNE

Processing raw data

4

4.11 The tool bar

MSH-MNE

Figure 4.14 The tool bar controls.

The tool bar controls are shown in Figure 4.14. They perform the follow-

ing functions:

start/s

Allows speciļ¬cation of the starting time of the display as a numeric value. Note that this value will be rounded to the time of the nearest sample when you press return. If you click on this text ļ¬eld, you can also change the time with the up and down cursor keys (1/10 of the window size), and the page up and down (or control up and down cursor) keys (one window size).

Remove dc

Remove the dc offset from the signals for display. This does not affect the data used for averaging and noise-covariance matrix estimation.

Keep dc

Return to the original true dc levels.

Jump to

Enter a value of a trigger to be searched for. The arrow buttons jump to the next event of this kind. A selection is also automatically created and displayed as requested in the scales dialog, see

Section 4.5.2. If the ‘+’ button is active, previous selections are

kept, otherwise they are cleared.

Picked to

Make user events with this event number at all picked time points. It is also possible to add annotated user events with help of the annota-

tion dialog. For further information, see Section 4.10.

Forget

Forget desired user events.

Average

Compute an average to this event.

The tool bar status line shows the starting time and the length of the window in seconds as well as the cursor time point. The dates and times in parenthesis show the corresponding wall-clock times in the time zone where mne_browse_raw is run.

73

4

Processing raw data

Note: The wall-clock times shown are based on the information in the ļ¬f ļ¬le and may be offset from the true acquisition time by about 1 second.

This offset is constant throughout the ļ¬le. The times reļ¬‚ect the time zone setting of the computer used to analyze the data rather than the one use to acquire them.

4.12 Topographical data displays

Segments of data can shown in a topographical layout in the Full view window, which can be requested from the Scale dialog or from the Win-

dows menu. Another similar display is available to show the averaged data. The topographical layout to use is selected from Adjust/Full view

layout...

, which brings up a window with a list of available layouts. The default layouts reside in $MNE_ROOT/setup/mne_analyze/lout.

In addition any layout ļ¬les residing in $HOME/.mne/lout are listed.

The format of the layout ļ¬les is the same as for the Neuromag programs

xplotter and xļ¬t. A custom EEG layout can be easily created with the

mne_make_eeg_layout utility, see Section 11.6.

Several actions can be performed with the mouse in the topographical data display:

Left button

Shows the time and the channel name at the cursor at the bottom of the window.

Left button drag with shift key

Enlarge the view to contain only channels in the selected area.

Right button

Brings up a popup menu which gives a choice of graphics output formats for the current topographical display. Best quality is achieved with the Illustrator format. This format has the beneļ¬t that it is object oriented and can be edited in Adobe Illustrator.

Middle button

Drag and drop graphics to one of the cliplab view areas.

Note: The cliplab drag-and-drop functionality requires that you have the proprietary Elekta-Neuromag analysis software installed.

mne_browse_raw is compatible with cliplab versions 1.2.13 and later.

Note: The graphics output ļ¬les will contain a text line stating of the time and vertical scales if the zero level/time and/or viewport frames have been

switched on in the scales dialog, see Section 4.5.2.

74 MSH-MNE

MSH-MNE

Processing raw data

4

4.13 Description files for off-line averaging

For averaging tasks more complex than those involving only one trigger, the averaging parameters are speciļ¬ed with help of a text ļ¬le. This section describes the format of this ļ¬le. A sample averaging ļ¬le can be found in

$MNE_ROOT/setup/mne/mne_browse_raw/templates

.

4.13.1 Overall format

Any line beginning with the pound sign (#) in this description ļ¬le is a comment. Each parameter in the description ļ¬le is deļ¬ned by a keyword usually followed by a value. Text values consisting of multiple words, separated by spaces, must be included in quotation marks. The case of the keywords in the ļ¬le does not matter. The ending .ave is suggested for the average description ļ¬les.

The general format of the description ļ¬le is: average {

<common parameters>

category {

<category deļ¬nition parameters>

}

....

}

The ļ¬le may contain arbitrarily many categories. The word category interchangeable with condition.

Warning: Due to a bug that existed in some versions of the Neuromag acquisition software, the trigger line 8 is incorrectly decoded on trigger channel STI 014. This can be ļ¬xed by running mne_ļ¬x_stim14 on the raw data ļ¬le before using mne_browse_raw or mne_process_raw. The bug has been ļ¬xed on Nov. 10, 2005.

4.13.2 Common parameters

The average deļ¬nition starts with the common parameters. They include:

outļ¬le <name>

The name of the ļ¬le where the averages are to be stored. In interactive mode, this can be omitted. The resulting average structure can be viewed and stored from the Manage averages window.

75

4

Processing raw data

eventļ¬le <name>

Optional ļ¬le to contain event speciļ¬cations. If this ļ¬le is present, the trigger events in the raw data ļ¬le are ignored and this ļ¬le is consulted instead. The event ļ¬le format is recognized from the ļ¬le name: if it ends with .fif, the ļ¬le is assumed to be in ļ¬f format, otherwise a text ļ¬le is expected. The text event ļ¬le format is

described in Section 4.10.5.

logļ¬le <name>

This optional ļ¬le will contain detailed information about the averaging process. In the interactive mode, the log information can be viewed from the Manage averages window.

gradReject <value / T/m>

Rejection limit for MEG gradiometer channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the gradiometer channels, the epoch will be omitted from the average.

magReject <value / T>

Rejection limit for MEG magnetometer channels. If the peak-topeak amplitude within the extracted epoch exceeds this value on any of the magnetometer channels, the epoch will be omitted from the average.

eegReject <value / V>

Rejection limit for EEG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the EEG channels, the epoch will be omitted from the average.

eogReject <value / V>

Rejection limit for EOG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the EOG channels, the epoch will be omitted from the average.

ecgReject <value / V>

Rejection limit for ECG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the ECG channels, the epoch will be omitted from the average.

name <text>

A descriptive name for this set of averages. If the name contains multiple words, enclose it in quotation marks “like this”. The name will appear in the average manager window listing in the interactive version of the program and as a comment in the processed data section in the output ļ¬le.

76 MSH-MNE

MSH-MNE

Processing raw data

4

4.13.3 Category definition

A category (condition) is deļ¬ned by the parameters listed in this section.

event <number>

The zero time point of an epoch to be averaged is deļ¬ned by a transition from zero to this number on the digital trigger channel. The interpretation of the values on the trigger channel can be further modiļ¬ed by the ignore keyword.

ignore <number>

If this parameter is speciļ¬ed the selected bits on trigger channel values can be mask (set to zero) out prior to checking for an existence of an event. For example, to ignore the values of trigger input lines three and eight, specify ignore 132 (

2

2

+

2

7

=

132

).

delay <time / s>

Adds a delay to the time of the occurrence of an event. Therefore, if this parameter is positive, the zero time point of the epoch will be later than the time of the event and, correspondingly, if the parameter is negative, the zero time point of the epoch will be earlier than the event. By default, there will be no delay.

tmin <time / s>

Beginning time point of the epoch.

tmax <time / s>

End time point of the epoch.

bmin <time / s>

Beginning time point of the baseline. If both bmin and bmax parameters are present, the baseline deļ¬ned by this time range is subtracted from each epoch before they are added to the average.

basemin <time / s>

Synonym for bmin.

bmax <time / s>

End time point of the baseline.

basemax <time / s>

Synonym for bmax.

name <text>

A descriptive name for this category. If the name contains multiple words, enclose it in quotation marks “like this”. The name will appear in the average manager window listing in the interactive version of the program and as a comment averaging category section in the output ļ¬le.

77

4

Processing raw data

abs

Calculate the absolute values of the data in the epoch before adding it to the average.

stderr

The standard error of mean will be computed for this category and included in the output ļ¬f ļ¬le.

Note: Speciļ¬cation of the baseline limits does not any more imply the estimation of the standard error of mean. Instead, the stderr parameter is required to invoke this option.

4.14 Description files for covariance matrix estimation

Covariance matrix estimation is controlled by a another description ļ¬le, very similar to the average deļ¬nition. A example of a covariance description ļ¬le can be found in the directory $MNE_ROOT/setup/mne/ mne_browse_raw/templates

.

4.14.1 Overall format

Any line beginning with the pound sign (#) in this description ļ¬le is a comment. Each parameter in the description ļ¬le is deļ¬ned by a keyword usually followed by a value. Text values consisting of multiple words, separated by spaces, must be included in quotation marks. The case of the keywords in the ļ¬le does not matter. The ending .cov is suggested for the covariance-matrix description ļ¬les.

The general format of the description ļ¬le is: cov {

<common parameters>

def {

<covariance deļ¬nition parameters>

}

....

}

The ļ¬le may contain arbitrarily many covariance deļ¬nitions, starting with def

.

Warning: Due to a bug that existed in some versions of the Neuromag acquisition software, the trigger line 8 is incorrectly decoded on trigger channel STI 014. This can be ļ¬xed by running mne_ļ¬x_stim14 on the raw data ļ¬le before using mne_browse_raw or mne_process_raw. This bug

78 MSH-MNE

MSH-MNE

Processing raw data

4

has been ļ¬xed in the acquisition software at the Martinos Center on Nov.

10, 2005.

4.14.2 Common parameters

The average deļ¬nition starts with the common parameters. They include:

outļ¬le <name>

The name of the ļ¬le where the covariance matrix is to be stores.

This parameter is mandatory.

eventļ¬le <name>

Optional ļ¬le to contain event speciļ¬cations. This ļ¬le can be either

in ļ¬f or text format (see Section 4.10.5). The event ļ¬le format is rec-

ognized from the ļ¬le name: if it ends with .fif, the ļ¬le is assumed to be in ļ¬f format, otherwise a text ļ¬le is expected. If this parameter is present, the trigger events in the raw data ļ¬le are ignored and this event file is consulted instead. The event ļ¬le format is described in

Section 4.10.5.

logļ¬le <name>

This optional ļ¬le will contain detailed information about the averaging process. In the interactive mode, the log information can be viewed from the Manage averages window.

gradReject <value / T/m>

Rejection limit for MEG gradiometer channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the gradiometer channels, the epoch will be omitted from the average.

magReject <value / T>

Rejection limit for MEG magnetometer channels. If the peak-topeak amplitude within the extracted epoch exceeds this value on any of the magnetometer channels, the epoch will be omitted from the average.

eegReject <value / V>

Rejection limit for EEG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the EEG channels, the epoch will be omitted from the average.

eogReject <value / V>

Rejection limit for EOG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the EOG channels, the epoch will be omitted from the average.

79

4

Processing raw data

ecgReject <value / V>

Rejection limit for ECG channels. If the peak-to-peak amplitude within the extracted epoch exceeds this value on any of the ECG channels, the epoch will be omitted from the average.

keepsamplemean

The means at individual samples will not be subtracted in the esti-

mation of the covariance matrix. For details, see Section 4.17.2.

This parameter is effective only for estimating the covariance matrix from epochs.

4.14.3 Covariance definitions

The covariance deļ¬nitions starting with def specify the epochs to be included in the estimation of the covariance matrix.

event <number>

The zero time point of an epoch to be averaged is deļ¬ned by a transition from zero to this number on the digital trigger channel. The interpretation of the values on the trigger channel can be further modiļ¬ed by the ignore keyword. If the event parameter is missing or set to zero, the covariance matrix is computed over a section of the raw data, deļ¬ned by the tmin and tmax parameters.

ignore <number

If this parameter is speciļ¬ed the selected bits on trigger channel values can be mask (set to zero) out prior to checking for an existence of an event. For example, to ignore the values of trigger input lines three and eight, specify ignore 132 (

2

2

+

2

7

=

132

).

delay <time / s>

Adds a delay to the time of the occurrence of an event. Therefore, if this parameter is positive, the zero time point of the epoch will be later than the time of the event and, correspondingly, if the parameter is negative, the zero time point of the epoch will be earlier than the time of the event. By default, there will be no delay.

tmin <time / s>

Beginning time point of the epoch. If the event parameter is zero or missing, this deļ¬nes the beginning point of the raw data range to be included.

tmax <time / s>

End time point of the epoch. If the event parameter is zero or missing, this deļ¬nes the end point of the raw data range to be included.

80 MSH-MNE

MSH-MNE

Processing raw data

4 bmin <time / s>

It is possible to remove a baseline from the epochs before they are included in the covariance matrix estimation. This parameter deļ¬nes the starting point of the baseline. This feature can be employed to avoid overestimation of noise in the presence of low-frequency drifts. Setting of bmin and bmax is always recommended for epoch-based covariance matrix estimation.

basemin <time / s>

Synonym for bmin.

bmax <time / s>

End time point of the baseline, see above.

basemax <time / s>

Synonym for bmax.

4.15 Managing averages

This selection pops up a dialog which allows the management of com-

puted averages. The controls in the dialog, shown in Figure 4.15, allow

the following:

1. Select which categories (conditions) are displayed in the average view.

2. Select the colors of the traces.

3. Viewing the log information accumulated in the averaging process.

4. Saving of averaged data.

5. Setting the active vectors for signal-space projection if the data were loaded from a ļ¬le.

6. Setting the current software gradient compensation for data loaded from a ļ¬le.

81

4

Processing raw data

82

Figure 4.15 The dialog for managing available averages.

In the example of Figure 4.15, the ļ¬rst item is an average computed

within mne_browse_raw, the second one contains data loaded from a ļ¬le with signal-space projection data available, the third one demonstrates multiple data sets loaded from a ļ¬le with neither projection nor software gradient compensation available, and the last one is a data set loaded from ļ¬le with software gradient compensation data present. Note that this is now a scrolled window and some of the loaded data may be below or above the current view area.

4.16 The Signal-Space Projection (SSP) method

The Signal-Space Projection (SSP) is one approach to rejection of external disturbances in software. The section presents some relevant details of this method.

4.16.1 General concepts

Unlike many other noise-cancellation approaches, SSP does not require additional reference sensors to record the disturbance ļ¬elds. Instead, SSP relies on the fact that the magnetic ļ¬eld distributions generated by the sources in the brain have spatial distributions sufļ¬ciently different from those generated by external noise sources. Furthermore, it is implicitly

MSH-MNE

MSH-MNE

Processing raw data

4

assumed that the linear space spanned by the signiļ¬cant external noise patters has a low dimension.

Without loss of generality we can always decompose any -channel measurement

b t

into its signal and noise components as

b t

=

b

s

+

n

Further, if we know that

b

1

b

m

b

n

is well characterized by a few ļ¬eld patterns

, we can express the disturbance as

b

n t

=

Uc

n

where the columns of

c

is an

U

constitute an orthonormal basis for

-component column vector, and the error term

e t

b

1

b

m

is small and does not exhibit any consistent spatial distributions over time, i.e.,

C

n e

=

m

E ee

T

}

=

I

. Subsequently, we will call the column space of

U

the noise subspace. The basic idea of SSP is that we can actually ļ¬nd a

, small basis set

b

1

b

m

such that the conditions described above are satisļ¬ed. We can now construct the orthogonal complement operator

P

=

I

UU

T

and apply it to yielding

b

s

since

P

b

n

=

Uc

n

0 . The projection operator

P

is called the signal-space projection operator and generally provides considerable rejection of noise, suppressing external disturbances by a factor of 10 or more. The effectiveness of SSP depends on two factors:

1. The basis set

b

1

b

m

should be able to characterize the disturbance ļ¬eld patterns completely and

2. The angles between the noise subspace space spanned by the signal vectors

b

s

b

1

b

should be as close to as possible.

m

and

If the ļ¬rst requirement is not satisļ¬ed, some noise will leak through because

P

b

n

. If the any of the brain signal vectors

b

s

is close to the noise subspace not only the noise but also the signal will be attenuated by the application of

P

and, consequently, there might by little gain

in signal-to-noise ratio. Figure 4.16 demonstrates the effect of SSP on the

Vectorview magnetometer data. After the elimination of a three-dimensional noise subspace, the absolute value of the noise is dampened approximately by a factor of 10 and the covariance matrix becomes diagonally dominant.

83

4

Processing raw data

Since the signal-space projection modiļ¬es the signal vectors originating in the brain, it is necessary to apply the projection to the forward solution in the course of inverse computations. This is accomplished by

mne_inverse_operator as described in Section 6.4. For more information

on SSP, please consult the references listed in Section 13.4.

84

Figure 4.16 An example of the effect of SSP. The covariance matrix

C

of noise data on the 102 Vectorview magnetometers was computed (a)

n

before and (b) after the application of SSP with three-dimensional noise subspace. The plotted quantity is

( )

jk

. Note that the vertical scale in

(b) is ten times smaller than in (a).

4.16.2 Estimation of the noise subspace

As described above, application of SSP requires the estimation of the signal vectors

b

1

b

m

constituting the noise subspace. The most common approach, also implemented in mne_browse_raw is to compute a covariance matrix of empty room data, compute its eigenvalue decomposition, and employ the eigenvectors corresponding to the highest eigenvalues as basis for the noise subspace. It is also customary to use a separate set of vectors for magnetometers and gradiometers in the Vectorview system.

4.16.3 EEG average electrode reference

In the computation of EEG-based source estimates, the MNE software employs the average-electrode reference, which means that the average over all electrode signals

v

1

v

p

is subtracted from each

v

j

:

v

j

' =

v

j

1

p

k

v

k

.

It is easy to see that the above equation actually corresponds to the projection:

MSH-MNE

MSH-MNE

v'

=

(

I

uu

T

)v ,

Processing raw data

4

where

u

=

p

T

.

4.17 Covariance matrix estimation

This section describes how the covariance matrices are computed for raw data and epochs.

4.17.1 Continuous raw data

If a covariance matrix of a raw data is computed the data are checked for artefacts in 200-sample pieces. Let us denote the accepted samples for all channel by the vectors

s

j

matrix is then computed as:

,

j

= 1

M

. The estimate of the covariance

=

M

1

M

j

= 1

(

s

j

s

j

s

)

T

where

s

=

1

M

M

j

=

1

s

j

is the average of the signals over all times. Note that no attempt is made to correct for low frequency drifts in the data. If the contribution of any frequency band is not desired in the covariance matrix estimate, suitable band-pass filter should be applied.

For actual computations, it is convenient to rewrite the expression for the covariance matrix as

=

1

M

1

M

j

= 1

s

j

s

j

T

M

1

T

85

86

4

Processing raw data

4.17.2 Epochs

The calculation of the covariance matrix is slightly more complicated in the epoch mode. If the bmin and bmax parameters are speciļ¬ed in the

covariance matrix description ļ¬le (see Section 4.14.3), baseline correction

is ļ¬rst applied to each epoch.

By default, the mean at each time point in the epoch is subtracted from the individual epochs. Let

s

rpj

,

p

= 1

P

r

, j = 1

N

r

, r = 1

R be the (baseline corrected) epochs used to calculate the covariance matrix.

In the above,

P r r R r N r

is the number of samples in the epochs of category , and is the number of categories. For this case we estimate the covariance matrix as

=

N c

R

r

= 1

N

r j

= 1

P r

p

= 1

(

s

rpj

s

rj rpj

s

rj

)

T

, where

s

rj

=

P r

P r

p

= 1

s

rpj

and

N c

=

R

r

=

1

N r

(

P r

– 1

) , which reļ¬‚ects the fact that

N r r

the expression for the covariance matrix estimate can be cast into a more convenient form

C

=

1

N c

s

rpj

T

s

rpj

N

1

c

r

P r

j

T

s

rj

s

rj

.

If the keepsamplemean option is speciļ¬ed in the covariance matrix deļ¬nition ļ¬le, the baseline correction is still applied to the epochs but the individual sample means are not subtracted. Thus the covariance matrix will be simply computed as:

MSH-MNE

MSH-MNE

Processing raw data

4

C

=

-------

N

C

s

rpj

T

s

rpj

, where

s

rpj

is the

j

th

time sample of the

p

th

r

N

C

=

R

r

= 1

N r

P r

.

4.17.3 Combination of covariance matrix estimates

Let us assume that we have computed multiple covariance matrix estimates

C

1

Cˆ

Q

with corresponding degrees of freedom

N

1

. We can combine these matrices together as

N

Q

C

=

q

α

q q

, where

α

q

=

N

--------------

.

q

N q

4.17.4 SSP information included with covariance matrices

If a signal space projection was on when a covariance matrix was calculated, information about the projections applied is included with the covariance matrix when it is saved. These projection data are read by

mne_inverse_operator and applied to the forward solution as well as appropriate. Inclusion of the projections into the covariance matrix limits the possibilities to use the --bad and --proj options in

mne_inverse_operator, see Section 6.4.

4.18 Interacting with mne_analyze

To facilitate interactive analysis of raw data, mne_browse_raw can run

mne_analyze as a child process. In this mode, mne_analyze is “remote controlled” by mne_browse_raw and will also send replies to

mne_browse_raw to keep the two programs synchronized. A practical

87

4

Processing raw data application of this communication is to view ļ¬eld or potential maps and cortically-constrained source estimates computed from raw data instantly.

The subordinate mne_analyze is started and stopped from Start

mne_analyze

and Quit mne_analyze in the Windows menu, respectively.

The following settings are communicated between the two processes:

The raw data ļ¬le

If a new raw data ļ¬le is opened and a subordinate mne_analyze is active, the name of the raw data ļ¬le is communicated to

mne_analyze and a simpliļ¬ed version of the open dialog appears in

mne_analyze allowing selection of an inverse operator or are MEG/

MRI coordinate transformation. If a raw data ļ¬le is already open in

mne_browse_raw when mne_analyze is started, the open dialog appears immediately.

Time point

When a new time point is selected in mne_browse_raw the

mne_analyze time point selection is updated accordingly. Time point selection in mne_analyze is not transferred to

mne_browse_raw.

Scales

The vertical scales are kept synchronized between the two programs. In addition, the settings of the sample time limits are communicated from mne_browse_raw to mne_analyze.

Filter

The ļ¬lter settings are kept synchronized.

88 MSH-MNE

5

C H A P T E R 5

The forward solution

5.1 Overview

This Chapter covers the deļ¬nitions of different coordinate systems employed in MNE software and FreeSurfer, the details of the computation of the forward solutions, and the associated low-level utilities.

5.2 MEG/EEG and MRI coordinate systems

The coordinate systems used in MNE software (and FreeSurfer) and their

relationships are depicted in Figure 5.1. Except for the Sensor coordi-

nates, all of the coordinate systems are Cartesian and have the “RAS”

MSH-MNE

MEG/EEG MRI

Head coordinates

T

1

Device coordinates

T

2

Surface RAS (MRI) coordinates

T

3

RAS coordinates

T

s

1

...T s

n

Sensor coordinates

T

-

FreeSurfer Talairach coordinates (z < 0)

T

4

MRI Talairach coordinates

T

+

FreeSurfer Talairach coordinates (z > 0)

Figure 5.1 MEG/EEG and MRI coordinate systems. The coordinate transforms present in the ļ¬f ļ¬les in MNE and the FreeSurfer ļ¬les as well as those set to ļ¬xed values are indicated with

T

x

, where identiļ¬es the transformation.

x

89

5

The forward solution

The coordinate systems related to MEG/EEG data are:

Head coordinates

This is a coordinate system deļ¬ned with help of the ļ¬ducial landmarks (nasion and the two auricular points). In ļ¬f ļ¬les, EEG electrode locations are given in this coordinate system. In addition, the head digitization data acquired in the beginning of an MEG, MEG/

EEG, or EEG acquisition are expressed in head coordinates. For

details, see Section 5.2.

Device coordinates

This is a coordinate system tied to the MEG device. The relationship of the Device and Head coordinates is determined during an

MEG measurement by feeding current to

3

5

head-position indicator (HPI) coils and by determining their locations with respect to the MEG sensor array from the magnetic ļ¬elds they generate.

Sensor coordinates

Each MEG sensor has a local coordinate system deļ¬ning the orientation and location of the sensor. With help of this coordinate system, the numerical integration data needed for the computation of the magnetic ļ¬eld can be expressed conveniently as discussed in

Section 5.8. The channel information data in the ļ¬f ļ¬les contain the

information to specify the coordinate transformation between the coordinates of each sensor and the MEG device coordinates.

The coordinate systems related to MRI data are:

Surface RAS coordinates

The FreeSurfer surface data are expressed in this coordinate system.

The origin of this coordinate system is at the center of the conformed FreeSurfer MRI volumes (usually 256 x 256 x 256 isotropic

1-mm

3

voxels) and the axes are oriented along the axes of this volume. The BEM surface and the locations of the sources in the source space are usually expressed in this coordinate system in the ļ¬f ļ¬les. In this manual, the Surface RAS coordinates are usually referred to as MRI coordinates unless there is need to speciļ¬cally discuss the different MRI-related coordinate systems.

RAS coordinates

This coordinate system has axes identical to the Surface RAS coor-

dinates but the location of the origin is different and deļ¬ned by the original MRI data, i.e., the origin is in a scanner-dependent location.

There is hardly any need to refer to this coordinate system explicitly in the analysis with the MNE software. However, since the Talairach coordinates, discussed below, are deļ¬ned with respect to RAS coor-

dinates rather than the Surface RAS coordinates, the RAS coordinate system is implicitly involved in the transformation between

Surface RAS coordinates and the two Talairach coordinate systems.

90 MSH-MNE

MSH-MNE

The forward solution

5

MNI Talairach coordinates

The deļ¬nition of this coordinate system is discussed, e.g., in http:// imaging.mrc-cbu.cam.ac.uk/imaging/MniTalairach. This transformation is determined during the FreeSurfer reconstruction process.

FreeSurfer Talairach coordinates

The problem with the MNI Talairach coordinates is that the linear

MNI Talairach transform does matched the brains completely to the

Talairach brain. This is probably because the Talairach atlas brain is a rather odd shape, and as a result, it is difļ¬cult to match a standard brain to the atlas brain using an afļ¬ne transform. As a result, the

MNI brains are slightly larger (in particular higher, deeper and longer) than the Talairach brain. The differences are larger as you get further from the middle of the brain, towards the outside. The

FreeSurfer Talairach coordinates mitigate this problem by additing a an additional transformation, deļ¬ned separately for negatice and positive MNI Talairach coordinates. These two transformations, denoted by

T

-

and

T

+

in Figure 5.1, are ļ¬xed as discussed in http:/

/imaging.mrc-cbu.cam.ac.uk/imaging/MniTalairach (Approach 2).

The different coordinate systems are related by coordinate transforma-

tions depicted in Figure 5.1. The arrows and coordinate transformation

symbols (

T

x

) indicate the transformations actually present in the Free-

Surfer ļ¬les. Generally,

x

2

y

2

z

2

1

=

T

12

x

1

y

1

z

1

1

=

R

11

R

12

R

13

x

0

R

21

R

22

R

23

y

0

R

31

R

32

R

33

z

0 0 0 1

0

x

1

y

1

,

z

1

1 where

x k k

are the location coordinates in two coordinate systems, is the coordinate transformation from coordinate system “1” to

“2”,

x

T

0

12

, , and z

k

and z

0

is the location of the origin of coordinate system “1” in coordinate system”2”, and

R jk

are the elements of the rotation matrix relating the two coordinate systems. The coordinate transformations are present in different ļ¬les produced by FreeSurfer and MNE as summarized

in Table 5.1. The ļ¬xed transformations

T

-

and

T

+

are:

T

-

=

0.99

0 0 0

0 0.9688 0.042 0

0 – 0.0485

0.839 0

0 0 0 1 and

91

5

The forward solution

T

+

=

0.99

0 0 0

0 0.9688 0.046 0

.

0 – 0.0485

0.9189 0

0 0 0 1

Note: This section does not discuss the transformation between the MRI voxel indices and the different MRI coordinates. However, it is important to note that in FreeSurfer, MNE, as well as in Neuromag software an integer voxel coordinate corresponds to the location of the center of a voxel.

Detailed information on the FreeSurfer MRI systems can be found at https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems.

Transformation

T

T

T

T

T

T

T

-

1

s

2

3

4

+

1

T

s n

Not present

FreeSurfer

Not present

Not present mri/*.mgz ļ¬les mri/transforms/talairach.xfm

Hardcoded in software

Hardcoded in software

MNE

Measurement data ļ¬les

Forward solution ļ¬les (*-fwd.ļ¬f)

Inverse operator ļ¬les (*-inv.ļ¬f)

Channel information in ļ¬les containing

T

1

.

MRI description ļ¬les

Separate coordinate transformation ļ¬les saved from mne_analyze

Forward solution ļ¬les

Inverse operator ļ¬les

MRI description ļ¬les saved with

mne_make_cor_set if the input is in mgz or mgh format.

MRI description ļ¬les saved with

mne_make_cor_set if the input is in mgz or mgh format.

MRI description ļ¬les saved with

mne_make_cor_set if the input is in mgz or mgh format.

MRI description ļ¬les saved with

mne_make_cor_set if the input is in mgz or mgh format.

Table 5.1 Coordinate transformations in FreeSurfer and MNE software packages. The symbols

T

x

are deļ¬ned in Figure 5.1 Note: mne_make_cor_set/mne_setup_mri prior to release 2.6 did not

include transformations

T

3

,

T

4

,

T

-

, and

T

+

in the ļ¬f ļ¬les produced.).

92 MSH-MNE

The forward solution

5

5.3 The head and device coordinate systems

z x

1

3

2 y

Figure 5.2 The head coordinate system

The MEG/EEG head coordinate system employed in the MNE software is

MSH-MNE ricular or preauricular points digitized before acquiring the data with posand is normal to the

xy

plane.

The origin of the MEG device coordinate system is device dependent. Its origin is located approximately at the center of a sphere which ļ¬ts the

xy

plane with positive direction up.

Important: The above deļ¬nition is identical to that of the Neuromag

MEG/EEG (head) coordinate system. However, in 4-D Neuroimaging and

CTF MEG systems the head coordinate frame deļ¬nition is different. The origin of the coordinate system is at the midpoint of the left and right the and lies in the plane deļ¬ned by the three ļ¬ducial landmarks, positive marks, pointing up. Note that in this convention the auricular points are

(see Section 9.2) take care of these idiosyncrasies and convert all coordi-

nate information to the MNE software head coordinate frame.

93

5

The forward solution

5.4 Creating a surface-based source space

The ļ¬f format source space ļ¬les containing the dipole locations and orientations are created with the utility mne_make_source_space. This utility is usually invoked by the convenience script mne_setup_source_space, see

Section 3.5.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--surf <name1>:<name2>:…

FreeSurfer surface ļ¬le names specifying the source surfaces, separated by colons.

--spacing <spacing/mm>

Speciļ¬es the approximate grid spacing of the source space in mm.

--ico <number>

Instead of using the traditional method for cortical surface decimation it is possible to create the source space using the topology of a recursively subdivided icosahedron (<number> > 0) or an octahedron (<number> < 0). This method uses the cortical surface inļ¬‚ated to a sphere as a tool to ļ¬nd the appropriate vertices for the source space. The beneļ¬t of the --ico option is that the source space will have triangulation information between the decimated vertices included, which some future versions of MNE software may be able to utilize. The number of triangles increases by a factor of four in each subdivision, starting from 20 triangles in an icosahedron and 8 triangles in an octahedron. Since the number of vertices on a closed surface is subdivision of an icosahedron and an octahedron are

4

k

+ 1

+

2

n

vert

=

(

n

tri

+

4

, the number of vertices in the kth

k

+

2

and

, respectively. The recommended values for <number> and the corresponding number of source space locations are listed in

Table 3.1.

--all

Include all nodes to the output. The active dipole nodes are identiļ¬ed in the ļ¬f ļ¬le by a separate tag. If tri ļ¬les were used as input the output ļ¬le will also contain information about the surface triangulation. This option is always recommended to include complete information.

--src <name>

Output ļ¬le name. Use a name <dir>/<name>-src.ļ¬f

94 MSH-MNE

MSH-MNE

The forward solution

5

Note: If both --ico and --spacing options are present the later one on the command line takes precedence.

Note: Due to the differences between the FreeSurfer and MNE libraries, the number of source space points generated with the --spacing option may be different between the current version of MNE and versions 2.5 or earlier (using --spacing option to mne_setup_source_space) if the

FreeSurfer surfaces employ the (old) quadrangle format or if there are topological defects on the surfaces. All new FreeSurfer surfaces are speciļ¬ed as triangular tessellations and are e of defects.

5.5 Creating a volumetric or discrete source space

In addition to source spaces conļ¬ned to a surface, the MNE software provides some support for three-dimensional source spaces bounded by a surface as well as source spaces comprised of discrete, arbitrarily located source points. The mne_volume_source_space utility assists in generating such source spaces.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--surf <name>

Speciļ¬es a FreeSurfer surface ļ¬le containing the surface which will be used as the boundary for the source space.

--bem <name>

Speciļ¬es a BEM ļ¬le (ending in -bem.fif). The inner skull surface will be used as the boundary for the source space.

--origin <x/mm>:<y/mm>:<z/mm>

If neither of the two surface options described above is present, the source space will be spherical with the origin at this location, given in MRI (RAS) coordinates.

--rad <radius/mm>

Speciļ¬es the radius of a spherical source space. Default value =

90 mm

--grid <spacing/mm>

Speciļ¬es the grid spacing in the source space.

95

5

The forward solution

--mindist <distance/mm>

Only points which are further than this distance from the bounding surface are included. Default value = 5 mm.

--exclude <distance/mm>

Exclude points that are closer than this distance to the center of mass of the bounding surface. By default, there will be no exclusion.

--mri <name>

Speciļ¬es a MRI volume (in mgz or mgh format). If this argument is present the output source space ļ¬le will contain a (sparse) interpolation matrix which allows mne_volume_data2mri to create an MRI

overlay ļ¬le, see Section 9.4.

--pos <name>

Speciļ¬es a name of a text ļ¬le containing the source locations and, optionally, orientations. Each line of the ļ¬le should contain 3 or 6 values. If the number of values is 3, they indicate the source location, in millimeters. The orientation of the sources will be set to the z-direction. If the number of values is 6, the source orientation will be parallel to the vector deļ¬ned by the remaining 3 numbers on each line. With --pos, all of the options deļ¬ned above will be ignored.

By default, the source position and orientation data are assumed to be given in MRI coordinates.

--head

If this option is present, the source locations and orientations in the ļ¬le speciļ¬ed with the --pos option are assumed to be given in the

MEG head coordinates.

--meters

Indicates that the source locations in the ļ¬le deļ¬ned with the --pos option are give in meters instead of millimeters.

--src <name>

Speciļ¬es the output ļ¬le name. Use a name <dir>/<name>-src.ļ¬f

--all

Include all vertices in the output ļ¬le, not just those in use. This option is implied when the --mri option is present. Even with the

--all

option, only those vertices actually selected will be marked to be “in use” in the output source space ļ¬le.

96

5.6 Creating the BEM meshes

The mne_surf2bem utility converts surface triangle meshes from ASCII and FreeSurfer binary ļ¬le formats to the ļ¬f format. The resulting ļ¬ff ļ¬le

MSH-MNE

MSH-MNE

The forward solution

5

also contains conductivity information so that it can be employed in the

BEM calculations.

Note: The utility mne_tri2ļ¬ff previously used for this task has been replaced by mne_surf2bem.

Tip: The convenience script mne_setup_forward_model described in

Section 3.7 calls mne_surf2bem with the appropriate options.

Note: The vertices of all surfaces should be given in the MRI coordinate system.

5.6.1 Command-line options

This program has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--surf <name>

Speciļ¬es a FreeSurfer binary format surface ļ¬le. Before specifying the next surface (--surf or --tri options) details of the surface

speciļ¬cation can be given with the options listed in Section 5.6.2.

--tri <name>

Speciļ¬es a text format surface ļ¬le. Before specifying the next surface (--surf or --tri options) details of the surface speciļ¬cation

can be given with the options listed in Section 5.6.2. The format of these ļ¬les is described in Section 5.6.3.

--check

Check that the surfaces are complete and that they do not intersect.

This is a recommended option. For more information, see

Section 5.6.4.

--checkmore

In addition to the checks implied by the --check option, check

skull and skull thicknesses. For more information, see Section 5.6.4.

--ļ¬f <name>

The output ļ¬f ļ¬le containing the BEM. These ļ¬les normally reside in the bem subdirectory under the subject’s mri data. A name ending with -bem.fif is recommended.

97

5

The forward solution

5.6.2 Surface options

These options can be speciļ¬ed after each --surf or --tri option to deļ¬ne details for the corresponding surface.

--swap

Swap the ordering or the triangle vertices. The standard convention in the MNE software is to have the vertices ordered so that the vector cross product of the vectors from vertex 1 to 2 and 1 to 3 gives the direction of the outward surface normal. Text format triangle ļ¬les produced by the some software packages have an opposite order. For these ļ¬les, the --swap. option is required. This option does not have any effect on the interpretation of the FreeSurfer surface ļ¬les speciļ¬ed with the --surf option.

--sigma <value>

The conductivity of the compartment inside this surface in S/m.

--shift <value/mm>

Shift the vertices of this surface by this amount, given in mm, in the outward direction, i.e., in the positive vertex normal direction.

--meters

The vertex coordinates of this surface are given in meters instead of millimeters. This option applies to text format ļ¬les only. This deļ¬nition does not affect the units of the shift option.

--id <number>

Identiļ¬cation number to assign to this surface. (1 = inner skull, 3 = outer skull, 4 = scalp).

--ico <number>

Downsample the surface to the designated subdivision of an icosahedron. This option is relevant (and required) only if the triangulation is isomorphic with a recursively subdivided icosahedron. For example, the surfaces produced by with mri_watershed are isomorphic with the 5th subdivision of a an icosahedron thus containing

20480 triangles. However, this number of triangles is too large for present computers. Therefore, the triangulations have to be decimated. Specifying --ico 4 yields 5120 triangles per surface while

--ico 3

results in 1280 triangles. The recommended choice is -ico 4

.

5.6.3 Tessellation file format

The format of the text format surface ļ¬les is the following:

<nvert>

<vertex 1>

98 MSH-MNE

The forward solution

5

<vertex 2>

<vertex nvert>

<ntri>

<triangle 1>

<triangle 2>

<triangle ntri>, where <nvert> and <ntri> are the number of vertices and number of triangles in the tessellation, respectively.

The format of a vertex entry is one of the following:

x y z

The x, y, and z coordinates of the vertex location are given in mm.

number x y z

A running number and the x, y, and z coordinates are given. The running number is not considered by mne_tri2ļ¬ff. The nodes must be thus listed in the correct consecutive order.

x y z nx ny nz

The x, y, and z coordinates as well as the approximate vertex normal direction cosines are given.

number x y z nx ny nz

A running number is given in addition to the vertex location and vertex normal.

Each triangle entry consists of the numbers of the vertices belonging to a triangle. The vertex numbering starts from one. The triangle list may also contain running numbers on each line describing a triangle.

MSH-MNE

5.6.4 Topology checks

If the --check option is speciļ¬ed, the following topology checks are performed:

1. The completeness of each surface is conļ¬rmed by calculating the total solid angle subtended by all triangles from a point inside the triangulation. The result should be very close to

4

π

. If the result is –

4

π

instead, it is conceivable that the ordering of the triangle vertices is incorrect and the --swap option should be speciļ¬ed.

2. The correct ordering of the surfaces is veriļ¬ed by checking that the surfaces are inside each other as expected. This is accomplished by checking that the sum solid angles subtended by triangles of a surface

S

S k

at all vertices of another surface which is supposed to be inside it

4

π

p

equals . Naturally, this check is applied only if the model has more

99

5

The forward solution than one surface. Since the surface relations are transitive, it is enough to check that the outer skull surface is inside the skin surface and that the inner skull surface is inside the outer skull one.

3. The extent of each of the triangulated volumes is checked. If the extent is smaller than 50 mm, an error is reported. This may indicate that the vertex coordinates have been speciļ¬ed in meters instead of millimeters.

5.7 Computing the BEM geometry data

The utility mne_prepare_bem_model computes the geometry information for BEM. This utility is usually invoked by the convenience script

mne_setup_forward_model, see Section 3.7. The command-line options

are:

--bem <name>

Specify the name of the ļ¬le containing the triangulations of the

BEM surfaces and the conductivities of the compartments. The standard ending for this ļ¬le is -bem.fif and it is produced either with

the utility mne_surf2bem (Section 5.6) or the convenience script

mne_setup_forward_model, see Section 3.7.

--sol <name>

Specify the name of the ļ¬le containing the triangulation and conductivity information together with the BEM geometry matrix computed by mne_prepare_bem_model. The standard ending for this ļ¬le is -bem-sol.fif.

--method <approximation method>

Select the BEM approach. If <approximation method> is constant

, the BEM basis functions are constant functions on each triangle and the collocation points are the midpoints of the triangles.

With linear, the BEM basis functions are linear functions on each triangle and the collocation points are the vertices of the triangulation. This is the preferred method to use. The accuracy will be the same or better than in the constant collocation approach with about half the number of unknowns in the BEM equations.

5.8 Coil geometry information

This Section explains the presentation of MEG detection coil geometry information the approximations used for different detection coils in MNE software. Two pieces of information are needed to characterize the detectors:

100 MSH-MNE

MSH-MNE

The forward solution

5

1. The location and orientation a local coordinate system for each detector.

2. A unique identiļ¬er, which has an one-to-one correspondence to the geometrical description of the coil.

5.8.1 The sensor coordinate system

The sensor coordinate system is completely characterized by the location of its origin and the direction cosines of three orthogonal unit vectors pointing to the directions of the x, y, and z axis. In fact, the unit vectors contain redundant information because the orientation can be uniquely deļ¬ned with three angles. The measurement ļ¬f ļ¬les list these data in

MEG device coordinates. Transformation to the MEG head coordinate frame can be easily accomplished by applying the device-to-head coordinate transformation matrix available in the data ļ¬les provided that the head-position indicator was used. Optionally, the MNE software forward calculation applies another coordinate transformation to the head-coordinate data to bring the coil locations and orientations to the MRI coordinate system.

If

r

and

0

e

is a row vector for the origin of the local sensor coordinate system

x

,

e

y

, and

e

z

are the row vectors for the three orthogonal unit vectors, all given in device coordinates, a location of a point coordinates is transformed to device coordinates (

r

D

) by

r

C

in sensor

r

D

1

=

r

C

1 T

CD

, where

T

=

e

x

0

e

y

e

z

r

0D

1

0

.

0

5.8.2 Calculation of the magnetic field

The forward calculation in the MNE software computes the signals detected by each MEG sensor for three orthogonal dipoles at each source space location. This requires speciļ¬cation of the conductor model, the location and orientation of the dipoles, and the location and orientation of each MEG sensor as well as its coil geometry.

101

5

The forward solution

The output of each SQUID sensor is a weighted sum of the magnetic ļ¬‚uxes threading the loops comprising the detection coil. Since the ļ¬‚ux threading a coil loop is an integral of the magnetic ļ¬eld component normal to the coil plane, the output of the kth MEG channel,

b k

, can be approximated by:

b k

=

N

k p

= 1

w kp

B r

kp

) n

kp

where

r

kp

are a set of loops of the sensor,

r

B r

kp

N

)

k

integration points covering the pickup coil

is the magnetic ļ¬eld due to the current sources calculated at , are the coil normal directions at these points, and

w kp kp

n

kp

are the weights associated to the integration points. This formula essentially presents numerical integration of the magnetic ļ¬eld over the

102

There are three accuracy levels for the numerical integration expressed above. The simple accuracy means the simplest description of the coil.

This accuracy is not used in the MNE forward calculations. The normal or

recommended accuracy typically uses two integration points for planar gradiometers, one in each half of the pickup coil and four evenly distributed integration points for magnetometers. This is the default accuracy used by MNE. If the --accurate option is speciļ¬ed, the forward calculation typically employs a total of eight integration points for planar gradiometers and sixteen for magnetometers. Detailed information about the integration points is given in the next section.

5.8.3 Implemented coil geometries

This section describes the coil geometries currently implemented in Neuromag software. The coil types fall in two general categories:

1. Axial gradiometers and planar gradiometers and

2. Planar gradiometers.

For axial sensors, the z axis of the local coordinate system is parallel to the ļ¬eld component detected, i.e., normal to the coil plane.For circular coils, the orientation of the x and y axes on the plane normal to the z axis is irrelevant. In the square coils employed in the Vectorview™ system the

x axis is chosen to be parallel to one of the sides of the magnetometer coil.

For planar sensors, the z axis is likewise normal to the coil plane and the x axis passes through the centerpoints of the two coil loops so that the detector gives a positive signal when the normal ļ¬eld component increases along the x axis.

Table 5.2 lists the parameters of the normal coil geometry descriptions

Table 5.3 lists the accurate descriptions. For simple accuracy, please con-

MSH-MNE

The forward solution

5

sult the coil deļ¬nition ļ¬le, see Section 5.8.4. The columns of the tables

contain the following data:

1. The number identifying the coil id. This number is used in the coil descriptions found in the FIF ļ¬les.

2. Description of the coil.

3. Number of integration points used

4. The locations of the integration points in sensor coordinates.

5. Weights assigned to the ļ¬eld values at the integration points. Some formulas are listed instead of the numerical values to demonstrate the principle of the calculation. For example, in the normal coil descriptions of the planar gradiometers the weights are inverses of the baseline of the gradiometer to show that the output is in T/m.

Note: The coil geometry information is stored in the ļ¬le $MNE_ROOT/ setup/mne/coil_def.dat, which is automatically created by the utility

mne_list_coil_def when the MNE software is initially conļ¬gured, see

Section 5.8.5.

Id Description

2 Neuromag-122 planar gradiometer

2000 A point magnetometer

3012 Vectorview type 1 planar gradiometer

3013 Vectorview type 2 planar gradiometer

3022 Vectorview type 1 magnetometer

3023 Vectorview type 2 magnetometer

3024 Vectorview type 3 magnetometer

2000 An ideal point magnetometer

4001 Magnes WH magnetometer

4002 Magnes WH 3600 axial gradiometer

2

1

2

2

4

4

4

1

4

8

n

(

(

(

(

(

(

(

± (

)mm

±

8.4

, ,

±

8.4

±

6.45

±

6.45

±

5.25

(0,0,0)

, ,

±

5.75

,

,

,

,

r/mm

)mm

)mm

)mm

±

6.45

±

6.45

±

5.25

±

5.75

,

,

,

,

0.3

0.3

0.3

0.0

)mm

)mm

)mm

)mm

(

( ±

4.5

,

±

4.5

,

±

4.5

,

0.0

)mm

±

4.5

,

50.0

)mm

±

1

±

±

1

w

1 16.2mm

1 16.8mm

1 16.8mm

1

4

Table 5.2 Normal coil descriptions. Note: If a plus-minus sign occurs in several coordinates, all possible combinations have to be included.

MSH-MNE 103

5

The forward solution

Id

4005

5001

Description

4003 Magnes reference magnetometer

4004 Magnes reference gradiometer measuring diagonal gradients

Magnes reference gradiometer measuring offdiagonal gradients

CTF 275 axial gradiometer

4

8

8

8

n

(

(

( ±

7.5

,

±

±

20

20

,

,

±

±

r/mm

±

7.5

,

0

)mm

20

20

,

,

0.0

135

)mm

)mm

(

87.5

, ±

20

,

0.0

)mm

(

47.5

, ±

Ė™

20

,

0.0

) mm

(

– 87.5

, ±

20

,

0.0

)mm

(

– 47.5

,

Ė™

20

,

0.0

) mm

( ±

4.5

,

( ±

4.5

,

±

4.5

,

0.0

)mm

±

4.5

,

50.0

)mm

( ±

4

,

4

)mm

1

1

1

1

4

4

4

4

w

5002 CTF reference magnetometer

5003 CTF reference gradiometer measuring diagonal gradients

5004 CTF reference gradiometer measuring off-diagonal gradients

6001 MIT KIT system axial gradiometer

4

8

8

8

(

(

±

±

8.6

8.6

,

,

±

±

8.6

8.6

,

,

0.0

)mm

78.6

)mm

– 1

4

(

47.8

, ±

8.5

,

0.0

)mm

(

30.8

, ±

Ė™

8.5

,

0.0

) mm

(

– 47.8

, ±

8.5

,

0.0

)mm

(

– 30.8

, ±

Ė™

8.5

,

0.0

) mm

( ±

3.875

,

( ±

3.875

,

±

3.875

,

±

3.875

,

0.0

)mm

50.0

)mm

– 1

4

– 1

4

– 1

4

Table 5.2 Normal coil descriptions. Note: If a plus-minus sign occurs in several coordinates, all possible combinations have to be included.

2

Id

2000

Description

Neuromag-122 planar gradiometer

A point magnetometer

3012 Vectorview type 1 planar gradiometer

8

1

8

n r/mm

( ±

5.44

,

( ±

11.1

,

±

7.68

,

±

7.68

,

0

)mm

0

)mm

,

( )mm

( ±

5.89

,

( ±

10.8

,

±

6.71

,

±

6.71

,

0.3

)mm

,

0.3

)mm

Table 5.3 Accurate coil descriptions

w

±

1

⁄ (

4 16.54mm

)

1

±

1

⁄ (

4 16.69mm

)

104 MSH-MNE

The forward solution

5

Id

3013 Vectorview type 2

3022

3023

3024

4001

4002

Description

planar gradiometer

Vectorview type 1 magnetometer

Vectorview type 2 magnetometer

Vectorview type 3 magnetometer

Magnes WH magnetometer

Magnes WH 3600 axial gradiometer

8

7

n

16

16

16

14

r/mm

( ±

5.89

,

( ±

10.8

,

±

6.71

,

±

6.71

,

0.3

)mm

0.3

)mm

,

( ±

9.68

,

( ±

3.23

,

±

9.68

,

(

( ±

9.68

,

±

3.23

,

±

3.23

,

±

9.68

,

±

3.23

,

0.3

)mm

0.3

)mm

0.3

)mm

0.3

)mm

,

( ±

9.68

,

( ±

3.23

,

±

9.68

,

(

( ±

9.68

,

±

3.23

,

±

3.23

,

±

9.68

,

±

3.23

,

0.3

)mm

0.3

)mm

0.3

)mm

0.3

)mm

,

( ±

7.88

,

( ±

2.63

,

±

7.88

,

(

( ±

7.88

,

±

2.63

,

±

2.63

,

±

7.88

,

±

2.63

,

0.3

)mm

0.3

)mm

0.3

)mm

0.3

)mm

,

( )mm

(

( ±

9.390

,

0.0 0.0

)mm

±

4.695

, ±

8.132

,

0.0

)mm

(

( )mm

±

7.348

,

0.0 0.0

)mm

(

( ±

3.674

, ±

6.364

,

0.0

)mm

)mm

(

( ±

7.348

,

0.0 50.0

)mm

±

3.674

, ±

6.364

,

50.0

)mm

(

( ±

20

, ±

20

,

0.0

)mm

±

20

, ±

20

,

135

)mm

w

±

1

⁄ (

4 16.69mm

)

1

4

– 1

8

1

8

1

4

4004 Magnes reference gradiometer measuring diagonal gradients

4005 Magnes reference gradiometer measuring offdiagonal gradients

4004 Magnes reference gradiometer measuring diagonal gradients

8

8

8

(

(

(

87.5

, ±

20

,

0.0

)mm

(

(

47.5

, ±

Ė™

20

,

0.0

) mm

87.5

, ±

20

,

0.0

)mm

(

47.5

, ±

20

,

0.0

) mm

±

20

, ±

20

,

0.0

±

20

, ±

20

,

135

)mm

)mm

Table 5.3 Accurate coil descriptions

1

1

1

4

4

4

MSH-MNE 105

5

The forward solution

Id Description

5001 CTF 275 axial gradiometer

n

14

r/mm

( )mm

(

( ±

±

7.348

3.674

,

,

0.0 0.0

±

6.364

,

)mm

0.0

)mm

(

( ±

7.348

,

)mm

0.0 50.0

)mm

( ±

3.674

, ±

6.364

,

50.0

)mm

( ±

4

,

4

)mm

– 1

4

1

8

– 1

8

w

5002 CTF reference magnetometer

5003 CTF reference gradiometer measuring diagonal gradients

5004 CTF reference gradiometer measuring off-diagonal gradients

6001 MIT KIT system axial gradiometer

4

8

8

14

(

(

±

±

8.6

8.6

,

,

±

±

8.6

8.6

,

,

0.0

)mm

78.6

)mm

(

47.8

, ±

8.5

,

0.0

)mm

(

30.8

, ±

Ė™

8.5

,

0.0

) mm

(

– 47.8

, ±

8.5

,

0.0

)mm

(

– 30.8

, ±

Ė™

8.5

,

0.0

) mm

( )mm

(

( ±

6.328

,

0.0 0.0

±

3.164

, ±

5.48

,

)mm

0.0

)mm

(

( ±

6.328

,

)mm

0.0 50.0

)mm

( ±

3.164

, ±

5.48

,

50.0

)mm

Table 5.3 Accurate coil descriptions

1

1

1

1

1

1

4

4

4

4

8

8

5.8.4 The coil definition file

The coil geometry information is stored in the text ļ¬le $MNE_ROOT/ setup/mne/coil_def.dat. In this ļ¬le, any lines starting with the pound sign

(#) are comments. A coil deļ¬nition starts with a description line containing the following ļ¬elds:

<class>

This is a number indicating class of this coil. Possible values are

listed in Table 5.4.

<id>

Coil id value. This value is listed in the ļ¬rst column of Tables 5.2

and 5.3.

106 MSH-MNE

MSH-MNE

The forward solution

5

<accuracy>

The coil representation accuracy. Possible values and their mean-

ings are listed in Table 5.5.

<np>

Number of integration points in this representation.

<size/m>

The size of the coil. For circular coils this is the diameter of the coil and for square ones the side length of the square. This information is mainly included to facilitate drawing of the coil geometry. It should not be employed to infer a coil approximation for the forward calculations.

<baseline/m>

The baseline of a this kind of a coil. This will be zero for magnetometer coils. This information is mainly included to facilitate drawing of the coil geometry. It should not be employed to infer a coil approximation for the forward calculations.

<description>

Short description of this kind of a coil. If the description contains several words, it is enclosed in quotes.

Value

3

4

1

2

1000

Meaning

magnetometer ļ¬rst-order axial gradiometer planar gradiometer second-order axial gradiometer an EEG electrode (used internally in software only).

Table 5.4 Coil class values

1

2

3

Value Meaning

The simplest representation available

The standard or normal representation (see

Table 5.2)

The most accurate representation available

(see Table 5.3)

Table 5.5 Coil representation accuracies.

107

5

The forward solution

Each coil description line is followed by one or more integration point lines, consisting of seven numbers:

<weight>

Gives the weight for this integration point (last column in Tables 5.2

and 5.3).

<x/m> <y/m> <z/m>

Indicates the location of the integration point (fourth column in

Tables 5.2 and 5.3).

<nx> <ny> <nz>

Components of a unit vector indicating the ļ¬eld component to be selected. Note that listing a separate unit vector for each integration points allows the implementation of curved coils and coils with the gradiometer loops tilted with respect to each other.

5.8.5 Creating the coil definition file

The standard coil deļ¬nition ļ¬le $MNE_ROOT/setup/mne/coil_def.dat is automatically created during MNE software conļ¬guration (see

Section C.2.2). The conļ¬guration script uses the utility mne_list_coil_def,

which produces a the text of the coil deļ¬nition ļ¬le to the standard output.

Because this utility performs a software administration function, it is located in $MNE_ROOT/bin/admin and it is normally not on the search path.

5.9 Computing the forward solution

5.9.1 Purpose

Instead of using the convenience script mne_do_forward_solution it is also possible to invoke the forward solution computation program

mne_forward_solution directly. In this approach, the convenience of the automatic ļ¬le naming conventions present in mne_do_forward_solution are lost. However, there are some special-purpose options available in

mne_forward_solution only. Please refer to Section 3.11 for information

on mne_do_forward_solution.

5.9.2 Command line options

mne_forward_solution accepts the following command-line options:

108 MSH-MNE

MSH-MNE

The forward solution

5

--src <name>

Source space name to use. The name of the ļ¬le must be speciļ¬ed exactly, including the directory. Typically, the source space ļ¬les reside in $SUBJECTS_DIR/$SUBJECT/bem.

--bem <name>

Speciļ¬es the BEM to be used. These ļ¬les end with bem.ļ¬f or bem-

sol.ļ¬f

and reside in $SUBJECTS_DIR/$SUBJECT/bem. The former ļ¬le contains only the BEM surface information while the latter ļ¬les contain the geometry information precomputed with

mne_prepare_bem_model, see Section 5.7. If precomputed geome-

try is not available, the linear collocation solution will be computed by mne_forward_solution.

--origin <x/mm>:<x/mm>:<z/mm>

Indicates that the sphere model should be used in the forward calculations. The origin is speciļ¬ed in MEG head coordinates unless the

--mricoord

option is present. The MEG sphere model solution computed using the analytical Sarvas formula. For EEG, an approximative solution described in

--eegmodels <name>

This option is signiļ¬cant only if the sphere model is used and EEG channels are present. The speciļ¬ed ļ¬le contains speciļ¬cations of the

EEG sphere model layer structures as detailed in Section 5.9.4. If

this option is absent the ļ¬le $HOME/.mne/EEG_models will be consulted if it exists.

--eegmodel <model name>

Specifies the name of the sphere model to be used for EEG. If this option is missing, the model Default will be employed, see

Section 5.9.4.

--eegrad <radius/mm>

Speciļ¬es the radius of the outermost surface (scalp) of the EEG

sphere model, see Section 5.9.4. The default value is 90 mm.

--eegscalp

Scale the EEG electrode locations to the surface of the outermost sphere when using the sphere model.

--accurate

Use accurate MEG sensor coil descriptions. This is the recommended choice. More information

--ļ¬xed

Compute the solution for sources normal to the cortical mantle only.

This option should be used only for surface-based and discrete source spaces.

109

5

The forward solution

--all

Compute the forward solution for all vertices on the source space.

--label <name>

Compute the solution only for points within the speciļ¬ed label.

Multiple labels can be present. The label ļ¬les should end with lh.label

or -rh.label for left and right hemisphere label ļ¬les, respectively. If --all ļ¬‚ag is present, all surface points falling within the labels are included. Otherwise, only decimated points with in the label are selected.

--mindist <dist/mm>

Omit source space points closer than this value to the inner skull surface. Any source space points outside the inner skull surface are automatically omitted. The use of this option ensures that numerical inaccuracies for very superļ¬cial sources do not cause unexpected effects in the ļ¬nal current estimates. Suitable value for this parameter is of the order of the size of the triangles on the inner skull surface. If you employ the seglab software to create the triangulations, this value should be about equal to the wish for the side length of the triangles.

--mindistout <name>

Speciļ¬es a ļ¬le name to contain the coordinates of source space points omitted due to the --mindist option.

--mri <name>

The name of the MRI description ļ¬le containing the MEG/MRI coordinate transformation. This ļ¬le was saved as part of the align-

ment procedure outlined in Section 3.10. These ļ¬les typically reside

in $SUBJECTS_DIR/$SUBJECT/mri/T1-neuromag/sets.

--trans <name>

The name of a text ļ¬le containing the 4 x 4 matrix for the coordinate transformation from head to mri coordinates. With --trans, --mri option is not required.

--notrans

The MEG/MRI coordinate transformation is taken as the identity transformation, i.e., the two coordinate systems are the same. This option is useful only in special circumstances. If more than one of the --mri, --trans, and --notrans options are speciļ¬ed, the last one remains in effect.

--mricoord

Do all computations in the MRI coordinate system. The forward solution matrix is not affected by this option if the source orientations are ļ¬xed to be normal to the cortical mantle. If all three source components are included, the forward three source orientations parallel to the coordinate axes is computed. If --mricoord is present,

110 MSH-MNE

MSH-MNE

The forward solution

5

these axes correspond to MRI coordinate system rather than the default MEG head coordinate system. This option is useful only in special circumstances.

--meas <name>

This ļ¬le is the measurement ļ¬f ļ¬le or an off-line average ļ¬le produced thereof. It is recommended that the average ļ¬le is employed for evoked-response data and the original raw data ļ¬le otherwise.

This ļ¬le provides the MEG sensor locations and orientations as well as EEG electrode locations as well as the coordinate transformation between the MEG device coordinates and MEG head-based coordinates.

--fwd <name>

This ļ¬le will contain the forward solution as well as the coordinate transformations, sensor and electrode location information, and the source space data. A name of the form <name>-fwd.ļ¬f is recommended.

--meg

Compute the MEG forward solution.

--eeg

Compute the EEG forward solution.

--grad

Include the derivatives of the ļ¬elds with respect to the dipole posi-

tion coordinates to the output, see Section 5.9.6.

5.9.3 Implementation of software gradient compensation

As described in Section 9.2.4 the CTF and 4D Neuroimaging data may

have been subjected to noise cancellation employing the data from the reference sensor array. Even though these sensor are rather far away from the brain sources, mne_forward_solution takes them into account in the computations. If the data ļ¬le speciļ¬ed with the --meas option has software gradient compensation activated, mne_forward_solution computes the ļ¬eld of at the reference sensors in addition to the main MEG sensor array and computes a compensated forward solution using the methods desci-

bed in Section 9.2.4.

Warning: If a data ļ¬le speciļ¬ed with the --meas option and that used in the actual inverse computations with mne_analyze and mne_make_movie have different software gradient compensation states., the forward solution will be in mismatch with the data to be analyzed and the current estimates will be slightly erroneous.

111

5

The forward solution

5.9.4 The EEG sphere model definition file

For the computation of the electric potential distribution on the surface of the head (EEG) it is necessary to deļ¬ne the conductivities ( ) and radiuses of the spherically symmetric layers. Different sphere models can be speciļ¬ed with the --eegmodels option.

The EEG sphere model deļ¬nition ļ¬les may contain comment lines starting with a # and model deļ¬nition lines in the following format:

<name>:<radius1>:<conductivity1>:<radius2>:<conductivity2>:...

When the ļ¬le is loaded the layers are sorted so that the radiuses will be in ascending order and the radius of the outermost layer is scaled to 1.0. The scalp radius speciļ¬ed with the --eegrad option is then consulted to scale the model to the correct dimensions. Even if the model setup ļ¬le is not present, a model called Default is always provided. This model has the

structure given in Table 5.6

Layer

Head

Skull

CSF

Brain

Relative outer radius

1.0

0.97

0.92

0.90

0.33

0.04

1.0

0.33

σ

(S/m)

Table 5.6 Structure of the default EEG model

112

5.9.5 EEG forward solution in the sphere model

When the sphere model is employed, the computation of the EEG solution can be substantially accelerated by using approximation methods

described by Mosher, Zhang, and Berg, see Section 13.3 (Mosher et al.

and references therein). mne_forward_solution approximates the solution with three dipoles in a homogeneous sphere whose locations and amplitudes are determined by minimizing the cost function:

1

r

m

µ

1

… µ

m

)

=

∫ scalp

(

V

true

V

approx where

r

1

m

and

µ

1

… µ approximating dipoles and

V m

true

are the locations and amplitudes of the

and

V

approx

are the potential distributions given by the true and approximative formulas, respectively. It can be shown that this integral can be expressed in closed form using an expansion of the potentials in spherical harmonics. The formula is evaluated for

MSH-MNE

The forward solution

5

the most superļ¬cial dipoles, i.e., those lying just inside the inner skull surface.

5.9.6 Field derivatives

If the --grad option is speciļ¬ed, mne_forward_solution includes the derivatives of the forward solution with respect to the dipole location coordinates to the output ļ¬le. Let

G

k

=

g

xk

g

yk

g

zk

be the

N

chan

×

3 matrix containing the signals produced by three orthogonal dipoles at location

r

k

making up

N

chan source the gain matrix

G

=

G

1

G

N

source

.

With the --grad option, the output from mne_forward_solution also contains the

N

chan

9 source

derivative matrix

D

=

D

1

D

N

source

, where

D

k

=

g

x k

g

y k

g

z xk k

g

x k

g

y k

g

z yk k

g

x zk k

g

y k

g

z k

where

x k k

and z dimensions of

G

G

k

are the location coordinates of the

and

D

D

are

N

chan

N

source

and chan

k

th

dipole. If the dipole orientations are to the cortical normal with the --ļ¬xed option, the

×

N

×

3N source

, respectively. Both and can be read with the mne_read_forward_solution

Matlab function, see Table 10.1.

MSH-MNE

5.10 Averaging forward solutions

5.10.1 Purpose

One possibility to make a grand average over several runs of a experiment is to average the data across runs and average the forward solutions accordingly. For this purpose, mne_average_forward_solutions computes a weighted average of several forward solutions. The program averages

113

5

The forward solution both MEG and EEG forward solutions. Usually the EEG forward solution is identical across runs because the electrode locations do not change.

5.10.2 Command line options

mne_average_forward_solutions accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--fwd <name>:[<weight>]

Speciļ¬es a forward solution to include. If no weight is speciļ¬ed, 1.0

is asssumed. In the averaging process the weights are divided by their sum. For example, if two forward solutions are averaged and their speļ¬ed weights are 2 and 3, the average is formed with a weight of 2/5 for the ļ¬rst solution and 3/5 for the second one.

--out <name>

Speciļ¬es the output ļ¬le which will contain the averaged forward solution.

114 MSH-MNE

6

C H A P T E R 6

The current estimates

6.1 Overview

This Chapter describes the computation of the minimum-norm estimates.

This is accomplished with two programs: mne_inverse_operator and

mne_make_movie. The chapter starts with a mathematical description of the method, followed by description of the two software modules. The interactive program for inspecting data and inverse solutions,

mne_analyze, is covered in Chapter 7.

6.2 Minimum-norm estimates

This section describes the mathematical details of the calculation of minimum-norm estimates. In Bayesian sense, the ensuing current distribution is the maximum a posteriori (MAP) estimate under the following assumptions:

1. The viable locations of the currents are constrained to the cortex.

Optionally, the current orientations can be ļ¬xed to be normal to the cortical mantle.

2. The amplitudes of the currents have a Gaussian prior distribution with a known source covariance matrix.

3. The measured data contain additive noise with a Gaussian distribution with a known covariance matrix. The noise is not correlated over time.

MSH-MNE

6.2.1 The linear inverse operator

The measured data in the source estimation procedure consists of MEG and EEG data, recorded on a total of N channels. The task is to estimate a total of M strengths of sources located on the cortical mantle. If the number of source locations is P, M = P for ļ¬xed-orientation sources and M =

3P if the source orientations are unconstrained. The regularized linear inverse operator following from the Bayesian approach is given by the

M

×

N

matrix

M

=

R'G

T

(

GR'G

T

+

C

)

– 1

,

115

6

The current estimates where G is the gain matrix relating the source strengths to the measured

MEG/EEG data, C is the data noise-covariance matrix and

R'

is the source covariance matrix. The dimensions of these matrices are

N

×

N

, and

M

×

M

, respectively. The obtained by multiplying the

N

×

1

M

×

1

data vector by M.

N

×

M

source-strength vector is

,

The expected value of the current amplitudes at time t is then given by

j

ˆ t()

=

( )

, where

( )

is a vector containing the measured MEG and

EEG data values at time t.

6.2.2 Regularization

The a priori variance of the currents is, in practise, unknown. We can express this by writing

R'

=

R

⁄ λ

2

, which yields the inverse operator

M

=

RG

T

(

GRG

T

+

λ

2

C

)

1

, where the unknown current amplitude is now interpreted in terms of the regularization parameter

λ

2

. Small

λ

2

corresponds to large current amplitudes and complex estimate current patterns while a large

λ

2

means the amplitude of the current is limited and a simpler, smooth, current estimate is obtained.

We can arrive in the regularized linear inverse operator also by minimizing the cost function

=

˜

T

S

e

˜

e

+

λ

2

j

T

R

– 1

j,

where the ļ¬rst term consists of the difference between the whitened mea-

sured data (see Section 6.2.3) and those predicted by the model while the

second term is a weighted-norm of the current estimate. It is seen that,

2 with increasing

λ

, the source term receive more weight and larger discrepancy between the measured and predicted data is tolerable.

6.2.3 Whitening and scaling

The MNE software employs data whitening so that a ‘whitened’ inverse operator assumes the form

˜

M

=

˜

RG

T

ļ£«

ļ£­

˜

G

˜

RG

T

+

I

ļ£ø

ļ£¶

– 1

, where

˜

G

=

C

– 1 2 current values are

j

G

ˆ t()

is the spatially whitened gain matrix. The expected

=

( )

, where

˜

x

t

=

C

– 1 2

is a the whitened measurement vector at t. The spatial whitening operator is obtained

116 MSH-MNE

MSH-MNE

The current estimates

6

with the help of the eigenvalue decomposition

C

– 1 2

=

Λ

– 1

C

T

U

C

C

=

U

C

Λ

2

C

U

T

C

as

. In the MNE software the noise-covariance matrix is stored as the one applying to raw data. To reļ¬‚ect the decrease of noise due to averaging, this matrix,

C

0

, is scaled by the number of averages, L, i.e.,

C

=

C

0

L

.

As shown above, regularization of the inverse solution is equivalent to a change in the variance of the current amplitudes in the Bayesian a priori distribution.

Convenient choice for the source-covariance matrix

R

is such that

λ

2

(

˜

RG

T

)

⁄ trace I

=

1

. With this choice we can approximate

, where SNR is the (power) signal-to-noise ratio of the whitened data.

Note: The deļ¬nition of the signal to noise-ratio/

λ

2

relationship given above works nicely for the whitened forward solution. In the un-whitened case scaling with the trace ratio

T

)

⁄ trace C

does not make sense, since the diagonal elements summed have, in general, different units of measure. For example, the MEG data are expressed in T or T/m whereas the unit of EEG is Volts.

6.2.4 Regularization of the noise-covariance matrix

Since ļ¬nite amount of data is usually available to compute an estimate of the noise-covariance matrix

C

, the smallest eigenvalues of its estimate are usually inaccurate and smaller than the true eigenvalues. Depending on the seriousness of this problem, the following quantities can be affected:

1. The model data predicted by the current estimate,

2. Estimates of signal-to-noise ratios, which lead to estimates of the

required regularization, see Section 6.2.2,

3. The estimated current values, and

4. The noise-normalized estimates, see Section 6.2.6.

Fortunately, the latter two are least likely to be affected due to regularization of the estimates. However, in some cases especially the EEG part of the noise-covariance matrix estimate can be deļ¬cient, i.e., it may possess very small eigenvalues and thus regularization of the noise-covariance matrix is advisable.

The MNE software accomplishes the regularization by replacing a noisecovariance matrix estimate

C

with

C

=

C

+

k

ε

k

σ

2

k

I

,

117

6

The current estimates where the index goes across the different channel groups (MEG planar gradiometers, MEG axial gradiometers and magnetometers, and EEG),

σ

2

ε

k

are the corresponding regularization factors, are the average variances

I

k

across the channel groups, and are diagonal matrices containing ones at the positions corresponding to the channels contained in each channel group. The values

ε

k

can be adjusted with the regularization options -magreg

, --gradreg, and --eegreg speciļ¬ed at the time of the

inverse operator decomposition, see Section 6.4. The convenience script

mne_do_inverse_solution has the --magreg and --gradreg combined

to a sigle option, --megreg, see Section 3.13. Suggested range of values

for

ε

k

is

0.05

…0.2

.

6.2.5 Computation of the solution

The most straightforward approach to calculate the MNE is to employ expression for the original or whitened inverse operator directly. However, for computational convenience we prefer to take another route, which employs the singular-value decomposition (SVD) of the matrix

=

˜

A G R

=

U

ΛV

T

where the superscript

indicates a square root of

R

. For a diagonal matrix, one simply takes the square root of

R

while in the more general

T

case one can use the Cholesky factorization

R

C

and thus

R

=

R

C

.

R

=

R

C

With the above SVD it is easy to show that

˜

M

=

R V

ΓU

T

With w t =

U

T

C

1 2

γ

k

=

λ

k

λ

2

k

----------------- .

λ

2

k

+

λ

2

the expression for the expected current is

j

ˆ t()

=

R

C

V

Γw t

=

k

v

k

γ

k w k

where

v

k

=

R

C

v

k

,

v

k

being the kth column of V. It is thus seen that the current estimate is a weighted sum of the ‘modiļ¬ed’ eigenleads

v

k

.

118 MSH-MNE

MSH-MNE

The current estimates

6

It is easy to see that

(

˜

RG

directly that

T

j

)

⁄ trace I

With this approach,

ˆ t()

λ

k

=

1

w t

when

L

L

L

. To maintain the relation

changes we must have

L

R

λ

1 L

.

6.2.6 Noise normalization

The noise-normalized linear estimates introduced by Dale et al. require division of the expected current amplitude by its variance. Noise normalization serves three purposes:

1. It converts the expected current value into a dimensionless statistical test variable. Thus the resulting time and location dependent values are often referred to as dynamic statistical parameter maps (dSPM).

2. It reduces the location bias of the estimates. In particular, the tendency of the MNE to prefer superļ¬cial currents is eliminated.

3. The width of the point-spread function becomes less dependent on the source location on the cortical mantle. The point-spread is deļ¬ned as the MNE resulting from the signals coming from a point current source

(a current dipole) located at a certain point on the cortex.

In practice, noise normalization requires the computation of the diagonal elements of the matrix

MCM

T

=

˜

M

˜

M

T

.

With help of the singular-value decomposition approach we see directly that

˜

M

˜

M

T

=

V

Γ

2

V

T

.

Under the conditions expressed at the end of Section 6.2.5, it follows that

the t-statistic values associated with ļ¬xed-orientation sources) are thus proportional to

L

while the F-statistic employed with free-orientation

Note: A section discussing statistical considerations related to the noise normalization procedure will be added to this manual in one of the subsequent releases.

Note: The MNE software usually computes the square roots of the F-statistic to be displayed on the inļ¬‚ated cortical surfaces. These are also proportional to

L

.

119

6

The current estimates

6.2.7 Predicted data

Under noiseless conditions the SNR is inļ¬nite and thus leads to

λ

2

=

0 and the minimum-norm estimate explains the measured data perfectly.

Under realistic conditions, however,

λ

2

>

0

and there is a misļ¬t between measured data and those predicted by the MNE. Comparison of the predicted data, here denoted by

( )

, and measured one can give valuable insight on the correctness of the regularization applied.

In the SVD approach we easily ļ¬nd

x

=

Gj

ˆ t()

=

C U

Πw t where the diagonal matrix

Π

has elements

π

k

=

λ

k

γ

k

The predicted data is thus expressed as the weighted sum of the ‘recolored eigenļ¬elds’ in

C U

.

6.2.8 Cortical patch statistics

If the --cps option was used in source space creation (see Section 3.5)

or if mne_add_patch_info described in Section 11.7 was run manually the

source space ļ¬le will contain for each vertex of the cortical surface the information about the source space point closest to it as well as the distance from the vertex to this source space point. The vertices for which a given source space point is the nearest one deļ¬ne the cortical patch associated with with the source space point. Once these data are available, it is straightforward to compute the following cortical patch statistics (CPS)

120

1. The average over the normals of at the vertices in a patch,

n

d

,

2. The areas of the patches,

A d

, and

3. The average deviation of the vertex normals in a patch from their average,

σ

d

, given in degrees.

6.2.9 The orientation constraints

The principal sources of MEG and EEG signals are generally believed to be postsynaptic currents in the cortical pyramidal neurons. Since the net primary current associated with these microscopic events is oriented normal to the cortical mantle, it is reasonable to use the cortical normal orientation as a constraint in source estimation. In addition to allowing completely free source orientations, the MNE software implements three orientation constraints based of the surface normal data:

1. Source orientation can be rigidly ļ¬xed to the surface normal direction

(the --fixed option). If cortical patch statistics are available the average normal over each patch,

n

d

, are used to deļ¬ne the source orienta-

MSH-MNE

The current estimates

6

tion. Otherwise, the vertex normal at the source space location is employed.

2. A location independent or ļ¬xed loose orientation constraint (fLOC) can be employed (the --loose option). In this approach, a source coordinate system based on the local surface orientation at the source location is employed. By default, the three columns of the gain matrix

G, associated with a given source location, are the ļ¬elds of unit dipoles pointing to the directions of the x, y, and z axis of the coordinate system employed in the forward calculation (usually the MEG head coordinate frame). For LOC the orientation is changed so that the ļ¬rst two source components lie in the plane normal to the surface normal at the source location and the third component is aligned with it. Thereafter, the variance of the source components tangential to the cortical surface are reduced by a factor deļ¬ned by the --loose option.

3. A variable loose orientation constraint (vLOC) can be employed (the

--loosevar

option). This is similar to fLOC except that the value given with the --loosevar option will be multiplied by

σ

d

, deļ¬ned above.

6.2.10 Depth weighting

The minimum-norm estimates have a bias towards superļ¬cial currents.

This tendency can be alleviated by adjusting the source covariance matrix

R to favor deeper source locations. In the depth weighting scheme employed in MNE analyze, the elements of R corresponding to the

p

th source location are be scaled by a factor

f p

=

(

T

g

1p

g

1p

+

T

g

2p

g

2p

+

T

g

3p

g

3p

)

γ

, where

g

1p

, g

2p

, and g

p

γ

3p

are the three colums of

G

corresponding to source location and is the order of the depth weighting, speciļ¬ed with the --weightexp option to mne_inverse_operator. The maximal amount of depth weighting can be adjusted --weightlimit option.

MSH-MNE

6.2.11 fMRI-guided estimates

The fMRI weighting in MNE software means that the source-covariance matrix is modiļ¬ed to favor areas of signiļ¬cant fMRI activation. For this purpose, the fMRI activation map is thresholded ļ¬rst at the value deļ¬ned by the --fmrithresh option to mne_do_inverse_operator or

mne_inverse_operator. Thereafter, the source-covariance matrix values corresponding to the the sites under the threshold are multiplied by

f

off

, set by the --fmrioff option.

It turns out that the fMRI weighting has a strong inļ¬‚uence on the MNE but the noise-normalized estimates are much less affected by it.

121

6

The current estimates

6.3 Effective number of averages

It is often the case that the epoch to be analyzed is a linear combination over conditions rather than one of the original averages computed. As stated above, the noise-covariance matrix computed is originally one corresponding to raw data. Therefore, it has to be scaled correctly to correspond to the actual or effective number of epochs in the condition to be analyzed. In general, we have

C

=

C

0

L

eff where

L

eff

is the effective number of averages. To calculate arbitrary linear combination of conditions

L

eff

for an

=

n

i

=

1

w i x i

we make use of the the fact that the noise-covariance matrix

C

y

=

n

i

= 1

w i

2

C

x i

=

C

0

n

i

= 1

w i

2 ⁄

L i

which leads to eff

=

n

i

=

1

w i

2 ⁄

L i

An important special case of the above is a weighted average, where

w i

=

L i

n

i

= 1

L i

and, therefore

L

eff

=

n

i

=

1

L i

122 MSH-MNE

MSH-MNE

The current estimates

6

Instead of a weighted average, one often computes a weighted sum, a simplest case being a difference or sum of two categories. For a difference

w

1

=

1

and

w

2

= –

1

and thus eff

=

1

+

2 or

L

eff

= ------------------

L

L

1

1

+

L

L

2

Interestingly, the same holds for a sum, where

w

1

=

w

2

=

1 izing, for any combination of sums and differences, where

w i

= –

1

,

i

=

1

n

, we have

. General-

w i

=

1

or eff

=

n

i

= 1

i

6.4 Inverse-operator decomposition

The program mne_inverse_operator calculates the decomposition

A

=

˜

G R

C

=

U

ΛV

T

, described in Section 6.2.5. It is normally invoked

from the convenience script mne_do_inverse_operator. This section describes the options to mne_inverse_operator should a user need to invoke it directly for special-purpose processing.

The command-line options of mne_inverse_operator are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--meg

Employ MEG data in the calculation of the estimates.

--eeg

Employ EEG data in the calculation of the estimates. Note: The

EEG computations have not been throughly tested at this time.

--ļ¬xed

Use ļ¬xed source orientations normal to the cortical mantle. By default, the source orientations are not constrained.

123

6

The current estimates

--loose <amount>

Employ a loose orientation constraint (LOC). This means that the source covariance matrix entries corresponding to the current component normal to the cortex are set equal to one and the transverse components are set to <amount>. Recommended value of amount is 0.2…0.6.

--loosevar <amount>

Use an adaptive loose orientation constraint. This option can be only employed if the source spaces included in the forward solution have

the patch information computed, see Section 3.5. Blaa blaa...

--fwd <name>

Speciļ¬es the name of the forward solution to use.

--senscov <name>

Speciļ¬es the name of the noise-covariance matrix to use. If this ļ¬le contains a projection operator, attached by mne_browse_raw and

mne_process_raw, no additional projection vectors can be added with the --proj option.

--gradreg <value>

Regularize the planar gradiometer section (channels for which the unit of measurement is T/m) of the noise-covariance matrix by the given amount. The value is restricted to the range 0...1. For details,

see Section 6.2.4.

--magreg <value>

Regularize the magnetometer and axial gradiometer section (channels for which the unit of measurement is T) of the noise-covariance matrix by the given amount. The value is restricted to the range

0...1. For details, see Section 6.2.4.

--eegreg <value>

Regularize the EEG section of the noise-covariance matrix by the given amount. The value is restricted to the range 0...1. For details,

see Section 6.2.4.

--diagnoise

Omit the off-diagonal terms from the noise-covariance matrix in the computations. This may be useful if the amount of signal-free data has been insufļ¬cient to calculate a reliable estimate of the full noisecovariance matrix.

--srccov <name>

Speciļ¬es the name of the diagonal source-covariance matrix to use.

By default the source covariance matrix is a multiple of the identity matrix. This option can be employed to incorporate the fMRI constraint. The software to create a source-covariance matrix ļ¬le from

124 MSH-MNE

MSH-MNE

The current estimates

6

fMRI data will be provided in a future release of this software package.

--depth

Employ depth weighting. For details, see Section 6.2.10.

--weightexp <value>

This parameter determines the steepness of the depth weighting

function (default = 0.8). For details, see Section 6.2.10.

--weightlimit <value>

Maximum relative strength of the depth weighting (default = 10).

For details, see Section 6.2.10.

--fmri <name>

With help of this w ļ¬le, an a priori weighting can be applied to the source covariance matrix. The source of the weighting is usually fMRI but may be also some other data, provided that the weighting can be expressed as a scalar value on the cortical surface, stored in a w ļ¬le. It is recommended that this w ļ¬le is appropriately smoothed

(see Section 8.3) in mne_analyze, tksurfer or with mne_smooth_w

to contain nonzero values at all vertices of the triangular tessellation of the cortical surface. The name of the ļ¬le given is used as a stem of the w ļ¬les. The actual ļ¬les should be called <name>-lh.pri

and <name>-rh.pri for the left and right hemsphere weight ļ¬les, respectively. The application of the weighting is discussed in

Section 6.2.11.

--fmrithresh <value>

This option is mandatory and has an effect only if a weighting function has been speciļ¬ed with the --fmri option. If the value is in the a priori ļ¬les falls below this value at a particular source space point, the source covariance matrix values are multiplied by the value speciļ¬ed with the --fmrioff option (default 0.1). Otherwise it is left unchanged.

--fmrioff <value>

The value by which the source covariance elements are multiplied if the a priori weight falls below the threshold set with -fmrithresh

, see above.

--bad <name>

A text ļ¬le to designate bad channels, listed one channel name on each line of the ļ¬le. If the noise-covariance matrix speciļ¬ed with the --senscov option contains projections, bad channel lists can be included only if they specify all channels containing non-zero entries in a projection vector. For example, bad channels can usually specify all magnetometers or all gradiometers since the projection vectors for these channel types are completely separate. Similarly, it is possible to include MEG data only or EEG data only by using

125

6

The current estimates only one of --meg or --eeg options since the projection vectors for MEG and EEG are always separate.

--surfsrc

Use a source coordinate system based on the local surface orientation at the source location. By default, the three dipole components are pointing to the directions of the x, y, and z axis of the coordinate system employed in the forward calculation (usually the MEG head coordinate frame). This option changes the orientation so that the ļ¬rst two source components lie in the plane normal to the surface normal at the source location and the third component is aligned with it. If patch information is available in the source space, the normal is the average patch normal, otherwise the vertex normal at the source location is used. If the --loose or --loosevar option is employed, --surfsrc is implied.

--exclude <name>

Exclude the source space points deļ¬ned by the given FreeSurfer

‘label’ ļ¬le from the source reconstruction. This is accomplished by setting the corresponding entries in the source-covariance matrix equal to zero. The name of the ļ¬le should end with -lh.label if it refers to the left hemisphere and with -rh.label if it lists points in the right hemisphere, respectively.

--proj <name>

Include signal-space projection (SSP) information from this ļ¬le. For

information on SSP, see Section 4.16. If the projections are present

in the noise-covariance matrix, the --proj option is not allowed.

--csd

Compute the inverse operator for surface current densities instead of the dipole source amplitudes. This requires the computation of patch statistics for the source space. Since this computation is time consuming, it is recommended that the patch statistics are precomputed and the source space ļ¬le containing the patch information is employed already when the forward solution is computed, see Sec-

tions 3.5 and 3.11. For technical details of the patch information,

please consult Section 6.2.8. This option is considered experimental

at the moment.

--inv <name>

Save the inverse operator decomposition here.

126

6.5 Producing movies and snapshots

mne_make_movie is a program for producing movies and snapshot graphics frames without any graphics output to the screen. In addition,

mne_make_movie can produce stc or w ļ¬les which contain the numerical

MSH-MNE

MSH-MNE

The current estimates

6

current estimate data in a simple binary format for postprocessing. These

ļ¬les can be displayed in mne_analyze, see Chapter 7, utilized in the cross-

subject averaging process, see Chapter 8, and read into Matlab using the

MNE Matlab toolbox, see Chapter 10.

The command-line options to mne_make_movie are explained in the following subsections.

6.5.1 General options

--version

Show the program version and compilation date.

--help

List the command-line options.

6.5.2 Input files

--inv <name>

Load the inverse operator decomposition from here.

--meas <name>

Load the MEG or EEG data from this ļ¬le.

--set <number>

The data set (condition) number to load. This is the sequential number of the condition. You can easily see the association by looking at the condition list in mne_analyze when you load the ļ¬le.

--stcin <name>

Speciļ¬es an stc ļ¬le to read as input.

6.5.3 Times and baseline

--tmin <time/ms>

Speciļ¬es the starting time employed in the analysis. If --tmin option is missing the analysis starts from the beginning of the epoch.

--tmax <time/ms>

Speciļ¬es the ļ¬nishing time employed in the analysis. If --tmax option is missing the analysis extends to the end of the epoch.

--tstep <step/ms>

Time step between consequtive movie frames, speciļ¬ed in milliseconds.

127

6

The current estimates

--integ <

āˆ†

t

/ms>

Integration time for each frame. Defaults to zero. The integration

t

will be performed on sensor data. If the time speciļ¬ed for a fram is

0

, the integration range will be

t

0

āˆ†

t 2

≤ ≤

t

0

+

āˆ†

t 2

.

--pick <time/ms>

Pick a time for the production of rgb, tif, jpg, png, or w ļ¬les. Several pick options may be present. The time must be with in the analysis interval, indicated by the --tmin and --tmax options. The -rgb

, --tif, --jpg, --png, and --w options control which ļ¬le types are actually produced. When a --pick option is encountered, the effect of any preceeding --pickrange option is ignored.

--pickrange

All previous -pick options will be ignored. Instead, snapshots are produced as indicated by the --tmin, --tmax, and --tstep options. This is useful, e.g., for producing input for scripts merging the individual graphics snapshots into a composite “ļ¬lmstrip” reprensentation. However, such scripts are not yet part of the MNE software.

--bmin <time/ms>

Speciļ¬es the starting time of the baseline. In order to activate baseline correction, both --bmin and --bmax options must be present.

--bmax <time/ms>

Speciļ¬es the ļ¬nishing time of the baseline.

--baselines <ļ¬le_name>

Speciļ¬es a ļ¬le which contains the baseline settings. Each line of the ļ¬le should contain a name of a channel, followed by the baseline value, separated from the channel name by a colon. The baseline values must be speciļ¬ed in basic units, i.e., Teslas/meter for gradiometers, Teslas for magnetometers, and Volts for EEG channels. If some channels are missing from the baseline ļ¬le, warning messages are issued: for these channels, the --bmin and --bmax settings will be used.

128

6.5.4 Options controlling the estimates

--nave <value>

Speciļ¬es the effective number of averaged epochs in the input data,

L

eff

, as discussed in Section 6.3. If the input data ļ¬le is one pro-

duced by mne_browse_raw or mne_process_raw, the number of averages is correct in the ļ¬le. However, if subtractions or some more complicated combinations of simple averages are produced, e.g., by using the xplotter software, the number of averages should be man-

ually adjusted along the guidelines given in Section 6.3. This is

accomplished either by employing this ļ¬‚ag or by adjusting the num-

MSH-MNE

MSH-MNE

The current estimates

6

ber of averages in the data ļ¬le with help of the utility

mne_change_nave.

--snr <value>

An estimate for the amplitude SNR. The regularization parameter will be set as

λ

2

=

2

. The default value is SNR = 3. Automatic selection of the regularization parameter is currently not supported.

--spm

Calculate the dSPM instead of the expected current value.

--sLORETA

Calculate the noise-normalized estimate using the sLORETA approach. sLORETA solutions have in general a smaller location bias than either the expected current (MNE) or the dSPM.

--signed

Indicate the current direction with respect to the cortex outer normal by sign. Currents ļ¬‚owing out of the cortex are thus considered positive (warm colors) and currents ļ¬‚owing into the cortex negative

(cold colors).

--picknormalcomp

The components of the estimates corresponding to directions tangential with the cortical mantle are zeroed out.

6.5.5 Visualization options

--subject <subject>

Speciļ¬es the subject whose MRI data is employed in the visualization. This must be the same subject that was used for computing the current estimates. The environment variable SUBJECTS_DIR must be set to point to a locations where the subjects are to be found.

--morph <subject>

Morph the data to to the cortical surface of another subject. The

Quicktime movie, stc-ļ¬le, graphics snapshot, and w-ļ¬le outputs are affected by this option, i.e., they will take the morphing into account and will represent the data on the cortical surface of the subject deļ¬ned with this option. The stc ļ¬les morphed to a single subject’s cortical surface are used by mne_average_estimates to combine

data from different subjects, see Section 8.6. If morphing is selected

appropriate smoothing must be speciļ¬ed with the --smooth option. The morphing process can be made faster by precomputing the necessary morphing maps with mne_make_morph_maps, see

Section 8.4. More information about morphing and averaging can

be found in Chapter 8.

129

6

The current estimates

--morphgrade <number>

Adjusts the number of vertices in the stc ļ¬les produced when morphing is in effect. By default the number of vertices is 10242 corresponding to --morphgrade value 5. Allowed values are 3, 4, 5, and 6 corresponding to 642, 2562, 10242, and 40962 vertices, respectively.

--surface <surface name>

Name of the surface employed in the visualization. The default is

inļ¬‚ated.

--curv <name>

Specify a nonstandard curvature ļ¬le name. The default curvature ļ¬les are lh.curv and rh.curv. With this option, the names become lh.<name> and rh.<name>.

--patch <name>[:<angle/deg>]

Specify the name of a surface patch to be used for visualization instead of the complete cortical surface. A complete name of a patch ļ¬le in the FreeSurface surf directory must be given. The name should begin with lh or rh to allow association of the patch with a hemisphere. Maximum of two --patch options can be in effect, one patch for each hemisphere. If the name refers to a ļ¬‚at patch, the name can be optionally followed by a colon and a rotation angle in degrees. The ļ¬‚at patch will be then rotated counterclockwise by this amount before display. You can check a suitable value for the rotation angle by loading the patch interactively in mne_analyze.

--width <value>

Width of the graphics output frames in pixels. The default width is

600 pixels.

--height <value>

Height of the graphics output frames in pixels. The default height is

400 pixels.

--mag <factor>

Magnify the the visualized scene by this factor.

--lh

Select the left hemisphere for graphics output. By default, both hemisphere are processed.

--rh

Select the right hemisphere for graphics output. By default, both hemisphere are processed.

--view <name>

Select the name of the view for mov, rgb, and tif graphics output ļ¬les. The default viewnames, deļ¬ned in $MNE_ROOT/setup/

130 MSH-MNE

MSH-MNE

The current estimates

6

mne/mne_analyze/eyes

, are lat (lateral), med (medial), ven

(ventral), and occ (occipital). You can override these defaults by creating the directory .mne under your home directory and copying the eyes ļ¬le there. Each line of the eyes ļ¬le contais the name of the view, the viewpoint for the left hemisphere, the viewpoint for the right hemisphere, left hemisphere up vector, and right hemisphere up vector. The entities are separated by semicolons. Lines beginning with the pound sign (#) are considered to be comments.

--smooth <nstep>

Number of smoothsteps to take when producing the output frames.

Depending on the source space decimation, an appropriate number is 4 – 7. Smoothing does not have any effect for the original brain if stc ļ¬les are produced. However, if morphing is selected smoothing is mandatory even with stc output. For details of the smoothing pro-

cedure, see Section 8.3.

--nocomments

Do not include the comments in the image output ļ¬les or movies.

--noscalebar

Do not include the scalebar in the image output ļ¬les or movies.

6.5.6 Thresholding

--fthresh <value>

Speciļ¬es the threshold for the displayed colormaps. At the threshold, the overlayed color will be equal to the background surface

– 10 color. For currents, the value will be multiplied by

1

. The default value is 8.

--fmid <value>

Speciļ¬es the midpoint for the displayed colormaps. At this value, the overlayed color will be read (positive values) or blue (negative

– 10 values). For currents, the value will be multiplied by

1

. The default value is 15.

--fmax <value>

Speciļ¬es the maximum point for the displayed colormaps. At this value, the overlayed color will bright yellow (positive values) or light blue (negative values). For currents, the value will be multi-

– 10 plied by

1

. The default value is 20.

--fslope <value>

Included for backwards compatibility. If this option is speciļ¬ed and

--fmax

option is not speciļ¬ed,

F

max

=

F

mid

+

1 F slope

.

131

6

The current estimates

6.5.7 Output files

--mov <name>

Produce QuickTime movie ļ¬les. This is the ‘stem’ of the ouput ļ¬le name. The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere, -lh or -rh is then appended. The name of the view is indicated with -<viename>. Finally, .mov is added to indicate a

QuickTime output ļ¬le. The movie is produced for all times as dictated by the --tmin, --tmax, --tstep, and --integ options.

--qual <value>

Quality of the QuickTime movie output. The default quality is 80 and allowed range is 25 - 100. The size of the movie ļ¬les is a monotonously increasing function of the movie quality.

--rate <rate>

Speciļ¬es the frame rate of the QuickTime movies. The default value is

1

⁄ (

10t step

)

, where

t

step

is the time between subsequent movie frames produced in seconds.

--rgb <name>

Produce rgb snapshots. This is the ‘stem’ of the ouput ļ¬le name.

The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere, -lh or -rh is then appended. The name of the view is indicated with -<viename>. Finally, .rgb is added to indicate an rgb output ļ¬le. Files are produced for all picked times as dictated by the

--pick

and --integ options.

--tif <name>

Produce tif snapshots. This is the ‘stem’ of the ouput ļ¬le name. The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere,

-lh

or -rh is then appended. The name of the view is indicated with -<viename>. Finally, .tif is added to indicate an rgb output ļ¬le. Files are produced for all picked times as dictated by the -pick

and --integ options. The tif output ļ¬les are not compressed. Pass the ļ¬les through an image processing program to compress them.

--jpg <name>

Produce jpg snapshots. This is the ‘stem’ of the ouput ļ¬le name. The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere,

-lh

or -rh is then appended. The name of the view is indicated with -<viename>. Finally, .jpg is added to indicate an rgb output ļ¬le. Files are produced for all picked times as dictated by the -pick

and --integ options.

132 MSH-MNE

MSH-MNE

The current estimates

6

--png <name>

Produce png snapshots. This is the ‘stem’ of the ouput ļ¬le name.

The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere, -lh or -rh is then appended. The name of the view is indicated with -<viename>. Finally, .png is added to indicate an rgb output ļ¬le. Files are produced for all picked times as dictated by the

--pick

and --integ options.

--w <name>

Produce w ļ¬le snapshots. This is the ‘stem’ of the ouput ļ¬le name.

The actual name is derived by stripping anything upto and including the last period from the end of <name>. According to the hemisphere, -lh.w or -rh.w is then appended. Files are produced for all picked times as dictated by the --pick and --integ options.

--stc <name>

Produce stc ļ¬les for either the original subject or the one selected with the --morph option. These ļ¬les will contain data only for the decimated locations. If morphing is selected, appropriate smoothing is mandatory. The morphed maps will be decimated with help of a subdivided icosahedron so that the morphed stc ļ¬les will always contain 10242 vertices. These morphed stc ļ¬les can be easily averaged together, e.g., in Matlab since they always contain an identical set of vertices.

--norm <name>

Indicates that a separate w ļ¬le containing the noise-normalization values will be produced. The option --spm must also be present.

Nevertheless, the movies and stc ļ¬les output will contain MNE values. The noise normalization data ļ¬les will be called <name>-

<SNR>-lh.w

and <name>-<SNR>-rh.w.

6.5.8 Label processing

--label <name>

Speciļ¬es a label ļ¬le to process. For each label ļ¬le, the values of the computed estimates are listed in text ļ¬les. The label ļ¬les are produced by tksurfer or mne_analyze and specify regions of interests

(ROIs). A label ļ¬le name should end with -lh.label for lefthemisphere ROIs and with -rh.label for right-hemisphere ones.

The corresponding output ļ¬les are tagged with -lh-<data

type>.amp

and -rh-<data type>.amp, respectively. <data type> equals ‘mne’ for expected current data and ‘spm’ for dSPM data.

Each line of the output ļ¬le contains the waveform of the output quantity at one of the source locations falling inside the ROI. For more information about the label output formats, see

Section 7.13.3.1.

133

6

The current estimates

--labelcoords

Include coordinates of the vertices in the output. The coordinates will be listed in millimeters in the coordinate system which was speciļ¬ed for the forward model computations. This option cannot be used with stc input ļ¬les (--stcin) because the stc ļ¬les do not contain the coordinates of the vertices.

--labelverts

Include vertex numbers in the output. The numbers refer to the complete triangulation of the corresponding surface and are zero based.

The vertex numbers are by default on the ļ¬rst row or ļ¬rst column of the output ļ¬le depending on whether or not the --labeltimebytime

option is present.

--labeltimebytime

Output the label data time by time instead of the default vertex-byvertex output.

--labeltag <tag>

End the output ļ¬les with the speciļ¬ed tag. By default, the output ļ¬les will end with -mne.amp or -spm.amp depending on whether

MNE or one of the noise-normalized estimates (dSPM or sLORETA) was selected.

--labeloutdir <directory>

Speciļ¬es the directory where the output ļ¬les will be located. By default, they will be in the current working directory.

--labelcomments

Include comments in the output ļ¬les. The comment lines begin with the percent sign to make the ļ¬les compatible with Matlab.

--scaleby <factor>

By default, the current values output to the ļ¬les will be in the actual physical units (A/m). This option allows scaling of the current values to other units. mne_analyze typically uses 1e10 to bring the numbers to a human-friendly scale.

6.5.9 Using stc file input

The --stcin option allows input of stc ļ¬les. This feature has several uses:

1. QuickTime movies can be produced from existing stc ļ¬les without having to resort to EasyMeg.

2. Graphics snapshot can be produced from existing stc ļ¬les.

3. Existing stc ļ¬les can be temporally resampled with help of the -tmin

, --tmax, --tstep, and --integ options.

134 MSH-MNE

The current estimates

6

4. Existing stc ļ¬les can be morphed to another cortical surface by specifying the --morph option.

5. Timecourses can be inquired and stored into text ļ¬les with help of the

--label

options, see above.

6.6 Computing inverse from raw and evoked data

The purpose of the utility mne_compute_raw_inverse is to compute inverse solutions from either evoked-response or raw data at speciļ¬ed

ROIs (labels) and to save the results in a ļ¬f ļ¬le which can be viewed with

mne_browse_raw, read to Matlab directly using the MNE Matlab Tool-

box, see Chapter 10, or converted to Matlab format using either

mne_convert_mne_data, mne_raw2mat, or mne_epochs2mat, see

Chapter 9.

MSH-MNE

6.6.1 Command-line options

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <ļ¬lename>

Speciļ¬es the input data ļ¬le. This can be either an evoked data ļ¬le or a raw data ļ¬le.

--bmin <time/ms>

Speciļ¬es the starting time of the baseline. In order to activate baseline correction, both --bmin and --bmax options must be present.

This option applies to evoked data only.

--bmax <time/ms>

Speciļ¬es the ļ¬nishing time of the baseline. This option applies to evoked data only.

--set <number>

The data set (condition) number to load. This is the sequential number of the condition. You can easily see the association by looking at the condition list in mne_analyze when you load the ļ¬le.

--inv <name>

Load the inverse operator decomposition from here.

--nave <value>

Speciļ¬es the effective number of averaged epochs in the input data,

L

eff

, as discussed in Section 6.3. If the input data ļ¬le is one pro-

135

6

The current estimates duced by mne_browse_raw or mne_process_raw, the number of averages is correct in the ļ¬le. However, if subtractions or some more complicated combinations of simple averages are produced, e.g., by using the xplotter software, the number of averages should be man-

ually adjusted along the guidelines given in Section 6.3. This is

accomplished either by employing this ļ¬‚ag or by adjusting the number of averages in the data ļ¬le with help of the utility

mne_change_nave.

--snr <value>

An estimate for the amplitude SNR. The regularization parameter will be set as

λ

2

=

2

. The default value is SNR = 3. Automatic selection of the regularization parameter is currently not supported.

--spm

Calculate the dSPM instead of the expected current value.

--picknormalcomp

The components of the estimates corresponding to directions tangential with the cortical mantle are zeroed out.

--mricoord

Provide source locations and orientations in the MRI coordinate frame instead of the default head coordinate frame.

--label <name>

Speciļ¬es a label ļ¬le to process. For each label ļ¬le, the values of the computed estimates stored in a ļ¬f ļ¬le. For more details, see

Section 6.6.2. The label ļ¬les are produced by tksurfer or

mne_analyze and specify regions of interests (ROIs). A label ļ¬le name should end with -lh.label for left-hemisphere ROIs and with -rh.label for right-hemisphere ones. The corresponding output ļ¬les are tagged with -lh-<data type>.fif and -rh-

<data type>.fif, respectively. <data type> equals ‘mne’ for expected current data and ‘spm’ for dSPM data. For raw data,

_raw.fif

is employed instead of .fif. The output ļ¬les are stored in the same directory as the label ļ¬les.

--labelselout

Produces additional label ļ¬les for each label processed, containing only those vertices within the input label which correspond to available source space vertices in the inverse operator. These ļ¬les have the same name as the original label except that -lh and -rh are replaced by -sel-lh and -sel-rh, respectively.

--align_z

Instructs the program to try to align the waveform signs within the

label. For more information, see Section 6.6.2. This ļ¬‚ag will not

136 MSH-MNE

MSH-MNE

The current estimates

6

have any effect if the inverse operator has been computed with the strict orientation constraint active.

--labeldir <directory>

All previous --label options will be ignored when this option is encountered. For each label in the directory, the output ļ¬le deļ¬ned with the --out option will contain a summarizing waveform which is the average of the waveforms in the vertices of the label. The -labeldir

option implies --align_z and --picknormalcomp

options.

--out <name>

Required with --labeldir. This is the output ļ¬le for the data.

--extra <name>

By default, the output includes the current estimate signals and the digital trigger channel, see --digtrig option, below. With the -extra

option, a custom set of additional channels can be included.

The extra channel text ļ¬le should contain the names of these channels, one channel name on each line. With this option present, the digital trigger channel is not included unless speciļ¬ed in the extra channel ļ¬le.

--noextra

No additional channels will be included with this option present.

--digtrig <name>

Name of the composite digital trigger channel. The default value is

‘STI 014’. Underscores in the channel name will be replaced by spaces.

--split <size/MB>

Speciļ¬es the maximum size of the raw data ļ¬les saved. By default, the output is split into ļ¬les which are just below 2 GB so that the ļ¬f ļ¬le maximum size is not exceed.

Tip: The digital trigger channel can also be set with the

MNE_TRIGGER_CH_NAME environment variable. Underscores in the variable value will not be replaced with spaces by

mne_compute_raw_inverse. Using the --digtrig option supersedes the

MNE_TRIGGER_CH_NAME environment variable.

6.6.2 Implementation details

The ļ¬f ļ¬les output from mne_compute_raw_inverse have various ļ¬elds of the channel information set to facilitate interpretation by postprocessing software as follows:

137

6

The current estimates

channel name

Will be set to J[xyz] <number>, where the source component is indicated by the coordinat axis name and number is the vertex number, starting from zero, in the complete triangulation of the hemisphere in question.

logical channel number

Will be set to is the vertex number, starting from zero, in the complete triangulation of the hemisphere in question.

sensor location

The location of the vertex in head coordinates or in MRI coordinates, determined by the --mricoord ļ¬‚ag.

sensor orientation

The x-direction unit vector will point to the direction of the current.

Other unit vectors are set to zero. Again, the coordinate system in which the orientation is expressed depends on the --mricoord ļ¬‚ag.

The --align_z ļ¬‚ag tries to align the signs of the signals at different vertices of the label. For this purpose, the surface normals within the label are collected into a

n

vert

×

3

matrix. The preferred orientation will be taken as the ļ¬rst right singular vector of this matrix, corresponding to its largest singular value. If the dot product of the surface normal of a vertex is negative, the sign of the estimates at this vertex are inverted. The inversion is reļ¬‚ected in the current direction vector listed in the channel information, see above.

Tip: The raw data ļ¬les output by mne_compute_raw_inverse can be con-

verted to mat ļ¬les with mne_raw2mat, see Section 9.13. Alternatively, the

ļ¬les can be read directly from Matlab using the routines in the MNE Mat-

lab toolbox, see Chapter 10. The evoked data output can be easily read

directly from Matlab using the ļ¬ff_load_evoked routine in the MNE Matlab toolbox. Both raw data and evoked output ļ¬les can be loaded into

mne_browse_raw, see Chapter 4.

138 MSH-MNE

7

C H A P T E R 7

Interactive analysis

7.1 Overview

Interactive analysis of the MEG/EEG data and source estimates is facilitated by the mne_analyze tool. Its features include:

1. Viewing of evoked-response data or data segments in a topographical layout.

2. Alignment of MEG and head coordinate frames.

3. Display of maps of the magnetic ļ¬eld and electric potentials.

4. Computation and display of cortically-constrained minimum-norm current estimates and statistical maps derived from them. The solutions can be displayed on folded and inļ¬‚ated cortical surfaces as well as on curved and ļ¬‚attened surface patches.

5. Fitting of current dipoles to the data.

6. Connection to tkmedit (part of FreeSurfer) to display data on MRI slices.

7. Production of QuickTime™ movies and graphics snapshots in several image ļ¬le formats.

8. Connection to cliplab (part of Elekta-Neuromag software) to produce

graphics reports, see Section 7.20.

9. Inquiry and saving of source waveforms at selected surface points or within ROIs deļ¬ned by label ļ¬les.

10.On-line morphing of the current distributions.

11.Output of snapshots in w ļ¬le format.

12.Display of overlay data delivered in w and stc ļ¬le formats.

13.Creation of ROI (label) ļ¬les.

14.Viewing of continuous head-position data delivered by Elekta-Neuromag software.

7.2 Command line options

Since mne_analyze is primarily an interactive analysis tool, there are only a few command-line options:

--version

Show the program version and compilation date.

MSH-MNE 139

7

Interactive analysis

--help

List the command-line options.

--cd <dir>

Change to this directory before starting.

--subject <name>

Specify the default subject name for surface loading.

--digtrig <name>

Name of the digital trigger channel. The default value is ‘STI 014’.

Underscores in the channel name will be replaced by spaces.

--digtrigmask <number>

Mask to be applied to the raw data trigger channel values before considering them. This option is useful if one wants to set some bits in a don’t care state. For example, some ļ¬nger response pads keep the trigger lines high if not in use, i.e., a ļ¬nger is not in place. Yet, it is convenient to keep these devices permanently connected to the acquisition system. The number can be given in decimal or hexadecimal format (beginning with 0x or 0X). For example, the value 255

(0xFF) means that only the lowest order byte (usually trigger lines 1

- 8 or bits 0 - 7) will be considered.

Note: Before starting mne_analyze the SUBJECTS_DIR environment variable has to be set.

Note: Strictly speaking, trigger mask value zero would mean that all trigger inputs are ignored. However, for convenience, setting the mask to zero or not setting it at all has the same effect as 0xFFFFFFFF, i.e., all bits set.

Tip: The digital trigger channel can also be set with the

MNE_ENV_TRIGGER_CH environment variable. Underscores in the variable value will not be replaced with spaces by mne_analyze. Using the

--digtrig

option supersedes the MNE_ENV_TRIGGER_CH environment variable.

Tip: The digital trigger channel mask can also be set with the

MNE_TRIGGER_CH_MASK environment variable. Using the -digtrigmask

option supersedes the MNE_TRIGGER_CH_MASK environment variable.

140 MSH-MNE

MSH-MNE

Interactive analysis

7

2.

3.

7.3 The main window

1.

6.

8.

4.

7.

5.

Figure 7.1 The main window of mne_analyze.

The main window of mne_analyze shown in Figure 7.1 has the following

components:

1. The menu bar;

2. Display area for a sample response;

3. Display of the estimated SNR, see Section 7.12.2;

4. Display of a source waveform;

5. Message area, time-point selection text ļ¬eld, an ECD ļ¬t button, a text ļ¬eld for selecting a vertex on the surface, and a message text label;

6. Display area for the current estimates;

7. Controls for the current estimate display;

8. Topographical display of data.

7.4 The menus

7.4.1 The File menu

The File shown in Figure 7.2 contains the following items:

141

7

Interactive analysis

142

Figure 7.2 The File menu.

Open...

Load a new data set and an inverse operator. For details, see

Section 7.5.

Open raw...

Load epoch data from a raw data ļ¬le. For details, see Section 7.6.

Switch to data set...

If multiple data sets or epochs from a raw data ļ¬le are loaded, this menu item brings up a list to switch between the data sets or epochs.

Change working directory...

Change the working directory of this program. This will usually be the directory where your MEG/EEG data and inverse operator are located.

Load surface...

Load surface reconstructions for the subject whose data you are

analyzing, see Section 7.8.

Load morphing surface...

Load surface reconstructions of another subject for morphing, see

Section 7.9.

Load surface patch...

Load a curved or ļ¬‚attened surface patch, see Section 7.8.

Load morphing surface patch...

Load a curved or ļ¬‚attened surface patch for morphing, see

Section 7.9.

Load digitizer data...

Load digitizer data for coordinate frame alignment, see

Section 7.16.

MSH-MNE

Interactive analysis

7

View continuous HPI data...

Load a data ļ¬le containing continuous head position information,

see Section 7.17.

Manage overlays...

Bring up the overlay manager to import data from stc and w ļ¬les,

see Section 7.14.

Save bad channel selection

Save the current bad channel selection created in the topographical

data display, see Section 7.7.

Quit

Quit the program.

7.4.2 The Adjust menu

The contents of the Adjust menu is shown in Figure 7.3:

MSH-MNE

Figure 7.3 The Adjust menu.

Scales

Adjust the scales of the data display.

Estimates...

Adjust the properties of the displayed current estimates, see

Section 7.12.

Select trace layout...

Select the layout for the topographical display, see Section 7.7.

Lights...

Adjust the lighting of the scenes in the main display and the viewer,

see Sections 7.12 and 7.10.

Field mapping...

Adjust the ļ¬eld mapping preferences, see Section 7.11.

Coordinate alignment...

Establish a coordinate transformation between the MEG and MRI

coordinate frames, see Section 7.16.

143

7

Interactive analysis

7.4.3 The View menu

The contents of the ļ¬le menu is shown in Figure 7.4:

Figure 7.4 The View menu.

Show viewer...

Loads additional surfaces and pops up the viewer window. The

functions available in the viewer are discussed in Section 7.10.

Show MRI viewer...

Bring up the tkmedit program to view MRI slices, see Section 7.18.

Show coordinates...

Show the coordinates of a vertex, see Section 7.8.4.

Show timecourse manager...

Brings up the timecourse manager if some timecourses are avail-

able. Timecourses are discussed in Section 7.13.

7.4.4 The Labels menu

The contents of the Labels menu is shown in Figure 7.5. ROI analysis

with help of labels is discussed in detail in Section 7.13.

144

Figure 7.5 The Labels menu.

The label menu contains the following items:

Load label...

Loads one label ļ¬le for ROI analysis.

Load all labels...

Loads all label ļ¬les available in a directory for ROI analysis.

MSH-MNE

MSH-MNE

Interactive analysis

7

Load parcellation...

Load cortical parcellation data produced by FreeSurfer from directory $SUBJECTS_DIR/$SUBJECT/label and add the cortical regions deļ¬ned to the label list.

Show label list...

Shows a list of all currently loaded labels for ROI analysis.

Discard all labels

Discard all labels loaded so far. The label list window will be hidden.

Clear marked vertices

Clear the label outline or a label created interactively.

7.4.5 The Dipoles menu

The contents of the dipoles menu is shown in Figure 7.6:

Figure 7.6 The dipole ļ¬tting menu.

Setup ļ¬tting...

Deļ¬ne the dipole ļ¬tting parameters, see Section 7.15.1.

Show dipole list...

Show the list of imported and ļ¬tted dipoles, see Section 7.15.3.

Manage channel selections...

Manage the selections of channels used in dipole ļ¬tting, see

Section 7.15.4.

7.4.6 The Help menu

The contents of the Help menu is shown in Figure 7.7:

Figure 7.7 The Help menu.

145

7

Interactive analysis

On version...

Displays the version and compilation date of the program.

On license...

Displays the license information.

On GLX...

Displays information about the OpenGL rendering context. If you experience poor graphics performance, check that the window that pops up from here says that you have a Direct rendering context. If not, either your graphics card or driver software needs an update.

Why the beep?

In some simple error situations, mne_analyze does not popup an error dialog but refuses the action and rings the bell. The reason for this can be displayed through this help menu item.

7.5 Loading data

When you select Open... from the File menu the data loading dialog

shown in Figure 7.8 appears. It has four sections:

1. A standard ļ¬le selection box.

2. List of available data sets. This part is automatically ļ¬lled in when a proper data ļ¬le is selected from the ļ¬le list. You can select one or more data sets from this list. Multiple selection works with help of the shift and control keys. If multiple data sets are selected, the data set to be analyzed can be changed from the data set list accessible through

Switch to data set... in the File menu.

3. List of available inverse operator decompositions in the current directory and its subdirectory called inv.

4. List of options: a. MRI/head transform source speciļ¬es a ļ¬le to read the MRI/MEG coordinate transformation information from. This is usually the inverse operator ļ¬le. However, you can also load data with inverse operator set to <none> to view the data as well as ļ¬eld and potential maps derived thereof. In this case you need to specify the coordinate transformation ļ¬le using the Select... button, usually located in mri/T1-neuromag/sets

under the subject’s FreeSurfer directory. The Default button uses the default transformation ļ¬le which must be called $SUBJECTS_DIR/$SUBJECT/bem/$SUBJECTtrans.fif

. This can be one of the MRI description ļ¬les in mri/

146 MSH-MNE

Interactive analysis

7

T1-neuromag/sets

or a transformation ļ¬le stored from

mne_analyze, see Section 7.16.

b. Use EEG average electrode ref. selects whether the average electrode reference is applied to the data. This is only available if the inverse operator is set to <none>.

c. nave speciļ¬es the effective number of averages to compute the SNR correctly. Usually your measurement ļ¬le contains this information.

1.

2.

3.

4.

MSH-MNE

Figure 7.8 The open dialog.

After the data set(s) has been selected, the following actions will take place:

1. The inverse operator will be loaded.

2. Baselines will be applied as speciļ¬ed in the scales dialog.

3. Projection will be applied to the data. If no inverse operator is speciļ¬ed, the source for the projection data will be the data ļ¬le and the average EEG reference setting in the options. If an inverse operator is included, the projection will be read from the data ļ¬le.

4. If an inverse operator is loaded, whitened data will be computed.

147

7

Interactive analysis

5. If an inverse operator is loaded, the SNR estimate as well as the effective SNR will be computed from the whitened data and displayed in the

SNR window.

6. Waveforms will be shown in the topographical display as well as in the sample channel display.

If multiple data sets are loaded each data set has the following individual settings:

1. Amplitude and time scale settings,

2. Baseline,

3. Picked time point,

4. Sample channel to be displayed, and

5. MNE display preferences, see Section 7.12.1.

If a data set has not been previously displayed, the currently active settings are copied to the data set.

Tip: If you double click on an inverse operator ļ¬le name displayed in the

Inverse operator list, the command used to produced this ļ¬le will be displayed in a message dialog.

7.6 Loading epochs from a raw data file

Instead of an evoked-response data ļ¬le it is possible to load epochs of data

(single trials) from a raw data ļ¬le. This option is invoked from File/Open

raw...

. The ļ¬le selection box is identical to the one used for evoked

responses (Figure 7.8) except that data set selector is replaced by the

epoch selector show in Figure 7.9.

148

Figure 7.9 The raw data epoch selector.

The epoch selector contains the following controls:

1. The event speciļ¬er. Only events matching this number are going to be considered.

2. The event source speciļ¬er. The event source can be either the data ļ¬le,

i.e., the digital trigger channel or a event data ļ¬le produced with

mne_browse_raw or mne_process_raw, see Section 4.4.10. Using an

MSH-MNE

MSH-MNE

Interactive analysis

7

event data ļ¬le is useful if, e.g., the epochs to be processed epileptic spikes.

3. The time range speciļ¬cation. This determines the length of the epoch with respect to the selected event.

Once the settings have been accepted by clicking OK, the ļ¬rst matching epoch will be displayed. You can switch between epochs using the data set list accessible through Switch to data set... in the File menu.

7.7 Data displays

The MEG and EEG signals can be viewed in two ways:

1. A selection of MEG or EEG channel is shown in a topographical layout.

2. One representative channel can be selected to the Sample channel display by clicking on a channel in the topographical display.

In both the sample channel display and the topographical display, current time point can be selected with a left mouse click. In addition, time point of interest can be entered numerically in the text box at the bottom left corner of the main display.

7.7.1 The topographical display

A selection of channels is always shown in the right most part of the main display. The topographical layout to use is selected from Adjust/Select

trace layout...

, which brings up a window with a list of available layouts.

The system-wide layouts reside in $MNE_ROOT/setup/mne_analyze/ lout. In addition any layout ļ¬les residing in $HOME/.mne/lout are listed.

The format of the layout ļ¬les and selection of the default layout is dis-

cussed in Section 4.5.6.

Several actions can be performed with the mouse in the topographical data display:

Left button click

Selects a time point of interest.

Left button click with control key

Selects a time point of interest and selects the channel under the pointer to the sample channel display.

Left button drag with shift key

Enlarges the view to contain only channels in the selected area.

149

7

Interactive analysis

Middle button click or drag

Marks this channel as bad and clears all previously marked bad channel. This action is only available if an inverse operator is not loaded. An inverse operator dictates the selection of bad channels.

The current bad channel selection can be applied to the data from

File/Save bad channel selection.

Middle button click or drag with control key

Extends the bad channel selection without clearing the previously active bad channels.

Right button

Adjusts the channel selection used for dipole ļ¬tting in the same way as the middle button selects bad channels. For more information on

channel selections, see Section 7.15.4.

7.7.2 The sample channel display

The sample channel display shows one of the measurement channels at the upper left corner of the mne_analyze user interface. A time point can be selected with a left mouse click. In addition, the following keyboard functions are associated with the sample channel display:

Down

Change the sample channel to the next channel in the scanning order.

Up

Change the sample channel to the previous channel in the scanning order.

Right

Move forward in time by 1 ms.

Control Right

Move forward in time by 5 ms.

Left

Move backward in time by 1 ms.

Control Left

Move backward in time by 5 ms.

7.7.3 Scale settings

The scales of the topographical and sample channel display can be adjusted from the Scales dialog which is invoked by selecting Adjust/

150 MSH-MNE

MSH-MNE

Interactive analysis

7

Scales... from the menus. The Scales dialog shown in Figure 7.10 has the

following entries:

Analyze range min [ms]

Speciļ¬es the lower limit of the time range of data to be shown.

Analyze range max [ms]

Speciļ¬es the upper limit of the time range of data to be shown.

Use full time range

If this box is checked, all data available in the data ļ¬le will be shown.

Baseline min [ms]

Speciļ¬es the lower time limit of the baseline.

Baseline max [ms]

Speciļ¬es the upper time limit of the baseline.

Baseline in use

Baseline subtraction can be switched on and off from this button.

MEG amp min [fT/cm]

Lower limit of the vertical scale of planar gradiometer MEG channels.

MEG amp max [fT/cm]

Upper limit of the vertical scale of planar gradiometer MEG channels.

MEG axmult [cm]

The vertical scale of MEG magnetometers and axial gradiometers will be obtained by multiplying the planar gradiometer vertical scale limits by this value, given in centimeters.

Lower limit of the vertical scale of EEG channels.

Upper limit of the vertical scale of EEG channels.

Show stimulus channel

Show the digital trigger channel data in the sample view together with the sample channel.

151

7

Interactive analysis

152

Figure 7.10 The Scales dialog.

7.8 The surface display

In mne_analyze, the current estimates are visualized on inļ¬‚ated or folded cortical surfaces. There are two visualization displays: the surface display, which is always visible, and the 3D viewer which is invoked from the

Windows/Show viewer... menu selection, see Section 7.10.

A total of eight surfaces or patches can be assigned to the surface display:

1. The left and right hemisphere cortical surfaces for the subject whose data you are analyzing. These surfaces can be the inļ¬‚ated, white-matter, or pial surfaces. They are loaded through the File/Load surface... menu selection,

2. The left and right hemisphere cortical surfaces of another subject or an alternative representation of the cortical surface of the actual subject.

For example, you can switch between the inļ¬‚ated and folded (pial or white matter) cortical surfaces very easily. These surfaces are loaded from the File/Load morphing surface... menu selection.

3. Left and right hemisphere curved or ļ¬‚at cortical patches for the subject you are analyzing. This patch is loaded from the File/Load surface

MSH-MNE

Interactive analysis

7

patch... menu selection. The full cortical surfaces must be loaded ļ¬rst before loading the patches.

4. Patches for an another subject or another pair of patches for the same subject through the File/Load morphing surface patch... menu selection. Again, the full cortical surfaces must have been loaded ļ¬rst.

7.8.1 The surface selection dialog

When File/Load surface... or File/Load morphing surface... is invoked,

the surface selection dialog shown in Figure 7.11 appears.

MSH-MNE

Figure 7.11 The surface selection dialog.

The dialog has the following components:

List of subjects

This list contains the subjects available in the directory set with the

SUBJECTS_DIR

environment variable.

List of available surfaces for the selected subject

Lists the surfaces available for the current subject. When you click on an item in this list, it appears in the Selected surface text ļ¬eld.

x-rotation (deg)

Speciļ¬es the initial rotation of the surface around the x (left to right) axis. Positive angle means a counterclockwise rotation when the surface is looked at from the direction of the positive x axis. Sometimes a more pleasing visualization is obtained when this rotations are speciļ¬ed when the surface is loaded.

153

7

Interactive analysis

y-rotation (deg)

Speciļ¬es the initial rotation of the surface around the y (back to front) axis.

z-rotation (deg)

Speciļ¬es the initial rotation of the surface around the z (bottom to up) axis.

7.8.2 The patch selection dialog

The surface patches are loaded with help of the patch selection dialog, which appears when File/Load surface patch... or File/Load morphing

surface patch...

is selected. This dialog, shown in Figure 7.12, contains a

list of available patches and the possibility to rotate the a ļ¬‚at patch counterclockwise by the speciļ¬ed number of degrees from its original orientation. The patch is automatically associated with the correct hemisphere on the basis of the two ļ¬rst letters in the patch name (lh = left hemisphere, rh

= right hemisphere).

154

Figure 7.12 The patch selection dialog.

7.8.3 Controlling the surface display

The main surface display has a section called Adjust view, which has the

controls shown in Figure 7.13:

L and R

Select the left or right hemisphere surface loaded through File/Load

surface...

.

MSH-MNE

Interactive analysis

7

L and R

Select the left or right hemisphere surface loaded through File/Load

morphing surface...

P

Select the patch associated with the currently selected surface.

Option menu

Select one of the predeļ¬ned view orientations, see Section 7.8.5,

below.

Arrow buttons

Rotate the surface by increments speciļ¬ed in degrees in the text box next to the arrows.

MSH-MNE

-

Figure 7.13 Surface controls.

The display can be also adjusted using keyboard shortcuts, which are available once you click in the main surface display with the left mouse button to make it active:

Arrow keys

Rotate the surface by increments speciļ¬ed in degrees in the Adjust

View

section.

+

Enlarge the image.

Reduce the image.

=

Return to the default size.

r

Rotate the image one full revolution around z axis using the currently speciļ¬ed rotation step. This is useful for producing a sequence of images when automatic image saving is on, see

Section 7.8.7.

s

Produces a raster image file which contains a snapshot of the currently displayed image. For information on snapshot mode, see

Section 7.8.7.

155

7

Interactive analysis

.

Stops the rotation invoked with the ‘r’ key, see above.

In addition, the mouse wheel or trackball can be used to rotate the image.

If a trackball is available, e.g., with the Apple MightyMouse, the image can be rotated up and down or left and right with the trackball. With a mouse wheel the image will rotated up and down when the wheel is rotated. Image rotation in the left-right direction is achieved by holding down the shift key when rotating the wheel. The shift key has the same effect on trackball operation.

Note: The trackball and mouse wheel functionality is dependent on your

X server settings. On Mac OSX these settings are normally correct by default but on a LINUX system some adjustments to the X server settings maybe necessary. Consult your system administrator or Google for details.

7.8.4 Selecting vertices

When you click on the surface with the left mouse button, the corresponding vertex number and the associated value will be displayed on the message line at the bottom of the display. In addition, the time course at this

vertex will be shown, see Section 7.13.1. You can also select a vertex by

entering the vertex number to the text ļ¬eld at the bottom of the display. If the MRI viewer is displayed and Track surface location in MRI is selected in the MRI viewer control dialog, the cursor in the MRI slices will also

follow the vertex selection, see Section 7.18.

The View menu choice Show coordinates... brings up a window which shows the coordinates of the selected vertex on the white matter surface,

i.e., lh.white and rh.white FreeSurfer surfaces. If morphing surfaces have been loaded, the coordinates of both the subject being analyzed and those of the morphing subject will be shown. The Coordinates window includes the following lines:

MEG head

Indicates the vertex location in the MEG head coordinates. This entry will be present only if MEG/EEG data have been loaded.

Surface RAS (MRI)

Indicates the vertex location in the Surface RAS coordinates. This is the native coordinate system of the surfaces and this entry will always be present.

MNI Talairach

Shows the location in MNI Talairach coordinates. To be present, the

MRI data of the subject must be in the mgz format (usually true with any recent FreeSurfer version) and the Talairach transforma-

156 MSH-MNE

Interactive analysis

7

tion must be appropriately deļ¬ned during the FreeSurfer reconstruction workļ¬‚ow.

Talairach

Shows the location in the FreeSurfer Talairach coordinates which give a better match to the Talairach atlas.

The above coordinate systems are discussed in detail in Section 5.2.

Note: By default, the tksurfer program, part of the FreeSurfer package, shows the vertex locations on the orig rather than white surfaces. Therefore, the coordinates shown in mne_analyze and tksurfer are by default slightly different (usually by < 1 mm). To make the two programs consistent, you can start tksurfer with the -orig white option.

MSH-MNE

7.8.5 Defining viewing orientations

The list of viewing orientations available in the Adjust View section of the main surface display is controlled by a text ļ¬le. The system-wide defaults reside in $MNE_ROOT/setup/mne/mne_analyze/eyes. If the ļ¬le

$HOME/.mne/eyes

exists, it is used instead.

All lines in the eyes ļ¬le starting with # are comments. The view orientation deļ¬nition lines have the format:

<name>:<Left>:<Right>:<Left up>:<Right up> , where

<name>

is the name of this viewing orientation,

<Left>

speciļ¬es the coordinates of the viewing ‘eye’ location for the left hemisphere, separated by spaces,

<Right>

speciļ¬es the coordinates of the viewing location for the right hemisphere,

<Left up>

speciļ¬es the direction which is pointing up in the image for left hemisphere, and

<Right up>

is the corresponding up vector for the right hemisphere.

All values are given in a coordinate system where positive x points to the right, positive y to the front, and positive z up. The lengths of the vectors

157

7

Interactive analysis speciļ¬ed for each of the four items do not matter, since parallel projection is used and the up vectors will be automatically normalized. The up vectors are usually 0 0 1, i.e., pointing to the positive z direction unless the view is directly from above or below or if some special effect is desired.

The names of viewing orientations should be less than 9 characters long.

Otherwise, the middle pane of the main display will not be able to accommodate all the controls. The widths of the main window panes can be adjusted from the squares at the vertical sashes separating the panes.

7.8.6 Adjusting lighting

The scenes shown in the main surface display and the viewer, described in

Section 7.10, are lit by ļ¬xed diffuse ambient lighting and a maximum of

eight light sources. The states, locations, and colors of these light sources

can be adjusted from the lighting adjustment dialog shown in Figure 7.14,

which can be accessed through the Adjust/Lights... menu choice. The colors of the lights can be adjusted numerically or using a color adjustment dialog accessible through the Color... buttons.

158

Figure 7.14 The lighting adjustment dialog.

7.8.7 Producing output files

Figure 7.15 Graphics output controls.

MSH-MNE

Interactive analysis

7

Three types of output ļ¬les can be produced from the main surface display

using the graphics output buttons shown in Figure 7.15:

w ļ¬les (w button)

These ļ¬les are simple binary ļ¬les, which contain a list of vertex numbers on the cortical surface and their current data values. The w ļ¬les will be automatically tagged with -lh.w and -rh.w. They will only contain vertices which currently have a nonzero value.

Graphics snapshots (img button)

These ļ¬les will contain an exact copy of the image in tif or rgb formats. The output format and the output mode is selected from the

image saving dialog shown in Figure 7.16. For more details, see

Section 7.8.8. If snapshot or automatic image saving mode is in

effect, thee img button terminates this mode.

QuickTime™ movies (mov button)

These ļ¬les will contain a sequence of images as a QuickTime™

movie ļ¬le. The movie saving dialog shown in Figure 7.17 speciļ¬es

the time range and the interval between the frames as well as the quality of the movies, which is restricted to the range 25...100. The size of the QuickTime ļ¬le produced is approximately proportional to the quality.

MSH-MNE

Figure 7.16 File type selection in the image saving dialog.

159

7

Interactive analysis

160

Figure 7.17 The controls in the movie saving dialog.

7.8.8 Image output modes

The image saving dialog shown in Figure 7.16 selects the format of the

image ļ¬les produced and the image output mode. The buttons associated with different image format change the ļ¬le name ļ¬lter in the dialog to display ļ¬les of desired type. However, the ļ¬nal output format is deļ¬ned by the ending of the ļ¬le name in the Selection text ļ¬eld as follows:

jpg

JPEG (Joint Photographic Experts Group) format. Best quality jpeg is always produced.

tif or tiff

Uncompressed TIFF (Tagged Image File Format).

rgb

RGB format.

pdf

Portable Document File format.

png

Portable Network Graphics format.

Important: Only TIFF and RGB output routines are compiled into

mne_analyze. For other output formats to work, the following programs must be present in your system: tifftopdf, tifftopnm, pnmtojpeg, and pnmtopng.

There are three image saving modes which can be selected from the option menu labelled Output mode:

MSH-MNE

MSH-MNE

Interactive analysis

7

Single

When OK is clicked one ļ¬le containing the present image is output.

Snapshot

A new image ļ¬le is produced every time s is pressed in the image

window, see Sections 7.8.3 and 7.10.1. The image ļ¬le name is used

as the stem of the output ļ¬les. For example, if the name is, sample.jpg

, the output ļ¬les will be sample_shot_001.jpg, sample_shot_002.jpg

, etc.

Automatic

A new image ļ¬le is produced every time the image window changes. The image ļ¬le name is used as the stem of the output ļ¬les.

For example, if the name is, sample.jpg, the output ļ¬les will be sample_001.jpg

, sample_002.jpg, etc.

7.9 Morphing

The displayed surface distributions can be morphed to another subject’s

brain using the spherical morphing procedure, see Chapter 8. In addition

to the morphing surfaces loaded through File/Load morphing surface... surface patches for the same subject can be loaded through File/Load

morphing surface patch...

. Switching between main and morphing sur-

faces is discussed in Section 7.8.3.

Any labels displayed are visible on any of the surfaces displayed in the main surface display. Time points can be picked in any of the surfaces. As a result, the corresponding timecourses will be shown in the MNE ampli-

tude window, see Section 7.13.

161

7

Interactive analysis

7.10 The viewer

7.10.1 Overview

162

Figure 7.18 The viewer window with a visualization of MEG and EEG contour maps.

When Windows/Show viewer... is selected, the following additional surfaces will be loaded:

1. The left and right hemisphere pial surfaces,

2. The surface representing the inner helmet shaped wall of the dewar on which the MEG sensors are located,

3. The scalp surface, and

4. The BEM surfaces.

The scalp surface is loaded from the ļ¬le bem/<subject>-head.fif

under the subject’s FreeSurfer directory. This surface is automatically pre-

pared if you use the watershed algorithm as described in Section A.1. If

you have another source for the head triangulation you can use the utility

mne_surf2bem to create the ļ¬f format scalp surface ļ¬le, see Section 5.6.

MSH-MNE

MSH-MNE

Interactive analysis

7

If a ļ¬le called bem/<subject>-bem.fif under the subject’s FreeSurfer directory is present, mne_analyze tries to load the BEM surface triangulations from there. This ļ¬le can be a symbolic link to one of the bem.files

created by mne_prepare_bem_model, see Section 5.7. If the

BEM ļ¬le contains a head surface triangulation, it will be used instead of the one present in the bem/<subject>-head.fif ļ¬le.

Once all required surfaces have been loaded, the viewer window shown in

Figure 7.18 pops up. In addition to the display canvas, the viewer has

Adjust view controls similar to the main surface display and options for graphics output. The Adjust view controls do not have the option menu for standard viewpoints and has two additional buttons:

The output options only include graphics output as snapshots (img) or as movies (mov).

Options...

This button pops up the viewer options window which controls the appearance of the viewer window.

Rescale

This button adjusts the contour level spacing in the magnetic ļ¬eld and electric potential contour maps so that the number of contour lines is reasonable.

-

Reload

Checks the modiļ¬cation dates of the surface ļ¬les loaded to viewer and reloads the data if the ļ¬les have been changed. This is useful,

e.g., for display of different BEM tessellations.

The display can be also adjusted using keyboard shortcuts, which are available once you click in the viewer display with the left mouse button:

Arrow keys

Rotate the surface by increments speciļ¬ed in degrees in the Adjust

View

section.

+

Enlarge the image.

Reduce the image.

=

Return to the default size.

r

Rotate the image one full revolution around z axis using the currently speciļ¬ed rotation step. This is useful for producing a

163

7

Interactive analysis sequence of images when automatic image saving is on, see

Section 7.8.7.

s

Produces a image file which contains a snapshot of the currently displayed image. For information on snapshot mode, see

Section 7.8.7.

.

Stops the rotation invoked with the ‘r’ key, see above.

The left mouse button can be also used to inquire estimated magnetic ļ¬eld potential values on the helmet and head surfaces if the corresponding maps have been calculated and displayed.

In addition, the mouse wheel or trackball can be used to rotate the image.

If a trackball is available, e.g., with the Apple MightyMouse, the image can be rotated up and down or left and right with the trackball. With a mouse wheel the image will rotated up and down when the wheel is rotated. Image rotation in the left-right direction is achieved by holding down the shift key when rotating the wheel. The shift key has the same effect on trackball operation.

Note: The trackball and mouse wheel functionality is dependent on your

X server settings. On Mac OSX these settings are normally correct by default but on a LINUX system some adjustments to the X server settings maybe necessary. Consult your system administrator or Google for details.

164 MSH-MNE

7.10.2 Viewer options

1.

2.

Interactive analysis

7

3.

MSH-MNE

Figure 7.19 The viewer options window

The viewer options window shown above contains three main sections to control the appearance of the viewer:

1. Selectors for various items to show,

2. Options for some of the items, and

3. Control of the color and transparency of the items, if applicable. The color can be adjusted either by entering numeric values in the range

0...1 or with help of a color editor which appears from the Color... button. The transparency value has the same range as the other color components, zero indicating a fully transparent (invisible) surface and one a fully opaque one.

The available items are:

Left hemi

The pial surface of the left hemisphere. This surface can be made transparent. Naturally, this surface will only be visible if the scalp is made transparent.

Right hemi

The pial surface of the right hemisphere.

165

7

Interactive analysis

Inner skull

The inner skull surface. This surface can be made transparent. If parts of the pial surface are outside of the inner skull surface, they will be visible, indicating that the inner skull surface is obviously inside the inner skull. Note that this criterion is more conservative than the one imposed during the computation of the forward solution since the source space points are located on the white matter surface rather than on the pial surface. This surface can be displayed

only if the BEM ļ¬le is present, see Section 7.10.1.

Outer skull

The outer skull surface. This surface can be made transparent. This surface can be displayed only if the BEM ļ¬le is present and contains

the outer skull surface, see Section 7.10.1.

Scalp

The scalp surface. This surface can be made transparent. The display of this surface requires that the scalp triangulation ļ¬le is

present, see Section 7.10.1.

Digitizer data

The 3D digitizer data collected before the MEG/EEG acquisition.

These data are loaded from File/Load digitizer data.... The display can be restricted to HPI coil locations and cardinal landmarks with the option. The digitizer points are shown as disks whose radius is equal to the distance of the corresponding point from the scalp surface. Points outside the scalp are shown in red and those inside in blue. Distinct shades of cold and warm colors are used for the ļ¬ducial landmarks. The HPI coils are shown in green. Further information on these data and their use in coordinate system alignment is

given in Section 7.16.

Helmet

The MEG measurement surface, i.e., inner surface of the dewar.

EEG electrodes

The EEG electrode locations. These will be only available if your data set contains EEG channels.

MEG sensors

Outlines of MEG sensors.

MEG ļ¬eld map

Estimated contour map of the magnetic ļ¬eld component normal to

the helmet surface or normal to the scalp, see Section 7.11.

EEG potential map

Interpolated EEG potential map on the scalp surface, see

Section 7.11.

166 MSH-MNE

MSH-MNE

Interactive analysis

7

Activity estimates

Current estimates on the pial surface.

7.11 Magnetic field and electric potential maps

7.11.1 Overview

In mne_analyze, the magnetic ļ¬eld and potential maps displayed in the viewer window are computed using an MNE-based interpolation technique. This approach involves the following steps:

1. Establish an inverse operator to compute a minimum norm solution on a spherical surface using a spherically symmetric forward model.

Instead of assuming a discrete grid of sources, a continuous distribution of tangential currents is employed. In this case the lead ļ¬eld dot products can be computed in closed form. Separate solutions are computed for MEG and EEG.

2. The normal component of the magnetic ļ¬eld or the electric potential on the helmet or head surface is computed from the MEG-based and EEGbased MNE. Since the MNE predicts the original measurements accurately, it can also interpolate and extrapolate the data reliably. The grid of interpolation or extrapolation points can be located on the helmet or scalp surface for MEG and on the scalp surface for EEG.

The magnetic ļ¬eld and potential maps appear automatically whenever

they are enabled from the viewer options, see Section 7.10.2.

7.11.2 Technical description

Let

x k

be an MEG or an EEG signal at channel related to the primary current distribution

J

p k

=

1

N

. This signal is through the lead ļ¬eld

L

k

:

p x k

=

G

L

k d

G , where the integration space

G

in our case is a spherical surface. The oblique boldface characters denote three-component locations vectors and vector ļ¬elds.

The inner product of two leadļ¬elds is deļ¬ned as:

L

j k

=

G

L

j

k d

G ,

167

7

Interactive analysis

These products constitute the Gram matrix

Γ

jk

= . The minimum

-norm estimate can be expressed as a weighted sum of the lead ļ¬elds:

J

*

=

w

T

L ,

where

w L

lead-ļ¬eld functions. The weights are determined by the requirement

x

=

L J

*

= i.e., the estimate must predict the measured signals. Hence,

w

=

Γ

– 1

x .

However, the Gram matrix is ill conditioned and regularization must be employed to yield a stable solution. With help of the SVD

Γ

=

U

ΛV

T

a regularized minimum-norm can now found by replacing the data matching condition by

x

=

Γ

w

, where

x

=

(

U

)

T

x and

Γ

=

(

U

)

T

Γ , respectively. In the above, the columns of

U

are the ļ¬rst k left singular vectors of . The weights of the regularized estimate are

w

where

Λ

is diagonal with

=

V

Λ

U

T

x ,

Λ

jj

=

1

⁄ λ

j

, j

p

otherwise

λ

j

being the

j

th

Γ

ε

p

mne_analyze by specifying a tolerance , which is used to determine

p

such that

168 MSH-MNE

Interactive analysis

7

1 –

p

λ

j j

---------------

N

< ε

j

= 1

λ

j

The extrapolated and interpolated magnetic ļ¬eld or potential distribution estimates

ˆ

in a virtual grid of sensors can be now easily computed from the regularized minimum-norm estimate. With

Γ'

jk

=

L'

j k

where

L'

j

are the lead ļ¬elds of the virtual sensors,

=

Γ'w

.

7.11.3 Field mapping preferences

The parameters of the ļ¬eld maps can be adjusted from the Field mapping

preferences

dialog shown in Figure 7.20 which is accessed through the

Adjust/Field mapping... menu item.

MSH-MNE

Figure 7.20 Field mapping preferences dialog.

169

7

Interactive analysis

The Field mapping preferences dialog has the following controls, arranged in MEG, EEG, and common sections:

SVD truncation at

Adjusts the smoothing of the ļ¬eld and potential patterns. This parameter speciļ¬es the eigenvalue truncation point as described in

Section 7.11.2. Smaller values correspond to noisier ļ¬eld patterns

with less smoothing.

Use default origin

The location of the origin of the spherical head model used in these computations defaults to (0 0 40) mm. If this box is unchecked the origin coordinate ļ¬elds are enabled to enter a custom origin location. Usually the default origin is appropriate.

Downsampling grade

This option only applies to EEG potential maps and MEG ļ¬eld maps extrapolated to the head surface and controls the number of virtual electrodes or point magnetometers used in the interpolation.

Allowed values are: 2 (162 locations), 3 (642 locations), and 4

(2562 locations). Usually the default value 3 is appropriate.

Number of smoothsteps

This option controls how much smoothing, see Section 8.3, is

applied to the interpolated data before computing the contours. Usually the default value is appropriate.

Reconstruction surface radius

Distance of the spherical reconstruction surface from the sphere model origin. Usually default value is appropriate. For children it may be necessary to make this value smaller.

170

7.12 Working with current estimates

7.12.1 Preferences

The characteristics of the current estimates displayed are controlled from the MNE preferences dialog which pops up from Adjust/Estimates....

This dialog, shown in Figure 7.21, has the following controls:

SNR estimate

This controls the regularization of the estimate, i.e., the amount of allowed mismatch between the measured data and those predicted by the estimated current distribution. Smaller SNR means larger allowed mismatch. Typical range of SNR values is 1...7. As dis-

cussed in Section 6.2, the SNR value can be translated to the current

variance values expressed in the source-covariance matrix R. This

MSH-MNE

MSH-MNE

Interactive analysis

7

translation is presented as the equivalent current standard-deviation value

Show

This radio button box selects the quantity to display. MNE is the minimum norm estimate (estimated value of the current), dSPM is the noise-normalized MNE, and sLORETA is another version of the noise-normalized solution which is claimed to have a smaller location bias than the dSPM.

Mask with

If MNE is selected in the Show radio button box, it is possible to mask the solution with one of the statistical maps. The masking map is thresholded at the value given in the Threshold text ļ¬eld and the

MNE is only shown in areas with statistical values above this threshold.

Value histogram

This part of the dialog shows the distribution of the currently shown estimate values over the surface. The histogram is colored to reļ¬‚ect the current scale settings. The fthresh, fmid, and fmax values are indicated with vertical bars. The histogram is updated when the dialog is popped up and when the estimate type to show changes, not at every new time point selection. The Refresh button makes the histogram current at any time.

Color scale

These text ļ¬elds control the color scale as described in Table 7.1.

Options

Various options controlling the estimates.

Parameter

fthresh fmid fmax

Meaning

If the value is below this level, it will not be shown.

Positive values at this level will show as red.

Negative values will be dark blue.

Positive values at and above this level will be bright yellow. Negative values will be bright blue.

Table 7.1 The color scale parameters.

171

7

Interactive analysis

Parameter

fmult tcmult

Meaning

Apply this multiplier to the above thresholds. Default is 1 for statistical maps and

1

10

for currents (MNE). The vertical bar locations in the histogram take this multiplier into account but the values indicated are the threshold parameters without the multiplier.

The upper limit of the timecourse vertical scale will be

tc

mult

f

mult

f

max

.

Table 7.1 The color scale parameters.

172

Figure 7.21 Estimate preferences dialog.

The optional parameters are:

MSH-MNE

MSH-MNE

Interactive analysis

7

Retain sign

With this option, the sign of the dot product between the current direction and the cortical surface normal will be used as the sign of the values to be displayed. This option yields meaningful data only if a strict or a loose orientation constraint was used in the computation of the inverse operator decomposition.

Retain normal component only

Consider only the current component normal to the cortical mantle.

This option is not meaningful with completely free source orientations.

Show scale bar

Show the color scale bar at the lower right corner of the display.

Show comments

Show the standard comments at the lower left corner of the display.

Time integr. (ms)

Integration time for each frame (

āˆ†

t

). Before computing the estimates time integration will be performed on sensor data. If the time speciļ¬ed for a frame is

t

0

, the integration range will be

t

0

āˆ†

t 2

t t

0

+

āˆ†

t 2

.

# of smooth steps

Before display, the data will be smoothed using this number of

steps, see Section 8.3.

Opacity

The range of this parameter is 0...1. The default value 1 means that the map overlaid on the cortical surface is completely opaque. With lower opacities the color of the cortical surface will be visible to facilitate understanding the underlying folding pattern from the curvature data displayed.

7.12.2 The SNR display

The SNR estimate display shows the SNR estimated from the whitened data in red and the apparent SNR inferred from the mismatch between the measured and predicted data in green.

measured data

x t

by

˜

The SNR estimate is computed from the whitened data

x

, related to the

( )

˜

x

t

=

C

– where

C

1 2

is the whitening operator, introduced in Section 6.2.3.

173

7

Interactive analysis

The computation of the apparent SNR will be explained in future revisions of this manual.

7.13 Inquiring timecourses

7.13.1 Timecourses at vertices

Timecourses at individual vertices can be inquired by clicking on a desired point on the surface with the left mouse button. If the control key was down at the time of a click, the timecourse will be added to the timecourse manager but left off. With both control and shift down, the timecourse will be added to the timecourse manager and switched on. For

more information on the timecourse manager, see Section 7.13.3.

The timecourses are be affected by the Retain sign and Retain normal

component only

settings in the MNE preferences dialog, see

Section 7.12.1.

7.13.2 Timecourses at labels

The labels provide means to interrogate timecourse information from

ROIs. The label ļ¬les can be created in mne_analyze, see Section 7.13.4 or

in tksurfer, which is part of the FreeSurfer software. For mne_analyze left-hemisphere and right-hemisphere label ļ¬les should be named

<name>-lh.label and <name>-rh.label, respectively.

Individual label ļ¬les can be loaded from Labels/Load label.... All label ļ¬les in a directory can be loaded from Labels/Load all labels.... Once

labels are loaded, the label list shown in Figure 7.22 appears. Each time a

new label is added to the list, the names will be reordered to alphabetical order. This list can be also brought up from Labels/Show label list. The list can be cleared from Labels/Discard all labels.

Warning: Because of the format of the label ļ¬les mne_analyze can not certify that the label ļ¬les loaded belong to the cortical surfaces of the present subject.

When a label is selected from the label list, the corresponding timecourse appears. The Keep button stores the timecourse to the timecourse man-

ager, Section 7.13.3.

174 MSH-MNE

Interactive analysis

7

MSH-MNE

Figure 7.22 The label list.

The timecourse shown in the MNE amplitude window is a compound measure of all timecourses within a label. Two measures are available:

Average

Compute the average over all label vertices at each time point.

Maximum

Compute the maximum absolute value over all vertices at each time point. If the data are signed, the value is assigned the sign of the value at the maximum vertex. This may make the timecourse jump from positive to negative abruptly if vertices with different signs are included in the label.

L2 norm (sample by sample)

Compute the

l

2

norm over the values in the vertices at each time point.

Pick vertex with largest L2 norm over time

Compute the

l

2

norm over time in each vertex and show the time course at the vertex with the largest norm.

7.13.3 The timecourse manager

The timecourse manager shown in Figure 7.23 has the following controls

for each timecourse stored:

175

7

Interactive analysis

176

Figure 7.23 The timecourse manager.

Numbered checkbox

Switches the display of this timecourse on and off.

Color...

This button shows the color of the timecourse curve. The color can be adjusted from the color editor which appears when the button is pressed.

Save...

Saves the timecourse. If a single vertex is selected, the time course ļ¬le will contain some comment lines starting with the the percent sign, one row of time point values in seconds and another with the data values. The format of the timecourse data is explained in

Section 7.13.3.1, below.

Forget

Delete this timecourse from memory.

7.13.3.1 Label timecourse files

When timecourse corresponding to a label is saved, the default is to save the displayed single timecourse in a format identical to the vertex timecourses. If Save all timecourses within the label is selected, the Time-by-

time output

output changes the output to be listed time by time rather than vertex by vertex, Include coordinates adds the vertex location information to the output ļ¬le, and Include vertex numbers adds the indices of picked

vertices to the output, see Figure 7.24. The vertex-by-vertex output formats is summarized in Table 7.2.

MSH-MNE

Interactive analysis

7

Figure 7.24 Label timecourse saving options.

Line

1 –

n

com

n

com

+ 1

(

n

com

+

1

)

(

n p

+

n

com

+

1

)

Contents

Comment lines beginning with %

{0.0 }[0.0 0.0 0.0]

t

1

t

n t

{ }[

x p

y

p

z

p

]

v p

v

p

Table 7.2 Vertex-by-vertex output format.

n p

is the number of vertices,

n t

is the number of time points,

n

com

is the number of comment lines,

t

1

t

n t x p

y

p

z

p v p

v

p

are the

coordinates is active. In the time-by-time output format the data portion of the ļ¬le is transposed.

MSH-MNE

7.13.4 Creating new label files

It is easy to create new label ļ¬les in mne_analyze. For this purpose, an inļ¬‚ated surface should be visible in the main display. Follow these steps:

1. Clear all previously selected vertices either by choosing Labels/Clear

marked vertices

or do a right button click on the surface display with the shift key down.

2. Mark vertices on the surface with right button click or by right button drag. The vertices should be deļ¬ned in the desired order on the new label outline. The outline will follow the shortest path along the surface. The shortest path will be calculated along the white matter surface.Note that sometimes the shortest paths appear to be un-intuitive on the inļ¬‚ated surface.

3. Do a right button click with control key down inside the label. The outline will be completed and shown as a yellow line. The inside of the

177

7

Interactive analysis label will be ļ¬lled and shown in green. A ļ¬le selection box will appear to save the label. Enter the stem of the ļ¬le name here. The ļ¬le name will be augmented with -lh.label or -rh.label, depending on the hemisphere on which the label is speciļ¬ed.

7.14 Overlays

178

Figure 7.25 The overlay management dialog.

In addition to source estimates derived from MEG and EEG data,

mne_analyze can be used to display other surface-based data. These overlay data can be imported from w and stc ļ¬les containing single time slice

(static) and dynamic data (movies), respectively. These data ļ¬les can be produced by mne_make_movie, FreeSurfer software, and custom programs or Matlab scripts.

MSH-MNE

MSH-MNE

Interactive analysis

7

The names of the ļ¬les to be imported should end with -<hemi>.<type>, where <hemi> indicates the hemisphere (lh or rh and <type> is w or stc

.

Overlays are managed from the dialog shown in Figure 7.25 which is

invoked from File/Manage overlays....

This dialog contains the following controls:

List of overlays loaded

Lists the names of the overlays loaded so far.

Load w...

Load a static overlay from a w ļ¬le. In the open dialog it is possible to specify whether this ļ¬le contains data for the cortical surface or for scalp. Scalp overlays can be viewed in the viewer window.

Load stc...

Load a dynamic overlay from an stc ļ¬le. In the open dialog it is possible to specify whether this ļ¬le contains data for the cortical surface or for scalp. Scalp overlays can be viewed in the viewer window.

Delete

Delete the selected overlay from memory.

Time scale slider

Will be activated if a dynamic overlay is selected. Changes the current time point.

Overlay type is

Selects the type of the data in the current overlay. Different default color scales are provided each overlay type.

Value histogram

Shows the distribution of the values in the current overlay. For large stc ļ¬les this may take a while to compute since all time points are included. The histogram is colored to reļ¬‚ect the current scale settings. The fthresh, fmid, and fmax values are indicated with vertical bars.

Color scale

Sets the color scale of the current overlay. To activate the values,

press Show. For information on color scale settings, see Table 7.1.

Options

Display options. This a subset of the options in the MNE prefer-

ences dialog. For details, see Section 7.12.1.

179

7

Interactive analysis

Show

Show the selected overlay and assign the settings to the current overlay.

Apply to all

Apply the current settings to all loaded overlays.

It is also possible to inquire timecourses of vertices and labels from dynamic (stc) cortical overlays in the same way as from original data and store the results in text ļ¬les. If a static overlay (w ļ¬le) or a scalp overlay is selected, the timecourses are picked from the data loaded, if available.

7.15 Fitting current dipoles

Starting from MNE software version 2.6, mne_analyze includes routines for ļ¬tting current dipoles to the data. At present mne_analyze is limited to ļ¬tting single equivalent current dipole (ECD) at one time point. The parameters affecting the dipole ļ¬tting procedure are described in

Section 7.15.1. The results are shown in the dipole list (Section 7.15.3).

The selection of channels included can be adjusted interactively or by pre-

deļ¬ned selections as described in Section 7.15.4.

Warning: The current dipole ļ¬tting has been added recently and has not been tested comprehensively. Especially ļ¬tting dipoles to EEG data may be unreliable.

7.15.1 Dipole fitting parameters

Prior to ļ¬tting current dipoles, the ļ¬tting parameters must be set with the

Dipole ļ¬tting preferences dialog shown in Figure 7.26. The dialog is

brought up from the Setup ļ¬tting... choice in the Dipoles menu. This dialog contains three sections: Forward model, Modalities, and Noise esti-

mate.

The Forward model section speciļ¬es the forward model to be used:

Sphere model origin x/y/z [mm]

Speciļ¬es the origin of the spherically symmetric conductor model

in MEG/EEG head coordinates, see Section 5.3.

EEG scalp radius [mm]

Speciļ¬es the radius of the outermost shell in the EEG sphere model.

For details, see Section 5.9.4.

180 MSH-MNE

MSH-MNE

Interactive analysis

7

EEG sphere model name

Speciļ¬es the name of the EEG sphere model to use. For details, see

Section 5.9.4.

BEM model

Selects the boundary-element model to use. The button labeled with

... brings up a ļ¬le-selection dialog to select the BEM ļ¬le. An existing selection can be cleared with the Unset button. If EEG data are included in ļ¬tting, this must be a three-compartment model. Note that the sphere model is used even with a BEM model in effect, see

Section 7.15.2.

Accurate ļ¬eld calculation

Switches on the more accurate geometry deļ¬nition of MEG coils,

see Section 5.8. In dipole ļ¬tting, there is very little difference

between the accurate and normal coil geometry deļ¬nitions.

The Modalities section deļ¬nes which kind of data (MEG/EEG) are used in ļ¬tting. If an inverse operator is loaded with the data, this section is ļ¬xed and greyed out. You can further restrict the selection of channels used in

dipole ļ¬tting with help of channel selections discussed in Section 7.15.4.

The Noise estimate section of the dialog contains the following items:

Noise covariance

Selects the ļ¬le containing the noise-covariance matrix. If an inverse operator is loaded, the default is the inverse operator ļ¬le. The button labeled with ... brings up a ļ¬le-selection dialog to select the noise covariance matrix ļ¬le. An existing selection can be cleared with the

Unset button.

Omit off-diagonal terms

If a noise covariance matrix is selected, this choice omits the offdiagonal terms from it. This means that individual noise estimates for each channel are used but correlations among channels are not taken into account.

Regularization

Regularize the noise covariance before using it in whitening by adding a multiple of an identity matrix to the diagonal. This is discussed

in more detail in Section 6.2.4. Especially if EEG is included in ļ¬t-

ting it is advisable to enter a non-zero value (around 0.1) here.

Planar ļ¬xed [fT/cm]

In the absense of a noise covariance matrix selection, a diagonal noise covariance with ļ¬xed values on the diagonal is used. This entry speciļ¬es the ļ¬xed value of the planar gradiometers.

181

7

Interactive analysis

Axial ļ¬xed [fT]

If a noise covariance matrix ļ¬le is not speciļ¬ed, this entry speciļ¬es a ļ¬xed diagonal noise covariance matrix value for axial gradiometers and magnetometers.

If a noise covariance matrix ļ¬le is not speciļ¬ed, this entry speciļ¬es a ļ¬xed diagonal noise covariance matrix value for axial gradiometers and magnetometers..

182

Figure 7.26 The dipole ļ¬tting preferences dialog.

7.15.2 The dipole fitting algorithm

When the dipole ļ¬tting preferences dialog is closed and the values have been modiļ¬ed the following preparatory calculations take place:

MSH-MNE

MSH-MNE

Interactive analysis

7

1. If EEG data are included in ļ¬tting present, the EEG sphere model speciļ¬cation corresponding to EEG sphere model name is loaded and scaled to the the EEG scalp radius.

2. If a boundary-element model is used, the additional data depending on the sensor locations are computed.

3. The noise covariance matrix is composed according to the speciļ¬cations in the Dipole ļ¬tting preferences dialog.

4. The spatially whitened forward solution is computed in a grid of locations to establish the initial guess when a dipole is ļ¬tted. If a BEM is in use, the grid will be conļ¬ned to the inner skull volume. For a sphere model, a spherical volume with an 80-mm radius, centered at the sphere model origin, will be employed. The dipole grid will be rectangular with a 10-mm spacing between the closest dipole locations. Any locations closer than 20 mm to the center of mass of the grid volume will be excluded as well as those closer than 10 mm to the surface.

Note that this guess grid is only used for establishing the initial guess; the actual dipole ļ¬tting procedure does not constrain the solution to this grid.

When the Fit ECD button in the tool bar is clicked with a time point selected from the the response, the optimal Equivalent Current Dipole parameters (location, orientation, and amplitude) are determined using the following algorithm:

1. An initial guess for the location of the dipole is determined using the grid of locations determined in step 4., above. At each guess dipole location, the least squares error between the measured data and a dipole at that location is evaluated and the location corresponding to the smallest error is used as the initial guess location. In this process, the dipole amplitude parameters do not need to be explicitly calculated.

2. Using the Nelder-Mead simplex optimization algorithm, an optimal dipole location is determined with the sphere model used as the forward model. Again, the dipole amplitude parameters are not explicitly present in the ļ¬tting procedure.

3. A second optimization interation using the boundary-element model (if available) or the sphere model as the forward model is conducted. The reason for repeating the optimization even with the sphere model is to reduce the likelihood of having been stuck in a local minimum of the least squares error criterion.

4. The optimal dipole amplitude parameters are determined for the optimal dipole location obtained in steps 2. and 3.

5. The dipole parameters are reported in the dipole list discussed in

Section 7.15.3.

Additional notes:

1. The noise covariance matrix is always applied to the data and the forward solution as appropriate to correctly weight the different types of

MEG channels and EEG. Depending on the dipole ļ¬tting settings, the

183

7

Interactive analysis noise covariance may be either a diagonal matrix or a full matrix including the correlations.

2. Using the SVD of the whitened gain matrix of three dipole componets at a given location, the component producing the weakest signal amplitude is omitted if the ratio of the smallest and largest singular values is less than 0.2.

3. The present MNE software package also contains a batch-mode dipole ļ¬tting program called mne_dipole_ļ¬t. This piece of software is not yet documented here. However, mne_dipole_fit --help lists the command-line options which have direct correspondence to the interactive dipole ļ¬tting options discussed here.

7.15.3 The dipole list

184

Figure 7.27 The dipole list.

The dipole list dialog shown in Figure 7.27 contains the parameters of the

dipoles ļ¬tted. In addition, it is possible to import current dipole locations from the Neuromag source modelling program xļ¬t to mne_analyze.

Dipoles can be imported in two ways:

MSH-MNE

MSH-MNE

Interactive analysis

7

1. Bring up the dipole list window from Windows/Show dipole list....

Drag and drop selected dipoles from one of the xļ¬t dipole list to this list using the middle mouse button.

2. Drag and drop dipoles from one of the xļ¬t dipole lists over the main surface display. The dipole list will appear and contain the dropped dipoles.

The buttons at the bottom of the dialog perform the following functions:

Done

Show

Save

Clear

Hide the dialog.

Show the currently selected dipoles as speciļ¬ed in Display

options

, see below.

Save the selected (or all) dipoles. If the ļ¬le name speciļ¬ed in the ļ¬le selection dialog that pops up ends with .bdip, the dipole data will be saved in the binary bdip format compatible with the Neuromag xļ¬t software, otherwise, a text format output will be used. In the text ļ¬le, comments will be included on lines starting with the percent sign so that the text format can be easily loaded into Matlab.

Clear the selected dipoles from the list.

When you double click on one of the dipoles or select several dipoles and click Show points on the surface displayed in the vicinity of the dipoles will be painted according to the speciļ¬cations given in the Options section of the dialog:

Color

By the default, the dipoles are marked in green with transparency

(alpha) set to 0.5. I you click on one of the dipoles, you can adjust the color of this dipole by editing the color values or from the color editor appearing when you click Color.... When you click Apply, the new color values are attached to the selected dipole.

Max. distance for dipoles to show (mm)

If this option is on, only dipoles which are closer to the surface than the distance speciļ¬ed in the adjacent text ļ¬eld are displayed.

Paint all point closer than (mm)

Instead of indicating the point closest to the dipole all points closer than the distance given in the text ļ¬eld will be painted if this option is on. This choice is useful for understanding the shape of the neighborhood of a dipole on the cortical surface.

Number of smooth steps

This option spreads out the dipole marking by the given number of smooth steps to make the dipoles more clearly visible. A suitable choice is 3 or 4.

185

7

Interactive analysis

Keep previous dipoles

If this option is on, previously marked dipoles are not cleared from the display before new ones are shown.

Note: The surface must be loaded to display dipole locations. To calculate the distance from the dipoles to the white matter surface, the white matter tessellation is loaded as needed. Depending on the precise location of the ļ¬tted dipole, the spot indicating the dipole site may easily appear on a different wall of a ļ¬ssure than could be expected. The ļ¬ssural walls can be far apart from each other in the inļ¬‚ated view of the cortex even if they are physically separated by just a few millimeters. The size of the spots indicating the dipole locations do not relate to the dipole strengths or their conļ¬dence limits in any way.

7.15.4 Channel selections

As mentioned in Section 7.7.1, the right mouse button in the topographi-

cal display of channels can be used to restrict the selection of channels taken into account in dipole ļ¬tting. In addition, the channel selections can be manipulated in the channel selection window, which pops up from

Dipoles/Manage channel selections.... Initially this dialog contains the selections deļ¬ned in or $HOME/.mne/mne_analyze.sel or $MNE_ROOT/ setup/mne/mne_analyze/mne_analyze.sel, the personal ļ¬le taking precedence over the system wide default. The Save button in this dialog save the current set of channel selections to the personal selection ļ¬le. The format of this ļ¬le is identical to the channel selection ļ¬le in

mne_browse_raw.

When a channel selection ļ¬le is in effect. the variances of the unselected channels are increased by a factor of 900. This means that unselected channels receive virtually no weight in the least-squares error function or, equivalently, that they are considered to be 30 times more noisy than their true noise value. Since this implementation of channel selections requires recomputation of the initial guess candidate data discussed in

Section 7.15.2, above, changing the selection may take a ļ¬nite amount of

time, especially if a BEM is used for the forward calculation.

Important: Please note that when making a channel selection in the topographical displays, the channels not present in a particular layout are also affected. For example, if you select channels in a layout showing the Vectorview planar gradiometers, the magnetometer channels and EEG channels will be unselected.

186

7.16 Coordinate frame alignment

The MRI-MEG coordinate frame alignment tools included in

mne_analyze utilized the 3D digitizer (Polhemus) data acquired in the

MSH-MNE

Interactive analysis

7

beginning of each MEG/EEG session and the scalp surface triangulation shown in the viewer window. To access the coordinate frame alignment tools:

1. Load digitizer data. You can either load a data set containing digitizer information or load digitizer data from a ļ¬le through the File/Load dig-

itizer data... menu choice.

2. Set up the viewer window and make it visible, see Section 7.10. The

viewer options should be set to show the digitizer data, see

Section 7.10.2.

3. Bring up the Adjust coordinate alignment dialog from Adjust/Coordi-

nate alignment....

MSH-MNE

Figure 7.28 The coordinate frame alignment dialog.

The coordinate frame alignment dialog contains the following sections:

187

7

Interactive analysis

1. Buttons for picking the ļ¬ducial points from the scalp surface and one for setting an initial alignment using these points. When one of the ļ¬ducials is selected, the viewer display automatically rotates to a suitable orientation to make the corresponding ļ¬ducial accessible.

2. Controls for ļ¬ne tuning the alignment. These include movements along the three orthogonal coordinate axes and rotations around them. The buttons marked L and R indicate rotations in counterclockwise and clockwise directions, respectively. The amount of movement (mm) or rotation (degrees) is given in the text ļ¬elds next to the adjustment buttons.

3. Access to an automatic alignment procedure, which employs the Iterative Closest Point (ICP) algorithm.

4. Listing of the current coordinate transformation.

5. Buttons for discarding outlier points (Discard...), for saving a standalone coordinate transformation (Save...), and for saving a complete MRI description ļ¬le (Save MRI set).

Each iteration step of the Iterative Closest Point (ICP) consists of two matching procedures:

1. For each digitizer point, transformed from MEG to the MRI coordinate frame using the current coordinate transformation, the closest point on the triangulated surface is determined.

2. The best coordinate transformation aligning the digitizer points with the closest points on the head surface is computed.

These two steps are iterated the designated number of times. If the Try to

keep nasion in place

option is on, the present location of the nasion receives a strong weight in the second part of each iteration step so that nasion movements are discouraged.

Tip: One possible practical approach to coordinate frame alignment is

discussed in Section 12.11.

7.16.1 Using a high-resolution head surface tessellation

The newest version of FreeSurfer contains a script called mkheadsurf which can be used for coordinate alignment purposes. For more information, try mkheadsurf --help. This script produces a ļ¬le called surf/lh.smseghead

, which can be converted into a ļ¬f ļ¬le using mne_surf2bem.

Suggested usage:

1. Set the SUBJECTS_DIR correctly.

2. Run mkheadsurf: mkheadsurf -subjid <subject>.

3. Goto the directory $SUBJECTS_DIR/<subject>/bem.

188 MSH-MNE

Interactive analysis

7

4. Convert the head surface ļ¬le: mne_surf2bem --surf ../surf/ lh.smseghead --id 4 --check --fif

<subject>-headdense.fif

5. Rename the existing head surface ļ¬le to <subject>-headsparse.fif

6. Copy <subject>-head-dense.fif to <subject>-head.fif

7. Click Reload in the viewer window.

After this you can switch between the dense and smooth head surface tessellations by copying either <subject>-head-dense.fif or <sub-

ject>-head-sparse.fif to <subject>-head.fif.

Important: While the dense head surface tessellation may help in coordinate frame alignment, it will slow down the operation of the viewer window considerably. Furthermore, it cannot be used in forward modelling due to the huge number of triangles. For the BEM, the dense tessellation does not provide much beneļ¬t because the potential distributions are quite smooth and widespread on the scalp.

7.16.2 Using fiducial points identified by other software

If you have identiļ¬ed the three ļ¬ducial points in software outside

mne_analyze, it is possible to display this information on the head surface visualization. To do this, you need to copy the ļ¬le containing the ļ¬ducial location information in MRI (surface RAS) coordinates to

$SUBJECTS_DIR/$SUBJECT/bem/$SUBJECT-ļ¬ducials.ļ¬f. There a three supported ways to create this ļ¬le:

1. Use the mne_make_ļ¬ducial_ļ¬le.m Matlab function (not yet written) to create this ļ¬le.

2. Copy a MRI description ļ¬le with the MEG-MRI coordinate transformation created with MRIlab (typically $SUBJECTS_DIR/$SUBJECT/ mri/T1-neuromag/sets/COR-<date>.ļ¬f to $SUBJECTS_DIR/$SUB-

JECT/bem/$SUBJECT-ļ¬ducials.ļ¬f.

3. For the average subject, fsaverage, copy the fsaverage-ļ¬ducials.ļ¬f ļ¬le

provided with mne_analyze in place, see Section 7.19.

MSH-MNE

7.17 Viewing continuous HPI data

The newest versions of Neuromag software allow continuous acquisition of signals from the HPI coils. On the basis of these data the relative position of the dewar and the head can be computed a few times per second.

The resulting location data, expressed in the form of unit quaternions (see http://mathworld.wolfram.com/Quaternion.html) and a translation.

The continuous HPI data can be through the File/View continuous HPI

data...

menu item, which pops up a standard ļ¬le selection dialog. If the

189

7

Interactive analysis ļ¬le speciļ¬ed ends with .fif a ļ¬f ļ¬le containing the continuous coordinate transformation information is expected. Otherwise, a text log ļ¬le is read. Both ļ¬les are produced by the Neuromag maxļ¬lter software.

Once the data have been successfully loaded, the dialog shown in

Figure 7.29 appears. It contains the following information:

1. Currently selected time point and overview of the data at the current time point,

2. MEG device to MEG head coordinate transformation at the current time point and the incremental transformation from the initial timepoint to the current ļ¬le.

3. Graphical display of the data.

4. Controls for the graphical display.

2.

1.

3.

4.

190

Figure 7.29 Continuous HPI data overview.

The overview items are:

GOF

Geometric mean of the goodness of ļ¬t values of the HPI coils at this time point.

Origin movement

The distance between the head coordinate origins at the ļ¬rst and current time points.

MSH-MNE

Interactive analysis

7

Angular velocity

Estimated current angular velocity of the head.

Coil movements

Comparison of the sensor locations between the ļ¬rst and current time points. The minimum, maximum, average, and median sensor movements are listed.

The graphical display contains the following data:

1. The geometric mean of the HPI coil goodness of ļ¬ts (red curve). The scale for this curve is always 0.9...1.0.

2. The average coil (sensor) movement value (blue curve). The scale is adjustable from the buttons below the display.

3. The estimated angular velocity (deg/s, green curve). The scale is adjustable from the buttons below the display.

4. The current time point indicated with a black cursor.

The slider below the display can be used to select the time point. If you click on the slider, the current time can be adjusted with the arrow keys.

The current head position with respect to the sensor array is show in the

viewer window if it is visible, see Section 7.10. Note that a complete set

of items listed above is only available if a data ļ¬le has been previously

loaded, see Section 7.5.

7.18 Working with the MRI viewer

MSH-MNE

Figure 7.30 The MRI viewer control window.

191

7

Interactive analysis

Selecting Show MRI viewer... from the View menu starts the FreeSurfer

MRI viewer program tkmedit to work in conjunction with mne_analyze.

After a few moments, both tkmedit with the current subject’s T1 MRI data

shown and the MRI viewer control window shown in Figure 7.30 appear.

Note that the tkmedit user interface is initially hidden. The surfaces of a subject must be loaded before starting the MRI viewer.

The MRI viewer control window contains the following items:

Show MRI viewer user interface

If this item is checked, the tkmedit user interface window will be show.

Track surface location in MRI

With this item checked, the cursor in the MRI data window follows the current (clicked) location in surface display or viewer. Note that for the viewer window the surface location will inquired from the surface closest to the viewer. The MEG helmet surface will not be considered. For example, if you click at an EEG electrode location with the scalp surface displayed, the location of that electrode on the scalp will be shown. The cortical surface locations are inquired from the white matter surface.

Show dipole locations in MRI

If this option is selected, whenever a dipole is displayed in the sur-

face view using the dipole list dialog discussed in Section 7.15.3 the

cursor will also move to the same location in the MRI data window.

Show digitizer data in MRI

If digitizer data are loaded, this option shows the locations with green diamonds in the MRI data.

Interpolate voxels

Toggles trilinear interpolation in the MRI data on and off.

Max. intensity projection

Shows a maximum-intensity projection of the MRI data. This is useful in conjunction with the Show digitizer data in MRI option to evaluate the MEG/MRI coordinate alignment

Recenter MRI display

Brings the cursor to the center of the MRI data.

Show surface data in MRI

This button creates an MRI data set containing the surface data displayed and overlays in with the MRI slices shown in the MRI viewer.

192 MSH-MNE

MSH-MNE

Interactive analysis

7

Show segmentation data in MRI

If available, the standard automatically generated segmentation volume (mri/aparc+aseg) is overlaid on the MRI using the standard

FreeSurfer color lookup table ($FREESURFER_HOME/Free-

SurferColorLUT.txt). As a result, the name of the brain structure or region of corex at the current location of the cursor will be reported if the tkmedit user interface is visible. After the segmentation is loaded this button toggles the display of the segmentation on and off.

Show command input and output

Allows sending tcl commands to tkmedit and shows the responses received. The tkmedit tclscripting commands are discussed at https:/

/surfer.nmr.mgh.harvard.edu/fswiki/TkMeditGuide/TkMeditReference/TkMeditScripting.

7.19 Working with the average brain

The FreeSurfer software includes an average subject (fsaverage) with a cortical surface reconstruction. In some cases, the average subject can be used as a surrogate if the MRIs of a subject are not available.

The MNE software comes with additional ļ¬les which facilitate the use of the average subject in conjunction with mne_analyze. These ļ¬les are located in the directory $MNE_ROOT/mne/setup/mne_analyze/fsaverage:

fsaverage_head.ļ¬f

The approximate head surface triangulation for fsaverage.

fsaverage_inner_skull-bem.ļ¬f

The approximate inner skull surface for fsaverage.

fsaverage-ļ¬ducials.ļ¬f

The locations of the ļ¬ducial points (LPA, RPA, and nasion) in MRI

coordinates, see Section 7.16.2.

fsaverage-trans.ļ¬f

Contains a default MEG-MRI coordinate transformation suitable for fsaverage. For details of using the default transformation, see

Section 7.5.

7.20 Compatibility with cliplab

The following graphics displays are compatible with the Elekta-Neuromag report composer cliplab:

193

7

Interactive analysis

1. The main surface display area in the main window, see Section 7.8.

2. The viewer, see Section 7.10.

3. The sample channel display, see Section 7.7.2.

4. The topographical data display, see Section 7.7.1.

5. The SNR time course display, see Section 7.12.2.

6. The source time course display, seeSection 7.13

The graphics can be dragged and dropped from these windows to one of the cliplab view areas using the middle mouse button. Because the topographical display area has another function (bed channel selection) tied to the middle mouse button, the graphics is transferred by doing a middle mouse button drag and drop from the label showing the current time underneath the display area itself.

Note: The cliplab drag-and-drop functionality requires that you have the proprietary Elekta-Neuromag analysis software installed. mne_analyze is compatible with cliplab versions 1.2.13 and later.

194 MSH-MNE

8

C H A P T E R 8

Morphing and averaging

8.1 Overview

The spherical morphing of the surfaces accomplished by FreeSurfer can be employed to bring data from different subjects into a common anatomical frame. This chapter describes utilities which make use of the spherical morphing procedure. mne_morph_labels morphs label ļ¬les between subjects allowing the deļ¬nition of labels in a one brain and transforming them to anatomically analogous labels in another. mne_average_estimates offers the capability to compute averages of data computed with the MNE software across subjects.

8.2 The morphing maps

The MNE software accomplishes morphing with help of morphing maps which can be either computed on demand or precomputed using

mne_make_morph_maps, see Section 8.4. The morphing is performed

with help of the registered spherical surfaces (lh.sphere.reg and rh.sphere.reg

) which must be produced in FreeSurfer. A morphing map is a linear mapping from cortical surface values in subject A (

x

) to those in another subject B (

x

)

x

=

M

(

AB

)

x

, where

M

(

AB

)

is a sparse matrix with at most three nonzero elements on each row. These elements are determined as follows. First, using the aligned spherical surfaces, for each vertex

x

j

B

, ļ¬nd the triangle the spherical surface of subject A which contains the location

x

j

B

T j

A

on

. Next, ļ¬nd the numbers of the vertices of this triangle and set the corresponding elements on the jth row of

M

(

AB

)

so that

x

j

B

will be a linear interpolation between the triangle vertex values reļ¬‚ecting the location

x

j

B

within the triangle

T j

A

.

It follows from the above deļ¬nition that in general

M

(

AB

)

≠ (

M

(

BA

)

)

– 1

,

MSH-MNE 195

8

Morphing and averaging

i.e.,

x

M

(

BA

)

M

(

AB

)

x

even if

x

M

(

BA

)

M

(

AB

)

x

i.e., the mapping is almost a bijection.

,

,

8.3 About smoothing

The current estimates are normally deļ¬ned only in a decimated grid which is a sparse subset of the vertices in the triangular tessellation of the cortical surface. Therefore, any sparse set of values is distributed to neighboring vertices to make the visualized results easily understandable. This procedure has been traditionally called smoothing but a more appropriate name might be smudging or blurring in accordance with similar operations in image processing programs.

In MNE software terms, smoothing of the vertex data is an iterative procedure, which produces a blurred image

x

from the original sparse image

x

by applying in each iteration step a sparse blurring matrix:

x

=

S x

(

p

– 1

)

.

On each row of the matrix

S

there are values equal

(

j p

– 1

)

. Here

N

(

j p

– 1

)

N

(

j p

– 1

)

nonzero entries whose

is the number of immediate neigh-

p

– 1 . Matrix

S

thus assigns the average of the non-zero neighbors as the new value serve the amplitudes while blurring the surface image.

Once the indices non-zero vertices in

x

and the topology of the triangulation are ļ¬xed the matrices

S

are ļ¬xed and independent of the data.

Therefore, it would be in principle possible to construct a composite blurring matrix

S

=

N

p

= 1

S

.

196 MSH-MNE

MSH-MNE

Morphing and averaging

8

However, it turns out to be computationally more effective to do blurring with an iteration. The above formula for

S

also shows that the smudging (smoothing) operation is linear.

8.4 Precomputing the morphing maps

The utility mne_make_morph_maps was created to assist mne_analyze and mne_make_movie in morphing. Since the morphing maps described above take a while to compute, it is beneļ¬cial to construct all necessary maps in advance before using mne_make_movie. The precomputed morphing maps are located in $SUBJECTS_DIR/morph-maps.

mne_make_morph_maps creates this directory automatically if it does not exist. If this directory exists when mne_analyze or mne_make_movie is run and morphing is requested, the software ļ¬rst looks for already existing morphing maps there. Also, if mne_analyze or mne_make_movie have to recompute any morphing maps, they will be saved to

$SUBJECTS_DIR/morph-maps

if this directory exists.

The names of the ļ¬les in $SUBJECTS_DIR/morph-maps are of the form:

<A>-<B>-morph.fif, where <A> and <B> are names of subjects. These ļ¬les contain the maps for both hemispheres, and in both directions, i.e., both

M

(

AB

)

and

M

(

BA

)

, as deļ¬ned above. Thus the ļ¬les <A>-<B>-morph.fif or <B>-<A>morph.fif

are functionally equivalent. The name of the ļ¬le produced by mne_analyze or mne_make_movie depends on the role of <A> and

<B> in the analysis.

If you choose to compute the morphing maps in batch in advance, use

mne_make_morph_maps, which accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--redo

Recompute the morphing maps even if they already exist.

--from <subject>

Compute morphing maps from this subject.

--to <subject>

Compute morphing maps to this subject.

197

8

Morphing and averaging

--all

Do all combinations. If this is used without either --from or --to options, morphing maps for all possible combinations are computed. If --from or --to is present, only maps between the speciļ¬ed subject and all others are computed.

Note: Because all morphing map ļ¬les contain maps in both directions, the choice of --from and --to options only affect the naming of the morphing map ļ¬les to be produced. mne_make_morph_maps creates directory $SUBJECTS_DIR/morph-maps if necessary.

8.5 Morphing label data

In some instances it is desirable to use anatomically equivalent labels for all subjects in a study. This can be accomplished by creating a set of labels in one subject and morphing them to another subjects anatomy using the spherical morphing procedure. mne_morph_labels was created to facilitate this task. It has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--from <subject>

Name of the subject for which the labels were originally deļ¬ned.

--to <subject>

Name of the subject for which the morphed labels should be created.

--labeldir <directory>

A directory containing the labels to morph.

--smooth <number>

Apply smoothing with the indicated number of iteration steps (see

Section 8.3) to the labels before morphing them. This is advisable

because otherwise the resulting labels may have little holes in them since the morphing map is not a bijection. By default, two smoothsteps are taken.

As the labels are morphed, a directory with the name of the subject speciļ¬ed with the --to option is created under the directory speciļ¬ed with -labeldir

to hold the morphed labels.

198 MSH-MNE

MSH-MNE

Morphing and averaging

8

8.6 Averaging

8.6.1 Overview

As illustrated in Figure 8.1, cross-subject averaging involves three

straightforward steps:

1. Use mne_make_movie to create stc ļ¬les morphed to a single subject.

This requires the use of the --morph option, see Section 6.5.5. The

resulting files will have identical selections of vertices on the cortical surface of the subject used in averaging. This step can be speeded up by precomputing the morphing maps employed in the process, see

Section 8.4.

2. Employ mne_average_estimates or a Matlab script to read the data from the stc ļ¬les and to produce an output stc ļ¬le containing the averaged data. The MNE Matlab toolbox routines for reading and writing

stc ļ¬les are documented in Chapter 10.

3. Use mne_analyze or mne_make_movie to visualize the result or use the stc ļ¬les from the previous step in your own Matlab routines in further processing.

Surface files

Measurement data

Inverse operators

Surface files

Morphing maps (optional)

[mne_make_morph_maps (8.4)]

Morphed stc files

[mne_make_movie (6.5)]

Averaged stc files

[mne_average_estimates (8.6)]

Quicktime movies, snapshots, w-files

[mne_make_movie (6.7)]

[mne_analyze (7)]

Figure 8.1 Workļ¬‚ow of the cross-subject averaging process in MNE software. References in parenthesis indicate sections and chapters of this manual

Note: The old utility mne_grand_average has been removed from the

MNE software because of its inefļ¬ciency. All users should adopt the combination of mne_make_movie and mne_average_estimates instead.

199

8

Morphing and averaging

Warning: With the --ico option it is now possible to generate source spaces with equal number of vertices in each subject. This may lead to the wrong conclusion that stc data could be averaged without doing the morphing step ļ¬rst. Even with identical number vertices in the source spaces it is mandatory to process the data through mne_make_movie to create corresponding source locations before using mne_average_estimates.

8.6.2 The averager

mne_average_estimates is the new utility for averaging data in stc ļ¬les. It requires that all stc ļ¬les represent data on one individual’s cortical surface and contain identical sets of vertices. mne_average_estimates uses linear interpolation to resample data in time as necessary. The command line arguments are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--desc <ļ¬lenname>

Speciļ¬es the description ļ¬le for averaging. The format of this ļ¬le is described below.

8.6.2.1 The description file

The description ļ¬le for mne_average_estimates consists of a sequence of tokens, separated by whitespace (space, tab, or newline). If a token consists of several words it has to be enclosed in quotes. One or more tokens constitute an phrase, which has a meaning for the averaging deļ¬nition.

Any line starting with the pound sign (#) is a considered to be a comment line. There are two kinds of phrases in the description ļ¬le: global and contextual. The global phrases have the same meaning independent on their location in the ļ¬le while the contextual phrases have different effects depending on their location in the ļ¬le.

There are three types of contexts in the description ļ¬le: the global context, an input context, and the output context. In the beginning of the ļ¬le the context is global for deļ¬ning global parameters. The input context deļ¬nes one of the input ļ¬les (subjects) while the output context speciļ¬es the destination for the average.

The global phrases are:

200 MSH-MNE

MSH-MNE

Morphing and averaging

8 tmin <value/ms>

The minimum time to be considered. The output stc ļ¬le starts at this time point if the time ranges of the stc ļ¬les include this time. Otherwise the output starts from the next later available time point.

tstep <step/ms>

Time step between consecutive movie frames, speciļ¬ed in milliseconds.

tmax <value/ms>

The maximum time point to be considered. A multiple of tstep will be added to the ļ¬rst time point selected until this value or the last time point in one of the input stc ļ¬les is reached.

integ <

āˆ†

t

/ms>

Integration time for each frame. Defaults to zero. The integration will be performed on sensor data. If the time speciļ¬ed for a frame is

t

0

, the integration range will be

t

0

āˆ†

t 2

t t

0

+

āˆ†

t 2

.

stc <ļ¬lename>

Speciļ¬es an input stc ļ¬le. The ļ¬lename can be speciļ¬ed with one of the -lh.stc and -rh.stc endings or without them. This phrase ends the present context and starts an input context.

deststc <ļ¬lename>

Speciļ¬es the output stc ļ¬le. The ļ¬lename can be speciļ¬ed with one of the -lh.stc and -rh.stc endings or without them. This phrase ends the present context and starts the output context.

lh

Process the left hemisphere. By default, both hemispheres are processed.

rh

Process the left hemisphere. By default, both hemispheres are processed.

The contextual phrases are:

weight <value>

Speciļ¬es the weight of the current data set. This phrase is valid in the input and output contexts.

abs

Speciļ¬es that the absolute value of the data should be taken. Valid in all contexts. If speciļ¬ed in the global context, applies to all subsequent input and output contexts. If speciļ¬ed in the input or output contexts, applies only to the data associated with that context.

201

8

Morphing and averaging

pow <value>

Speciļ¬es that the data should raised to the speciļ¬ed power. For negative values, the absolute value of the data will be taken and the negative sign will be transferred to the result, unless abs is speciļ¬ed.

Valid in all contexts. Rules of application are identical to abs.

sqrt

Means pow 0.5

The effects of the options can be summarized as follows. Suppose that the organized in matrices

S

, where

p

=

1

P

is the subject index, and the rows are the signals at different vertices of the cortical surface. The average computed by mne_average_estimates is then:

A jk

=

w

[ sgn

(

B jk

) ]

α

B jk

β with

B jk

=

P

p

= 1

w p

[ sgn

(

S jk

) ]

α

p

S jk p p

and

w p

=

w p

P

p

= 1

w p

.

(

In the above,

β

p

and respectively. The sign is either included (

α

p

= 2 ,

α

= description ļ¬le.

2

w

β

p

are the powers and weights assigned to each of the subjects whereas and

w

are the output weight and power value,

α

p

= 1 ,

α

= 1 ) or omitted

) depending on the presence of abs phrases in the

Note: mne_average_estimates requires that the number of vertices in the stc ļ¬les are the same and that the vertex numbers are identical. This will be the case if the ļ¬les have been produced in mne_make_movie using the

--morph

option.

Note: It is straightforward to read and write stc ļ¬les using the MNE Mat-

lab toolbox described in Chapter 10 and thus write custom Matlab func-

tions to realize more complicated custom group analysis tools.

202 MSH-MNE

9

C H A P T E R 9

Data conversion

9.1 Overview

This Chapter describes the data conversion utilities included with the

MNE software.

9.2 Importing data from other MEG/EEG systems

This section describes the utilities to convert data from other MEG/EEG systems into the ļ¬f format.

9.2.1 Importing 4-D Neuroimaging data

The newest version of 4-D Magnes software includes the possibility to export data in ļ¬f. Please consult the documentation of the Magnes system for details of this export utility. However, the exported ļ¬f ļ¬le does not include information about the compensation channels and the weights to be applied to realize software gradient compensation. To augment the

Magnes ļ¬f ļ¬les with the necessary information, the MNE software includes the utilities mne_insert_4D_comp, mne_create_comp_data, and

mne_add_to_meas_info.

As a result, the complete 4D Magnes data conversion process involves the following steps:

1. Export the raw data ļ¬f ļ¬le from the Magnes system.

2. If the data comes from a Magnes system where the primary (helmet) sensors are gradiometers instead of magnetometers, run

mne_ļ¬x_mag_coil_types with the --magnes option to correct the

channel information in the ļ¬le, see Section 11.4.4.

3. Export a text ļ¬le containing the Magnes compensation sensor data.

4. Create a text ļ¬le containing the appropriate compensation channel weights.

5. Run mne_insert_4D_comp with the ļ¬les created in the ļ¬rst two steps to merge compensation channel data with the original Magnes ļ¬f ļ¬le.

MSH-MNE 203

9

Data conversion

6. Run mne_create_comp_data on the ļ¬le created in step 3. to make a ļ¬f ļ¬le containing the compensation weights.

7. Run mne_add_to_meas_info with the ļ¬f ļ¬les created in steps 4. and 5.

as input to result in a complete ļ¬f ļ¬le containing all the necessary data.

Note: Including the compensation channel data is recommended but not mandatory. If the data are saved in the Magnes system are already compensated, there will be a small error in the forward calculations whose signiļ¬cance has not been evaluated carefully at this time.

9.2.2 Importing CTF data

The MNE software includes a utility mne_ctf2ļ¬ff, based on the Brain-

Storm Matlab code by Richard Leahy, John Mosher, and Sylvain Baillet, to convert data in CTF ds directory to ļ¬f format.

The command-line options of mne_ctf2ļ¬ff are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--verbose

Produce a verbose listing of the conversion process to stdout.

--ds <directory>

Read the data from this directory

--omit <ļ¬lename>

Read the names of channels to be omitted from this text ļ¬le. Enter one channel name per line. The names should match exactly with those listed in the CTF data structures. By default, all channels are included.

--ļ¬f <ļ¬lename>

The name of the output ļ¬le. If the length of the raw data exceeds the

2-GByte ļ¬f ļ¬le limit, several output ļ¬les will be produced. These additional ‘extension’ ļ¬les will be tagged with _001.fif,

_002.fif

, etc.

--evoked

Produce and evoked-response ļ¬f ļ¬le instead of a raw data ļ¬le. Each trial in the CTF data ļ¬le is included as a separate category (condition). The maximum number of samples in each trial is limited to

25000.

204 MSH-MNE

MSH-MNE

Data conversion

9

--infoonly

Write only the measurement info to the output ļ¬le, do not include data.

During conversion, the following ļ¬les are consulted from the ds directory:

<name>.res4

This ļ¬le contains most of the header information pertaining the acquisition.

<name>.hc

This ļ¬le contains the HPI coil locations in sensor and head coordinates.

<name>.meg4

This ļ¬le contains the actual MEG data. If the data are split across several ļ¬les due to the 2-GByte ļ¬le size restriction, the ‘extension’ ļ¬les are called <name>.<number>_meg4.

<name>.eeg

This is an optional input ļ¬le containing the EEG electrode locations.

More details are given below.

If the <name>.eeg ļ¬le, produced from the Polhemus data ļ¬le with CTF software, is present, it is assumed to contain lines with the format:

<number> <name> <x/cm> <y/cm> <z/cm>

The ļ¬eld <number> is a sequential number to be assigned to the converted data point in the ļ¬f ļ¬le. <name> is either a name of an EEG channel, one of left, right, or nasion to indicate a ļ¬ducial landmark, or any word which is not a name of any channel in the data. If <name> is a name of an EEG channel available in the data, the location is included in the Polhemus data as an EEG electrode locations and inserted as the location of the EEG electrode. If the name is one of the ļ¬ducial landmark names, the point is included in the Polhemus data as a ļ¬ducial landmark.

Otherwise, the point is included as an additional head surface points.

The standard eeg ļ¬le produced by CTF software does not contain the ļ¬ducial locations. If desired, they can be manually copied from the pos ļ¬le which was the source of the eeg ļ¬le.

Note: In newer CTF data the EEG position information maybe present in the res4 ļ¬le. If the eeg ļ¬le is present, the positions given there take precedence over the information in the res4 ļ¬le.

Important: mne_ctf2ļ¬ff converts both epoch mode and continuous raw data ļ¬le into raw data ļ¬f ļ¬les. It is not advisable to use epoch mode ļ¬les with time gaps between the epochs because the data will be discontinuous in the resulting ļ¬f ļ¬le with jumps at the junctions between epochs. These

205

9

Data conversion discontinuities produce artefacts if the raw data is ļ¬ltered in

mne_browse_raw, mne_process_raw, or graph.

Note: The conversion process includes a transformation from the CTF head coordinate system convention to that used in the Neuromag systems.

9.2.3 Importing CTF Polhemus data

The CTF MEG systems store the Polhemus digitization data in text ļ¬les.

The utility mne_ctf_dig2ļ¬ff was created to convert these data ļ¬les into the ļ¬f and hpts formats.

The input data to mne_ctf_dig2ļ¬ff is a text ļ¬le, which contains the coordinates of the digitization points in centimeters. The ļ¬rst line should contain a single number which is the number of points listed in the ļ¬le. Each of the following lines contains a sequential number of the point, followed by the three coordinates. mne_ctf_dig2ļ¬ff ignores any text following the

z

coordinate on each line. If the --numfids option is speciļ¬ed, the ļ¬rst three points indicate the three ļ¬ducial locations (1 = nasion, 2 = left auricular point, 3 = right auricular point). Otherwise, the input ļ¬le must end with three lines beginning with left, right, or nasion to indicate the locations of the ļ¬ducial landmarks, respectively.

Note: The sequential numbers should be unique within a ļ¬le. I particular, the numbers 1, 2, and 3 must not be appear more than once if the --numfids

options is used.

The command-line options for mne_ctf_dig2ļ¬ff are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--dig <name>

Speciļ¬es the input data ļ¬le in CTF output format.

--numļ¬ds

Fiducial locations are numbered instead of labeled, see above.

--hpts <name>

Speciļ¬es the output hpts ļ¬le. The format of this text ļ¬le is described

in Section 9.3.1.

--ļ¬f <name>

Speciļ¬es the output ļ¬f ļ¬le.

206 MSH-MNE

MSH-MNE

Data conversion

9

9.2.4 Applying software gradient compensation

Since the software gradient compensation employed in CTF systems is a reversible operation, it is possible to change the compensation status of

CTF data in the data ļ¬les as desired. This section contains information about the technical details of the compensation procedure and a description of mne_compensate_data, which is a utility to change the software gradient compensation state in evoked-response data ļ¬les.

The ļ¬f ļ¬les containing CTF data converted using the utility mne_ctf2ļ¬ff contain several compensation matrices which are employed to suppress external disturbances with help of the reference channel data. The reference sensors are located further away from the brain than the helmet sensors and are thus measuring mainly the external disturbances rather than magnetic ļ¬elds originating in the brain. Most often, a compensation matrix corresponding to a scheme nicknamed Third-order gradient com-

pensation is employed.

Let us assume that the data contain

n

3

n

1 can be concatenated into a single vector

MEG sensor channels,

n

2

reference sensor channels, and other channels. The data from all channels

x

=

T

x

1

T

x

2

T

x

3

T

, where

x

1

,

x

2

, and

x

3

are the data vectors corresponding to the MEG sensor channels, reference sensor channels, and other channels, respectively.

The data before and after compensation, denoted here by

x

and

x

, respectively, are related by

x

=

M x

, where the composite compensation matrix is

M

=

I

n

1

C 0

0 I

n

2

0

0 0 I

n

3

.

In the above,

C

is a

n

1

by n

k

2

compensation data matrix corresponding to compensation “grade” . It is easy to see that

207

9

Data conversion

208

M

– 1

( )

=

I

n

1

C 0

0 I

n

2

0

0 0 I

n

3

.

inverse of one compensate compensation matrix by another and apply the product to the data:

x

=

M M

– 1

( )

x

.

This operation is performed by mne_compensate_data, which has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the input data ļ¬le.

--out <name>

Speciļ¬es the output data ļ¬le.

--grad <number>

Speciļ¬es the desired compensation grade in the output ļ¬le. The value can be 1, 2, 3, or 101. The values starting from 101 will be used for 4D Magnes compensation matrices.

Note: Only average data is included in the output. Evoked-response data ļ¬les produced with mne_browse_raw or mne_process_raw may include standard errors of mean, which can not be re-compensated using the above method and are thus omitted.

Tip: Raw data cannot be compensated using mne_compensate_data. For this purpose, load the data to mne_browse_raw or mne_process_raw, specify the desired compensation grade, and save a new raw data ļ¬le.

9.2.5 Importing Magnes compensation channel data

At present, it is not possible to include reference channel data to ļ¬f ļ¬les containing 4D Magnes data directly using the conversion utilities available for the Magnes systems. However, it is possible to export the com-

MSH-MNE

MSH-MNE

Data conversion

9

pensation channel signals in text format and merge them with the MEG helmet channel data using mne_insert_4D_comp. This utility has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the input ļ¬f ļ¬le containing the helmet sensor data.

--out <name>

Speciļ¬es the output ļ¬f ļ¬le which will contain both the helmet sensor data and the compensation channel data.

--ref <name>

Speciļ¬es a text ļ¬le containing the reference sensor data.

Each line of the reference sensor data ļ¬le contains the following information:

epoch #

is always one,

time/s

time point of this sample,

data/T

the reference channel data values.

The standard locations of the MEG (helmet) and compensation sensors in a Magnes WH3600 system are listed in $MNE_ROOT/setup/mne/

Magnes_WH3600.pos

. mne_insert_4D_comp matches the helmet sensor positions in this ļ¬le with those present in the input data ļ¬le and transforms the standard compensation channel locations accordingly to be included in the output. Since a standard position ļ¬le is only provided for

Magnes WH600, mne_insert_4D_comp only works for that type of a system.

The ļ¬f ļ¬les exported from the Magnes systems may contain slightly smaller number of samples than originally acquired because the total number of samples may not be evenly divisible with a reasonable number of samples which will be used as the ļ¬f raw data ļ¬le buffer size. Therefore, the reference channel data may contain more samples than the ļ¬f ļ¬le. The superļ¬‚uous samples will be omitted from the end.

9.2.6 Creating software gradient compensation data

The utility mne_create_comp_data was written to create software gradient compensation weight data for 4D Magnes ļ¬f ļ¬les. This utility takes a text ļ¬le containing the compensation data as input and writes the corre-

209

9

Data conversion sponding ļ¬f ļ¬le as output. This ļ¬le can be merged into the ļ¬f ļ¬le containing 4D Magnes data with the utility mne_add_to_meas_info.

The command line options of mne_create_comp_data are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the input text ļ¬le containing the compensation data.

--kind <value>

The compensation type to be stored in the output ļ¬le with the data.

This value defaults to 101 for the Magnes compensation and does not need to be changed.

--out <name>

Speciļ¬es the output ļ¬f ļ¬le containing the compensation channel weight matrix

C

, see Section 9.2.4.

The format of the text-format compensation data ļ¬le is:

<number of MEG helmet channels>

<number of compensation channels included>

<

<

cname name

1

1

> <

cname

> <weights>

2

<

name

2

> <weights>

>

In the above <

<

cname k name k

> denote names of MEG helmet channels and

> those of the compensation channels, respectively. If the channel names contain spaces, they must be surrounded by quotes, for example, “MEG 0111”.

9.2.7 Importing KIT MEG system data

The utility mne_kit2ļ¬ff was created in collaboration with Alec Maranz and

Asaf Bachrach to import their MEG data acquired with the 160-channel

KIT MEG system to MNE software.

To import the data, the following input ļ¬les are mandatory:

1. The Polhemus data ļ¬le (elp ļ¬le) containing the locations of the ļ¬ducials and the head-position indicator (HPI) coils. These data are usually given in the CTF/4D head coordinate system. However, mne_kit2ļ¬ff

210 MSH-MNE

MSH-MNE

Data conversion

9

does not rely on this assumption. This ļ¬le can be exported directly from the KIT system.

2. A ļ¬le containing the locations of the HPI coils in the MEG device coordinate system. These data are used together with the elp ļ¬le to establish the coordinate transformation between the head and device coordinate systems. This ļ¬le can be produced easily by manually editing one of the ļ¬les exported by the KIT system.

3. A sensor data ļ¬le (sns ļ¬le) containing the locations and orientations of the sensors. This ļ¬le can be exported directly from the KIT system.

Note: The output ļ¬f ļ¬le will use the Neuromag head coordinate system

convention, see Section 5.3. A coordinate transformation between the

CTF/4D head coordinates and the Neuromag head coordinates is included. This transformation can be read with MNE Matlab Toolbox rou-

tines, see Chapter 10.

The following input ļ¬les are optional:

1. A head shape data ļ¬le (hsp ļ¬le) containing locations of additional points from the head surface. These points must be given in the same coordinate system as that used for the elp ļ¬le and the ļ¬ducial locations must be within 1 mm from those in the elp ļ¬le.

2. A raw data ļ¬le containing the raw data values, sample by sample, as text. If this ļ¬le is not speciļ¬ed, the output ļ¬f ļ¬le will only contain the measurement info block.

By default mne_kit2ļ¬ff includes the ļ¬rst 157 channels, assumed to be the

MEG channels, in the output ļ¬le. The compensation channel data are not converted by default but can be added, together with other channels, with the --type. The channels from 160 onwards are designated as miscellaneous input channels (MISC 001, MISC 002, etc.). The channel names and types of these channels can be afterwards changed with the

mne_rename_channels utility, see Section 11.4.5. In addition, it is possi-

ble to synthesize the digital trigger channel (STI 014) from available analog trigger channel data, see the --stim option, below. The synthesized where

t p

=

n

p

= 1

t p p

1

,

are the thresholded from the input channel data

d p

:

t p

=

0 if d

p

1 if d

p

.

211

9

Data conversion

212 see below.

mne_kit2ļ¬ff accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--elp <ļ¬lename>

The name of the ļ¬le containing the locations of the ļ¬ducials and the

HPI coils. This option is mandatory.

--hsp <ļ¬lename>

The name of the ļ¬le containing the locations of the ļ¬ducials and additional points on the head surface. This ļ¬le is optional.

--sns <ļ¬lename>

The name of ļ¬le containing the sensor locations and orientations.

This option is mandatory.

--hpi <ļ¬lename>

The name of a text ļ¬le containing the locations of the HPI coils in the MEG device coordinate frame, given in millimeters. The order of the coils in this ļ¬le does not have to be the same as that in the elp ļ¬le. This option is mandatory.

--raw <ļ¬lename>

Speciļ¬es the name of the raw data ļ¬le. If this ļ¬le is not speciļ¬ed, the output ļ¬f ļ¬le will only contain the measurement info block.

--sfreq <value/Hz>

The sampling frequency of the data. If this option is not speciļ¬ed, the sampling frequency defaults to 1000 Hz.

--lowpass <value/Hz>

The lowpass ļ¬lter corner frequency used in the data acquisition. If not speciļ¬ed, this value defaults to 200 Hz.

--highpass <value/Hz>

The highpass ļ¬lter corner frequency used in the data acquisition. If not speciļ¬ed, this value defaults to 0 Hz (DC recording).

--out <ļ¬lename>

Speciļ¬es the name of the output ļ¬f format data ļ¬le. If this ļ¬le is not speciļ¬ed, no output is produced but the elp, hpi, and hsp ļ¬les are processed normally.

MSH-MNE

Data conversion

9

--stim <chs>

Speciļ¬es a colon-separated list of numbers of channels to be used to synthesize a digital trigger channel. These numbers refer to the scanning order channels as listed in the sns ļ¬le, starting from one.

The digital trigger channel will be the last channel in the ļ¬le. If this option is absent, the output ļ¬le will not contain a trigger channel.

--stimthresh <value>

The threshold value used when synthesizing the digital trigger channel, see above. Defaults to 1.0.

--add <chs>

Speciļ¬es a colon-separated list of numbers of channels to include between the 157 default MEG channels and the digital trigger channel. These numbers refer to the scanning order channels as listed in the sns ļ¬le, starting from one.

Important: The mne_kit2ļ¬ff utility has not been extensively tested yet.

MSH-MNE

9.2.8 Importing EEG data saved in the EDF, EDF+, or BDF format

The mne_edf2ļ¬ff allows conversion of EEG data from EDF, EDF+, and

BDF formats to the ļ¬f format. Documentation for these three input formats can be found at:

EDF:

http://www.edfplus.info/specs/edf.html

EDF+:

http://www.edfplus.info/specs/edfplus.html

BDF:

http://www.biosemi.com/faq/ļ¬le_format.htm

EDF (European Data Format) and EDF+ are 16-bit formats while BDF is a 24-bit variant of this format used by the EEG systems manufactured by a company called BioSemi.

None of these formats support electrode location information and head shape digitization information. Therefore, this information has to be provided separately. Presently hpts and elp ļ¬le formats are supported to include digitization data. For information on these formats, see

Section 9.3.1 and http://www.sourcesignal.com/formats_probe.html. Note

that it is mandatory to have the three ļ¬ducial locations (nasion and the two auricular points) included in the digitization data. Using the locations of the ļ¬ducial points the digitization data are converted to the MEG head

coordinate system employed in the MNE software, see Section 5.3. In the

comparison of the channel names only the intial segment up to the ļ¬rst ‘-’

(dash) in the EDF/EDF+/BDF channel name is signiļ¬cant.

The EDF+ ļ¬les may contain an annotation channel which can be used to store trigger information. The Time-stamped Annotation Lists (TALs) on the annotation data can be converted to a trigger channel (STI 014) using an annotation map ļ¬le which associates an annotation label with a number

213

9

Data conversion

214 on the trigger channel. The TALs can be listed with the --listtal option, see below.

Warning: The data samples in a BDF ļ¬le are represented in a 3-byte (24bit) format. Since 3-byte raw data buffers are not presently supported in the ļ¬f format these data will be changed to 4-byte integers in the conversion. Since the maximum size of a ļ¬f ļ¬le is 2 GBytes, the maximum size of a BDF ļ¬le to be converted is approximately 1.5 GBytes

Warning: The EDF/EDF+/BDF formats support channel dependent sampling rates. This feature is not supported by mne_edf2ļ¬ff. However, the annotation channel in the EDF+ format can have a different sampling rate.

The annotation channel data is not included in the ļ¬f ļ¬les output.

The command-line options of mne_edf2ļ¬ff are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--edf <ļ¬lename>

Speciļ¬es the name of the raw data ļ¬le to process.

--tal <ļ¬lename>

List the time-stamped annotation list (TAL) data from an EDF+ ļ¬le here. This output is useful to assist in creating the annotation map ļ¬le, see the --annotmap option, below. This output ļ¬le is an event ļ¬le compatible with mne_browse_raw and mne_process_raw, see

Chapter 4. In addition, in the mapping between TAL labels and trig-

ger numbers provided by the --annotmap option is employed to assign trigger numbers in the event ļ¬le produced. In the absense of the --annotmap option default trigger number 1024 is used.

--annotmap <ļ¬lename>

Specify a ļ¬le which maps the labels of the TALs to numbers on a trigger channel (STI 014) which will be added to the output ļ¬le if this option is present. This annotation map ļ¬le may contain comment lines starting with the ‘%’ or ‘#’ characters. The data lines contain a label-number pair, separated by a colon. For example, a line ‘Trigger-1:9’ means that each annotation labeled with the text

‘Trigger-1’ will be translated to the number 9 on the trigger channel.

--elp <ļ¬lename>

Speciļ¬es the name of the an electrode location ļ¬le. This ļ¬le is in the

“probe” ļ¬le format used by the Source Signal Imaging, Inc. soft-

MSH-MNE

MSH-MNE

Data conversion

9

ware. For description of the format, see http://www.sourcesignal.com/formats_probe.html. Note that some other software packages may produce electrode-position ļ¬les with the elp ending not conforming to the above speciļ¬cation. As discussed above, the ļ¬ducial marker locations, optional in the “probe” ļ¬le format speciļ¬cation are mandatory for mne_edf2ļ¬ff. When this option is encountered on the command line any previously speciļ¬ed hpts ļ¬le will be ignored.

--hpts <ļ¬lename>

Speciļ¬es the name of an electrode position ļ¬le in the hpts format

discussed in Section 9.3.1. The mandatory entries are the ļ¬ducial

marker locations and the EEG electrode locations. It is recommended that electrode (channel) names instead of numbers are used to label the EEG electrode locations. When this option is encountered on the command line any previously speciļ¬ed elp ļ¬le will be ignored.

--meters

Assumes that the digitization data in an hpts ļ¬le is given in meters instead of millimeters.

--ļ¬f <ļ¬lename>

Speciļ¬es the name of the ļ¬f ļ¬le to be output.

9.2.9 Importing EEG data saved in the Tufts University format

The utility mne_tufts2ļ¬ff was created in collaboration with Phillip Holcomb and Annette Schmid from Tufts University to import their EEG data to the MNE software.

The Tufts EEG data is included in three ļ¬les:

1. The raw data ļ¬le containing the acquired EEG data. The name of this ļ¬le ends with the sufļ¬x .raw.

2. The calibration raw data ļ¬le. This ļ¬le contains known calibration signals and is required to bring the data to physical units. The name of this ļ¬le ends with the sufļ¬x c.raw.

3. The electrode location information ļ¬le. The name of this ļ¬le ends with the sufļ¬x .elp.

The utility mne_tufts2ļ¬ff has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

215

9

Data conversion

--raw <ļ¬lename>

Speciļ¬es the name of the raw data ļ¬le to process.

--cal <ļ¬lename>

The name of the calibration data ļ¬le. If calibration data are missing, the calibration coefļ¬cients will be set to unity.

--elp <ļ¬lename>

The name of the electrode location ļ¬le. If this ļ¬le is missing, the electrode locations will be unspeciļ¬ed. This ļ¬le is in the “probe” ļ¬le format used by the Source Signal Imaging, Inc. software. For description of the format, see http://www.sourcesignal.com/ formats_probe.html. The ļ¬ducial marker locations, optional in the

“probe” ļ¬le format speciļ¬cation are mandatory for mne_tufts2ļ¬ff.

Note that some other software packages may produce electrodeposition ļ¬les with the elp ending not conforming to the above speciļ¬cation.

Note: The conversion process includes a transformation from the Tufts head coordinate system convention to that used in the Neuromag systems.

Important: The ļ¬ducial landmark locations, optional in the probe ļ¬le format, must be present for mne_tufts2ļ¬ff.

9.2.10 Importing BrainVision EEG data

The utility mne_brain_vision2ļ¬ff was created to import BrainVision EEG data. This utility also helps to import the eXimia (Nexstim) TMS-compatible EEG system data to the MNE software. The utility uses an optional ļ¬f ļ¬le containing the head digitization data to allow source modeling. The

MNE Matlab toolbox contains the function ļ¬ff_write_dig_ļ¬le to write a digitization ļ¬le based on digitization data available in another format, see

Chapter 10.

The command-line options of mne_brain_vision2ļ¬ff are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--header <name>

The name of the BrainVision header ļ¬le. The extension of this ļ¬le is vhdr

. The header ļ¬le typically refers to a marker ļ¬le (vmrk) which is automatically processed and a digital trigger channel (STI 014) is formed from the marker information. The vmrk ļ¬le is ignored if the

--eximia

option is present.

216 MSH-MNE

MSH-MNE

Data conversion

9

--dig <name>

The name of the ļ¬f ļ¬le containing the digitization data.

--orignames

Use the original EEG channel labels. If this option is absent the

EEG channels will be automatically renamed to EEG 001, EEG

002, etc.

--eximia

Interpret this as an eXimia data ļ¬le. The ļ¬rst three channels will be thresholded and interpreted as trigger channels. The composite digital trigger channel will be composed in the same way as in the

mne_kit2ļ¬ff utility, see Section 9.2.7, above. In addition, the fourth

channel will be assigned as an EOG channel. This option is nor-

mally used by the mne_eximia2scipt, see Section 9.2.11.

--split <size/MB>

Split the output data into several ļ¬les which are no more than

<size> MB. By default, the output is split into ļ¬les which are just below 2 GB so that the ļ¬f ļ¬le maximum size is not exceeded.

--out <ļ¬lename>

Speciļ¬es the name of the output ļ¬f format data ļ¬le. If <ļ¬lename> ends with .fif or _raw.fif, these endings are deleted. After these modiļ¬cations, _raw.fif is inserted after the remaining part of the ļ¬le name. If the ļ¬le is split into multiple parts, the additional parts will be called <name>-<number>_raw.fif.

9.2.11 Converting eXimia EEG data

EEG data from the Nexstim eXimia system can be converted to the ļ¬f format with help of the mne_eximia2ļ¬ff script. It creates a BrainVision vhdr ļ¬le and calls mne_brain_vision2ļ¬ff. Usage: mne_eximia2fiff

[--orignames] ļ¬le1 ļ¬le2 ...

where ļ¬le1 ļ¬le2... are eXimia nxe ļ¬les and the --orignames option is passed on to mne_brain_vision2ļ¬ff. If you want to convert all data ļ¬les in a directory, say mne_eximia2fiff *.nxe

Note: This script converts raw data ļ¬les only.

217

9

Data conversion

9.3 Converting digitization data

The mne_convert_dig_data utility converts Polhemus digitization data between different ļ¬le formats. The input formats are:

ļ¬f hpts elp

The standard format used in MNE. The digitization data are typically present in the measurement ļ¬les.

A text format which is a translation of the ļ¬f format data, see

Section 9.3.1 below.

A text format produced by the Source Signal Imaging, Inc. software. For description of this “probe” format, see http:// www.sourcesignal.com/formats_probe.html.

The data can be output in ļ¬f and hpts formats. Only the last command-line option specifying an input ļ¬le will be honored. Zero or more output ļ¬le options can be present on the command line.

Important: The elp and hpts input ļ¬les may contain textual EEG electrode labels. They will not be copied to the ļ¬f format output.

The command-line options of mne_convert_dig_data are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--ļ¬f <name>

Speciļ¬es the name of an input ļ¬f ļ¬le.

--hpts <name>

Speciļ¬es the name of an input hpts ļ¬le.

--elp <name>

Speciļ¬es the name of an input elp ļ¬le.

--ļ¬fout <name>

Speciļ¬es the name of an output ļ¬f ļ¬le.

--hptsout <name>

Speciļ¬es the name of an output hpts ļ¬le.

9.3.1 The hpts format

The hpts format digitzer data ļ¬le may contain comment lines starting with the pound sign (#) and data lines of the form:

218 MSH-MNE

MSH-MNE

<category> <identiļ¬er> <x/mm> <y/mm> <z/mm>

Data conversion

9

where

<category>

deļ¬nes the type of points. Allowed categories are: hpi, cardinal

(ļ¬ducial), eeg, and extra corresponding to head-position indicator coil locations, cardinal landmarks, EEG electrode locations, and additional head surface points, respectively. Note that tkmedit does not recognize the ļ¬ducial as an alias for cardinal.

<identiļ¬er>

identiļ¬es the point. The identiļ¬ers are usually sequential numbers.

For cardinal landmarks, 1 = left auricular point, 2 = nasion, and 3 = right auricular point. For EEG electrodes, identiļ¬er = 0 signiļ¬es the reference electrode. Some programs (not tkmedit) accept electrode labels as identiļ¬ers in the eeg category.

<x/mm>, <y/mm>, <z/mm>

Location of the point, usually in the MEG head coordinate system,

see Section 5.3. Some programs have options to accept coordinates

in meters instead of millimeters. With --meters option,

mne_transform_points lists the coordinates in meters.

9.4 Converting volumetric data into an MRI overlay

With help of the mne_volume_source_space utility (Section 5.5) it is pos-

sible to create a source space which is deļ¬ned within a volume rather than a surface. If the --mri option was used in mne_volume_source_space, the source space ļ¬le contains an interpolator matrix which performs a trilinear interpolation into the voxel space of the MRI volume speciļ¬ed.

At present, the MNE software does not include facilities to compute volumetric source estimates. However, it is possible to calculate forward solutions in the volumetric grid and use the MNE Matlab toolbox to read the forward solution. It is then possible to compute, e.g., volumetric beamformer solutions in Matlab and output the results into w or stc ļ¬les. The purpose of the mne_volume_data2mri is to produce MRI overlay data compatible with FreeSurfer MRI viewers (in the mgh or mgz formats) from this type of w or stc ļ¬les.

mne_volume_data2mri accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

219

9

Data conversion

--src <ļ¬lename>

The name of the volumetric source space ļ¬le created with

mne_volume_source_space. The source space must have been created with the --mri option, which adds the appropriate sparse trilinear interpolator matrix to the source space.

--w <ļ¬lename>

The name of a w ļ¬le to convert into an MRI overlay.

--stc <ļ¬lename>

The name of the stc ļ¬le to convert into an MRI overlay. If this ļ¬le has many time frames, the output ļ¬le may be huge. Note: If both -w and --stc are speciļ¬ed, -w takes precedence.

--scale <number>

Multiply the stc or w by this scaling constant before producing the overlay.

--out <ļ¬lename>

Speciļ¬es the name of the output MRI overlay ļ¬le. The name must end with either .mgh or .mgz identifying the uncompressed and compressed FreeSurfer MRI formats, respectively.

220

9.5 Listing source space data

The utility mne_list_source_space outputs the source space information into text ļ¬les suitable for loading into the Neuromag MRIlab software.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--src <name>

The source space to be listed. This can be either the output from mne_make_source_space (*-src.ļ¬f), output from the forward calculation (*-fwd.ļ¬f), or the output from the inverse operator decomposition (*-inv.ļ¬f).

--mri <name>

A ļ¬le containing the transformation between the head and MRI coordinates is speciļ¬ed with this option. This ļ¬le can be either a

Neuromag MRI description ļ¬le, the output from the forward calculation (*-fwd.ļ¬f), or the output from the inverse operator decomposition (*-inv.ļ¬f). If this ļ¬le is included, the output will be in head

MSH-MNE

MSH-MNE

Data conversion

9

coordinates. Otherwise the source space will be listed in MRI coordinates.

--dip <name>

Speciļ¬es the ‘stem’ for the Neuromag text format dipole ļ¬les to be output. Two ļ¬les will be produced: <stem>-lh.dip and <stem>rh.dip. These correspond to the left and right hemisphere part of the source space, respectively. This source space data can be imported to MRIlab through the File/Import/Dipoles menu item.

--pnt <name>

Speciļ¬es the ‘stem’ for Neuromag text format point ļ¬les to be output. Two ļ¬les will be produced: <stem>-lh.pnt and <stem>-rh.pnt.

These correspond to the left and right hemisphere part of the source space, respectively. This source space data can be imported to

MRIlab through the File/Import/Strings menu item.

--exclude <name>

Exclude the source space points deļ¬ned by the given FreeSurfer

‘label’ ļ¬le from the output. The name of the ļ¬le should end with lh.label

if it refers to the left hemisphere and with -rh.label

if it lists points in the right hemisphere, respectively.

--include <name>

Include only the source space points deļ¬ned by the given FreeSurfer

‘label’ ļ¬le to the output. The ļ¬le naming convention is the same as described above under the --exclude option. Are ‘include’ labels are processed before the ‘exclude’ labels.

--all

Include all nodes in the output ļ¬les instead of only those active in the source space. Note that the output ļ¬les will be huge if this option is active.

9.6 Listing BEM mesh data

The utility mne_list_bem outputs the BEM meshes in text format. The default output data contains the x, y, and z coordinates of the vertices, listed in millimeters, one vertex per line.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

221

9

Data conversion

--bem <name>

The BEM ļ¬le to be listed. The ļ¬le name normally ends with -bem.ļ¬f or -bem-sol.ļ¬f.

--out <name>

The output ļ¬le name.

--id <number>

Identify the surface to be listed. The surfaces are numbered starting with the innermost surface. Thus, for a three-layer model the surface numbers are: 4 = scalp, 3 = outer skull, 1 = inner skull

Default value is 4.

--gdipoli

List the surfaces in the format required by Thom Oostendorp’s gdipoli program. This is also the default input format for

mne_surf2bem.

--meters

List the surface coordinates in meters instead of millimeters.

--surf

Write the output in the binary FreeSurfer format.

--xļ¬t

Write a ļ¬le compatible with xļ¬t. This is the same effect as using the options --gdipoli and --meters together.

9.7 Converting surface data between different formats

The utility mne_convert_surface converts surface data ļ¬les between different formats.

Important: The MNE Matlab toolbox functions enable reading of Free-

Surfer surface ļ¬les directly. Therefore, the --mat option has been removed. The dfs ļ¬le format conversion functionality has been moved here from mne_convert_dfs. Consequently, mne_convert_dfs has been removed from MNE software.

9.7.1 command-line options

mne_convert_surface accepts the following command-line options:

--version

Show the program version and compilation date.

222 MSH-MNE

MSH-MNE

Data conversion

9

--help

List the command-line options.

--ļ¬f <name>

Speciļ¬es a ļ¬f format input ļ¬le. The ļ¬rst surface (source space) from this ļ¬le will be read.

--tri <name>

Speciļ¬es a text format input ļ¬le. The format of this ļ¬le is described

in Section 5.6.3.

--meters

The unit of measure for the vertex locations in a text input ļ¬les is meters instead of the default millimeters. This option does not have any effect on the interpretation of the FreeSurfer surface ļ¬les speciļ¬ed with the --surf option.

--swap

Swap the ordering or the triangle vertices. The standard convention in the MNE software is to have the vertices in text format ļ¬les ordered so that the vector cross product of the vectors from vertex 1 to 2 and 1 to 3 gives the direction of the outward surface normal.

This is also called the counterclockwise ordering. If your text input ļ¬le does not comply with this right-hand rule, use the --swap option. This option does not have any effect on the interpretation of the FreeSurfer surface ļ¬les speciļ¬ed with the --surf option.

--surf <name>

Speciļ¬es a FreeSurfer format input ļ¬le.

--dfs <name>

Speciļ¬es the name of a dfs ļ¬le to be converted. The surfaces produced by BrainSuite are in the dfs format.

--mghmri <name>

Speciļ¬es a mgh/mgz format MRI data ļ¬le which will be used to deļ¬ne the coordinate transformation to be applied to the data read from a dfs ļ¬le to bring it to the FreeSurfer MRI coordinates, i.e., the coordinate system of the MRI stack in the ļ¬le.

--ļ¬fmri <name>

Speciļ¬es a ļ¬f format MRI destription ļ¬le which will be used to deļ¬ne the coordinate transformation to be applied to the data read from a dfs ļ¬le to bring it to the same coordinate system as the MRI stack in the ļ¬le.

--trans <name>

Speciļ¬es the name of a text ļ¬le which contains the coordinate transformation to be applied to the data read from the dfs ļ¬le to bring it to the MRI coordinates, see below. This option is rarely needed.

223

9

Data conversion

--ļ¬‚ip

By default, the dfs surface nodes are assumed to be in a right-anterior-superior (RAS) coordinate system with its origin at the left-posterior-inferior (LPI) corner of the MRI stack. Sometimes the dfs ļ¬le has left and right ļ¬‚ipped. This option reverses this ļ¬‚ip, i.e., assumes the surface coordinate system is left-anterior-superior (LAS) with its origin in the right-posterior-inferior (RPI) corner of the MRI stack.

--surfout <name>

Speciļ¬es a FreeSurfer format output ļ¬le.

--ļ¬fout <name>

Speciļ¬es a ļ¬f format output ļ¬le.

--triout <name>

Speciļ¬es an ASCII output ļ¬le that will contain the surface data in

the triangle ļ¬le format desribed in Section 5.6.3.

--pntout <name>

Speciļ¬es a ASCII output ļ¬le which will contain the vertex numbers only.

--metersout

With this option the ASCII output will list the vertex coordinates in meters instead of millimeters.

--swapout

Deļ¬nes the vertex ordering of ASCII triangle ļ¬les to be output. For details, see --swap option, above.

--smfout <name>

Speciļ¬es a smf (Simple Model Format) output ļ¬le. For details of this format, see http://people.scs.fsu.edu/~burkardt/data/smf.txt.

Note: Multiple output options can be speciļ¬ed to produce outputs in several different formats with a single invocation of mne_convert_surface.

The coordinate transformation ļ¬le speciļ¬ed with the --trans should contain a 4 x 4 coordinate transformation matrix:

T

=

R

11

R

12

R

13

x

0

R

13

R

13

R

13

y

0

R

13

R

13

R

13

z

0

0 0 0 1

224 MSH-MNE

MSH-MNE

Data conversion

9

deļ¬ned so that if the augmented location vectors in the dfs ļ¬le and MRI

T

coordinate systems are denoted by

r

MRI

=

x

MRI

y

MRI

z

MRI

1

T

r

, respectively, dfs

=

x

dfs

y

dfs

z

dfs

1

and

r

MRI

=

Tr

dfs

9.8 Converting MRI data into the fif format

The utility mne_make_cor_set creates a ļ¬f format MRI description ļ¬le optionally including the MRI data using FreeSurfer MRI volume data as input. The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--dir <directory>

Speciļ¬es a directory containing the MRI volume in COR format.

Any previous --mgh options are cancelled when this option is encountered.

--withdata

Include the pixel data to the output ļ¬le. This option is implied with the --mgh option.

--mgh <name>

An MRI volume volume ļ¬le in mgh or mgz format. The --withdata

option is implied with this type of input. Furthermore, the transformation, the Talairach transformation

T

4

T

3

from the talairach.xfm ļ¬le referred to in the MRI volume, and the the ļ¬xed transforms

T

-

and

T

+

will added to the output ļ¬le. For deļ¬nition of the

coordinate transformations, see Section 5.2.

--out <name>

Speciļ¬es the output ļ¬le, which is a ļ¬f-format MRI description ļ¬le.

9.9 Collecting coordinate transformations into one file

The utility mne_collect_transforms collects coordinate transform information from various sources and saves them into a single ļ¬f ļ¬le. The coordinate transformations used by MNE software are summarized in

Figure 5.1. The output of mne_collect_transforms may include all trans-

forms referred to therein except for the sensor coordinate system transformations

T

s

1

T

s n

. The command-line options are:

225

9

Data conversion

--version

Show the program version and compilation date.

--help

List the command-line options.

--meas <name>

Speciļ¬es a measurement data ļ¬le which provides

T

1

. A forward solution or an inverse operator ļ¬le can also be speciļ¬ed as implied

by Table 5.1.

--mri <name>

Speciļ¬es an MRI description or a standalone coordinate transformation ļ¬le produced by mne_analyze which provides

T

2

. If the -mgh

option is not present mne_collect_transforms also tries to ļ¬nd

T

3

,

T

4

,

T

-

, and

T

+

from this ļ¬le.

--mgh <name>

An MRI volume volume ļ¬le in mgh or mgz format. This ļ¬le provides

T

3

. The transformation

T

4

will be read from the talairach.xfm ļ¬le referred to in the MRI volume. The ļ¬xed transforms

T

and

T

+ will be also created.

--out <name>

Speciļ¬es the output ļ¬le. If this option is not present, the collected transformations will be output on screen but not saved.

226

9.10 Converting an ncov covariance matrix file to fiff

The ncov ļ¬le format was used to store the noise-covariance matrix ļ¬le.

The MNE software requires that the covariance matrix ļ¬les are in ļ¬f format. The utility mne_convert_ncov converts ncov ļ¬les to ļ¬f format.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--ncov <name>

The ncov ļ¬le to be converted.

--meas <name>

A ļ¬f format measurement ļ¬le used to assign channel names to the noise-covariance matrix elements. This ļ¬le should have precisely the same channel order within MEG and EEG as the ncov ļ¬le. Typ-

MSH-MNE

MSH-MNE

Data conversion

9

ically, both the ncov ļ¬le and the measurement ļ¬le are created by the now mature off-line averager, meg_average.

9.11 Converting a lisp covariance matrix to fiff

The utility mne_convert_lspcov converts a LISP-format noise-covariance ļ¬le, produced by the Neuromag signal processor, graph into ļ¬f format.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--lspcov <name>

The LISP noise-covariance matrix ļ¬le to be converted.

--meas <name>

A ļ¬f format measurement ļ¬le used to assign channel names to the noise-covariance matrix elements. This ļ¬le should have precisely the same channel order within MEG and EEG as the LISP-format covariance matrix file.

--out <name>

The name of a ļ¬f format output ļ¬le. The ļ¬le name should end with cov.ļ¬f.text format output ļ¬le. No information about the channel names is included. The covariance matrix ļ¬le is listed row by row.

This ļ¬le can be loaded to MATLAB, for example

--outasc <name>

The name of a text format output ļ¬le. No information about the channel names is included. The covariance matrix ļ¬le is listed row by row. This ļ¬le can be loaded to MATLAB, for example

9.12 The MNE data file conversion tool

This utility, called mne_convert_mne_data, allows the conversion of various ļ¬f ļ¬les related to the MNE computations to other formats. The two principal purposes of this utility are to facilitate development of new analysis approaches with Matlab and conversion of the forward model and noise covariance matrix data into evoked-response type ļ¬f ļ¬les, which can be accessed and displayed with the Neuromag source modelling software.

227

9

Data conversion

Important: Most of the functions of mne_convert_mne_data are now

covered by the MNE Matlab toolbox covered in Chapter 10. This toolbox

is recommended to avoid creating additional ļ¬les occupying disk space.

9.12.1 Command-line options

The command-line options recognize by mne_convert_mne_data are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--fwd <name>

Specity the name of the forward solution ļ¬le to be converted. Channels speciļ¬ed with the --bad option will be excluded from the ļ¬le.

--ļ¬xed

Convert the forward solution to the ļ¬xed-orientation mode before outputting the converted ļ¬le. With this option only the ļ¬eld patterns corresponding to a dipole aligned with the estimated cortex surface normal are output.

--surfsrc

When outputting a free-orientation forward model (three orthogonal dipole components present) rotate the dipole coordinate system at each source node so that the two tangential dipole components are output ļ¬rst, followed by the ļ¬eld corresponding to the dipole aligned with the estimated cortex surface normal. The orientation of the ļ¬rst two dipole components in the tangential plane is arbitrarily selected to create an orthogonal coordinate system.

--noiseonly

When creating a ‘measurement’ ļ¬f ļ¬le, do not output a forward model ļ¬le, just the noise-covariance matrix.

--senscov <name>

Speciļ¬es the ļ¬f ļ¬le containing a sensor covariance matrix to be included with the output. If no other input ļ¬les are speciļ¬ed only the covariance matrix is output

--srccov <name>

Speciļ¬es the ļ¬f ļ¬le containing the source covariance matrix to be included with the output. Only diagonal source covariance ļ¬les can be handled at the moment.

228 MSH-MNE

MSH-MNE

Data conversion

9

--bad <name>

Speciļ¬es the name of the ļ¬le containing the names of the channels to be omitted, one channel name per line. This does not affect the output of the inverse operator since the channels have been already selected when the ļ¬le was created.

--ļ¬f

Output the forward model and the noise-covariance matrix into

‘measurement’ ļ¬f ļ¬les. The forward model ļ¬les are tagged with

<modalities>-meas-fwd.fif and the noise-covariance matrix ļ¬les with <modalities>-meas-cov.fif. Here, modalities is meg

if MEG is included, -eeg if EEG is included, and -meg-eeg if both types of signals are present. The inclusion of modalities is controlled by the --meg and --eeg options.

--mat

Output the data into MATLAB mat ļ¬les. This is the default. The forward model ļ¬les are tagged with <modalities>-fwd.mat forward model and noise-covariance matrix output, with -inv.mat for inverse operator output, and with -inv-meas.mat for combined inverse operator and measurement data output, respectively. The meaning of <modalities> is the same as in the ļ¬f output, described above.

--tag <name>

By default, all variables in the matlab output ļ¬les start with MNE_.

This option allows to change this preļ¬x to <name>_.

--meg

Include MEG channels from the forward solution and noise-covariance matrix.

--eeg

Include EEG channels from the forward solution and noise-covariance matrix.

--inv <name>

Output the inverse operator data from the speciļ¬ed ļ¬le into a mat ļ¬le. The source and noise covariance matrices as well as active channels have been previously selected when the inverse operator was created with mne_inverse_operator. Thus the options --meg, -

-eeg

, --senscov, --srccov, --noiseonly, and --bad do not affect the output of the inverse operator.

--meas <name>

Speciļ¬es the ļ¬le containing measurement data to be output together with the inverse operator. The channels corresponding to the inverse operator are automatically selected from the ļ¬le if --inv. option is present. Otherwise, the channel selection given with --sel option will be taken into account.

229

9

Data conversion

--set <number>

Select the data set to be output from the measurement ļ¬le.

--bmin <value/ms>

Speciļ¬es the baseline minimum value setting for the measurement signal output.

--bmax <value/ms>

Speciļ¬es the baseline maximum value setting for the measurement signal output.

Note: The --tmin and --tmax options which existed in previous versions of mne_converted_mne_data have been removed. If output of measurement data is requested, the entire averaged epoch is now included.

230

9.12.2 Guide to combining options

The combination of options is quite complicated. The Table 9.1 should be

helpful to determine the combination of options appropriate for your needs.

Desired output

forward model

Format

ļ¬f

Required options

--fwd <name>

--out <name>

--meg and/or --eeg

--ļ¬f

Optional options

--bad <name>

--surfsrc forward model forward model and sensor covariance sensor covariance sensor covariance mat mat ļ¬f mat

--fwd <name>

--out <name>

--meg and/or --eeg

--fwd <name>

--out <name>

--senscov <name>

--meg and/or --eeg

--fwd <name>

--out <name>

--senscov <name>

--noiseonly

--ļ¬f

--meg and/or --eeg

--senscov <name>

--out <name

--bad <name>

--surfsrc

--bad <name>

--surfsrc

--bad <name>

--bad <name>

Table 9.1 Guide to combining mne_convert_mne_data options.

MSH-MNE

Data conversion

9

Desired output Format

evoked MEG/EEG data forward model mat inverse operator data evoked MEG/EEG data mat

Required options

Optional options

--bad <name> sensor covariance eigenvalues evoked MEG/EEG data inverse operator data text mat mat

--senscov <name>

--out <name

--eig

--meas <name>

--out <name

--meas <name>

--fwd <name>

--out <name>

--inv <name>

--out <name

--inv <name>

--meas <name>

--out <name

--sel <name>

--set <number>

--bad <name>

--set <number>

Table 9.1 Guide to combining mne_convert_mne_data options.

9.12.3 Matlab data structures

The Matlab output provided by mne_convert_mne_data is organized in

structures, listed in Table 9.2. The ļ¬elds occurring in these structures are listed in Table 9.3.

The symbols employed in variable size descriptions are:

nloc

Number of source locations

nsource

Number of sources. For ļ¬xed orientation sources nsource =

nchan ntime

nloc

whereas nsource = 3*nloc for free orientation sources

Number of measurement channels.

Number of time points in the measurement data.

Structure

<tag>_meas

<tag>_inv

Contents

Measured data

The inverse operator decomposition

The forward solution <tag>_fwd

Table 9.2 Matlab structures produced by mne_convert_mne_data. The

preļ¬x given with the --tag option is indicated <tag>, see Section 9.12.1.

Its default value is MNE.

MSH-MNE 231

9

Data conversion fwd

Variable

names ch_names ch_types ch_pos ch_lognos ch_units

Structure

<tag>_noise

Contents

A standalone noise-covariance matrix

Table 9.2 Matlab structures produced by mne_convert_mne_data. The preļ¬x given with the --tag option is indicated <tag>, see Section 9.12.1.

Its default value is MNE.

Size Description

nsource x nchan The forward solution, one source on each row.

For free orientation sources, the ļ¬elds of the three orthogonal dipoles for each location are listed consecutively. nchan (string) String array containing the names of the channels included nchan x 2 nchan x 3

The column lists the types of the channels (1 =

MEG, 2 = EEG). The second column lists the

coil types, see Tables 5.2 and 5.3. For EEG

electrodes, this value equals one.

The location information for each channel. The ļ¬rst three values specify the origin of the sensor coordinate system or the location of the electrode. For MEG channels, the following nine number specify the x, y, and z-direction unit vectors of the sensor coordinate system. For

EEG electrodes the ļ¬rst unit vector speciļ¬es the location of the reference electrode. If the reference is not speciļ¬ed this value is all zeroes. The remaining unit vectors are irrelevant for EEG electrodes.

nchan x 1 nchan x 2

Logical channel numbers as listed in the ļ¬ff ļ¬le

Units and unit multipliers as listed in the ļ¬f ļ¬le.

The unit of the data is listed in the ļ¬rst column

(T = 112, T/m = 201, V = 107). At present, the second column will be always zero, i.e., no unit multiplier.

Table 9.3 The ļ¬elds of Matlab structures.

232 MSH-MNE

ch_cals

Variable

sfreq lowpass highpass source_loc source_ori source_selection coord_frame mri_head_trans meg_head_trans noise_cov source_cov

Data conversion

9

Size

nchan x 2

1

1

1 nloc x 3 nsource x 3 nsource x 2 string

4 x 4

4 x 4 nchan x nchan nsource

Description

Even if the data comes from the conversion already calibrated, the original calibration factors are included. The ļ¬rst column is the range member of the ļ¬f data structures and while the second is the cal member. To get calibrated values in the units given in ch_units from the raw data, the data must be multiplied with the product of range and cal.

The sampling frequency in Hz.

Lowpass ļ¬lter frequency (Hz)

Highpass ļ¬lter frequency (Hz)

The source locations given in the coordinate frame indicated by the coord_frame member.

The source orientations

Indication of the sources selected from the complete source spaces. Each row contains the number of the source in the complete source space (starting with 0) and the source space number (1 or 2). These numbers refer to the order the two hemispheres where listed when

mne_make_source_space was invoked.

mne_setup_source_space lists the left hemisphere ļ¬rst.

Name of the coordinate frame employed in the forward calculations. Possible values are ‘head’ and ‘mri’.

The coordinate frame transformation from mri the MEG ‘head’ coordinates.

The coordinate frame transformation from the

MEG device coordinates to the MEG head coordinates

The noise covariance matrix

The elements of the diagonal source covariance matrix.

Table 9.3 The ļ¬elds of Matlab structures.

MSH-MNE 233

9

Data conversion

Variable

sing eigen_ļ¬elds eigen_leads noise_eigenval noise_eigenvec data times nave meas_times

Size Description

nchan nchan x nchan nchan x nsource The rows of this matrix are the right singular vectors of

A

, i.e., the columns of

V

, see above.

nchan nchan

In terms of Section 6.2.3, eigenvalues of

C

0

, i.e., not scaled with number of averages.

Eigenvectors of the noise covariance matrix. In

T

terms of Section 6.2.3,

U

C

.

nchan x ntime ntime

1 ntime

The singular values of

A

=

C

1 2

0

GR

C

=

U

ΛV

T

with

R

selected so that trace AA

T

)

⁄ trace I

Section 6.2.3

= 1 as discussed in

The rows of this matrix are the left singular vectors of

A

, i.e., the columns of

U

, see above.

The measured data. One row contains the data at one time point.

The time points in the above matrix in seconds

Number of averages as listed in the data ļ¬le.

The time points in seconds.

Table 9.3 The ļ¬elds of Matlab structures.

9.13 Converting raw data to Matlab format

The utility mne_raw2mat converts all or selected channels from a raw data ļ¬le to a Matlab mat ļ¬le. In addition, this utility can provide information about the raw data ļ¬le so that the raw data can be read directly from the original ļ¬f ļ¬le using Matlab ļ¬le I/O routines.

Tip: The MNE Matlab toolbox described in Chapter 10 provides direct

access to raw ļ¬f ļ¬les without a need for conversion to mat ļ¬le format ļ¬rst.

Therefore, it is recommended that you use the Matlab toolbox rather than

mne_raw2mat which creates large ļ¬les occupying disk space unnecessarily.

9.13.1 Command-line options

mne_raw2mat accepts the following command-line options:

234 MSH-MNE

Data conversion

9

--version

Show the program version and compilation date.

--help

List the command-line options.

--raw <name>

Speciļ¬es the name of the raw data ļ¬f ļ¬le to convert.

--mat <name>

Speciļ¬es the name of the destination Matlab ļ¬le.

--info

With this option present, only information about the raw data ļ¬le is included. The raw data itself is omitted.

--sel <name>

Speciļ¬es a text ļ¬le which contains the names of the channels to include in the output ļ¬le, one channel name per line. If the --info option is speciļ¬ed, --sel does not have any effect.

--tag <tag>

By default, all Matlab variables included in the output ļ¬le start with

MNE_. This option changes the preļ¬x to <tag>_.

nchan

9.13.2 Matlab data structures

The Matlab ļ¬les output by mne_raw2mat can contain two data structures,

<tag>_raw and <tag>_raw_info. If --info option is specifed, the ļ¬le contains the latter structure only.

The <tag>_raw stucture contains only one ļ¬eld, data which is a matrix containing the raw data. Each row of this matrix constitutes the data from one channel in the original ļ¬le. The data type of this matrix is the same of the original data (2-byte signed integer, 4-byte signed integer, or singleprecision ļ¬‚oat).

The ļ¬elds of the <tag>_raw_info structure are listed in Table 9.4. Further explanation of the bufs ļ¬eld is provided in Table 9.5.

Variable

orig_ļ¬le string

Size Description

The name of the original ļ¬f ļ¬le speciļ¬ed with the --raw option.

Number of channels.

1

Table 9.4 The ļ¬elds of the raw data info structure.

MSH-MNE 235

9

Data conversion nsamp bufs

Variable

sfreq lowpass highpass ch_names ch_types ch_lognos ch_units ch_pos ch_cals

1

Size

nbuf x 4

1

1

1 nchan (string) nchan x 2 nchan x 1 nchan x 2 nchan x 12 nchan x 2

Description

Total number of samples

This ļ¬eld is present if --info option was speciļ¬ed on the command line. For details, see

Table 9.5.

The sampling frequency in Hz.

Lowpass ļ¬lter frequency (Hz)

Highpass ļ¬lter frequency (Hz)

String array containing the names of the channels included

The column lists the types of the channesl (1 =

MEG, 2 = EEG). The second column lists the

coil types, see Tables 5.2 and 5.3. For EEG

electrodes, this value equals one.

Logical channel numbers as listed in the ļ¬ff ļ¬le

Units and unit multipliers as listed in the ļ¬f ļ¬le.

The unit of the data is listed in the ļ¬rst column

(T = 112, T/m = 201, V = 107). At present, the second column will be always zero, i.e., no unit multiplier.

The location information for each channel. The ļ¬rst three values specify the origin of the sensor coordinate system or the location of the electrode. For MEG channels, the following nine number specify the x, y, and z-direction unit vectors of the sensor coordinate system. For

EEG electrodes the ļ¬rst vector after the electrode location speciļ¬es the location of the reference electrode. If the reference is not speciļ¬ed this value is all zeroes. The remaining unit vectors are irrelevant for EEG electrodes.

The raw data output by mne_raw2mat is uncalibrated. The ļ¬rst column is the range member of the ļ¬ff data structures and while the second is the cal member. To get calibrared data values in the units given in ch_units from the raw data, the data must be multiplied with the product of

range and cal.

Table 9.4 The ļ¬elds of the raw data info structure.

236 MSH-MNE

Variable

meg_head_trans

Data conversion

9

4 x 4

Size Description

The coordinate frame transformation from the

MEG device coordinates to the MEG head coordinates.

Table 9.4 The ļ¬elds of the raw data info structure.

2

3

1

Column

4

Contents

The raw data type (2 or 16 = 2-byte signed integer, 3 = 4byte signed integer, 4 = single-precision ļ¬‚oat). All data in the ļ¬f ļ¬le are written in the big-endian byte order. The raw data are stored sample by sample.

Byte location of this buffer in the original ļ¬f ļ¬le.

First sample of this buffer. Since raw data storing can be switched on and off during the acquisition, there might be gaps between the end of one buffer and the beginning of the next.

Number of samples in the buffer.

Table 9.5 The bufs member of the raw data info structure.

MSH-MNE

9.14 Converting epochs to Matlab format

The utility mne_epochs2mat converts epoch data including all or selected channels from a raw data ļ¬le to a simple binary ļ¬le with an associated description ļ¬le in Matlab mat ļ¬le format. With help of the description ļ¬le, a matlab program can easily read the epoch data from the simple binary ļ¬le. Signal space projection and bandpass ļ¬ltering can be optionally applied to the raw data prior to saving the epochs.

Important: The MNE Matlab toolbox described in Chapter 10 provides

direct access to raw ļ¬f ļ¬les without conversion with mne_epochs2mat ļ¬rst. Therefore, it is recommended that you use the Matlab toolbox rather than mne_epochs2mat which creates large ļ¬les occupying disk space unnecessarily. An exception to this is the case where you apply a ļ¬lter to the data and save the band-pass ļ¬ltered epochs.

9.14.1 Command-line options

mne_epochs2mat accepts the following command-line options are:

--version

Show the program version and compilation date.

237

9

Data conversion

--help

List the command-line options.

--raw <name>

Speciļ¬es the name of the raw data ļ¬f ļ¬le to use as input.

--mat <name>

Speciļ¬es the name of the destination ļ¬le. Anything following the last period in the ļ¬le name will be removed before composing the output ļ¬le name. The binary epoch ļ¬le will be called <trimmed

name>.epochs

and the corresponding Matlab description ļ¬le will be <trimmed name>_desc.mat.

--tag <tag>

By default, all Matlab variables included in the description ļ¬le start with MNE_. This option changes the preļ¬x to <tag>_.

--events <name>

The ļ¬le containing the event deļ¬nitions. This can be a text or ļ¬f format ļ¬le produced by mne_process_raw or mne_browse_raw, see

Section 4.10.5. With help of this ļ¬le it is possible to select virtually

any data segment from the raw data ļ¬le. If this option is missing, the digital trigger channel in the raw data ļ¬le or a ļ¬f format event ļ¬le produced automatically by mne_process_raw or mne_browse_raw is consulted for event information.

--event <name>

Event number identifying the epochs of interest.

--tmin <time/ms>

The starting point of the epoch with respect to the event of interest.

--tmax <time/ms>

The endpoint of the epoch with respect to the event of interest.

--sel <name>

Speciļ¬es a text ļ¬le which contains the names of the channels to include in the output ļ¬le, one channel name per line. If the --inv option is speciļ¬ed, --sel is ignored. If neither --inv nor --sel is present, all MEG and EEG channels are included. The digital trigger channel can be included with the --includetrig option, described below.

--inv <name>

Speciļ¬es an inverse operator, which will be employed in two ways.

First, the channels included to output will be those included in the inverse operator. Second, any signal-space projection operator present in the inverse operator ļ¬le will be applied to the data. This option cancels the effect of --sel and --proj options.

238 MSH-MNE

MSH-MNE

Data conversion

9

--digtrig <name>

Name of the composite digital trigger channel. The default value is

‘STI 014’. Underscores in the channel name will be replaced by spaces.

--digtrigmask <number>

Mask to be applied to the trigger channel values before considering them. This option is useful if one wants to set some bits in a don’t care state. For example, some ļ¬nger response pads keep the trigger lines high if not in use, i.e., a ļ¬nger is not in place. Yet, it is convenient to keep these devices permanently connected to the acquisition system. The number can be given in decimal or hexadecimal format

(beginning with 0x or 0X). For example, the value 255 (0xFF) means that only the lowest order byte (usually trigger lines 1 - 8 or bits 0 - 7) will be considered.

--includetrig

Add the digital trigger channel to the list of channels to output. This option should not be used if the trigger channel is already included in the selection speciļ¬ed with the --sel option.

--ļ¬ltersize <size>

Adjust the length of the FFT to be applied in ļ¬ltering. The number corresponding length of time is

s

, where

f s

is the sampling frequency of your data. The ļ¬ltering procedure includes overlapping tapers of length

2N

so that the total FFT length will actually be

. The default value is 4096.

--highpass <value/Hz>

Highpass ļ¬lter frequency limit. If this is too low with respect to the selected FFT length and data ļ¬le sampling frequency, the data will not be highpass ļ¬ltered. You can experiment with the interactive version to ļ¬nd the lowest applicable ļ¬lter for your data. This value can be adjusted in the interactive version of the program. The default is 0, i.e., no highpass ļ¬lter in effect.

--highpassw <value/Hz>

The width of the transition band of the highpass ļ¬lter. The default is

6 frequency bins, where one bin is

f s

⁄ (

2N

)

.

--lowpass <value/Hz>

Lowpass ļ¬lter frequency limit. This value can be adjusted in the interactive version of the program. The default is 40 Hz.

--lowpassw <value/Hz>

The width of the transition band of the lowpass ļ¬lter. This value can be adjusted in the interactive version of the program. The default is

5 Hz.

239

9

Data conversion

--ļ¬lteroff

Do not ļ¬lter the data.

--proj <name>

Include signal-space projection (SSP) information from this ļ¬le. If the --inv option is present, --proj has no effect.

Note: Baseline has not been subtracted from the epochs. This has to be done in subsequent processing with Matlab if so desired.

Note: Strictly speaking, trigger mask value zero would mean that all trigger inputs are ignored. However, for convenience, setting the mask to zero or not setting it at all has the same effect as 0xFFFFFFFF, i.e., all bits set.

Tip: The digital trigger channel can also be set with the

MNE_TRIGGER_CH_NAME environment variable. Underscores in the variable value will not be replaced with spaces by mne_browse_raw or

mne_process_raw. Using the --digtrig option supersedes the

MNE_TRIGGER_CH_NAME environment variable.

Tip: The digital trigger channel mask can also be set with the

MNE_TRIGGER_CH_MASK environment variable. Using the -digtrigmask

option supersedes the MNE_TRIGGER_CH_MASK environment variable.

9.14.2 The binary epoch data file

mne_epochs2mat saves the epoch data extracted from the raw data ļ¬le is a simple binary ļ¬le. The data are stored as big-endian single-precision ļ¬‚oat-

n

channels and

m

time points, the data

s jkl

ar e ordered as

s

111

s

1n1

s

211

s

mn1

s

mnp

, where the ļ¬rst index stands for the time point, the second for the channel, and the third for the epoch number, respectively. The data are not calibrated, i.e., the calibration factors present in the Matlab description ļ¬le have to be applied to get to physical units as described below.

Note: The maximum size of an epoch data ļ¬le is 2 Gbytes, i.e., 0.5 Gsamples.

9.14.3 Matlab data structures

The Matlab description ļ¬les output by mne_epochs2mat contain a data structure <tag>_epoch_info. The ļ¬elds of the this structure are listed in

240 MSH-MNE

Data conversion

9

Table 9.4. Further explanation of the epochs member is provided in

Table 9.7.

Variable

orig_ļ¬le epoch_ļ¬le nchan nepoch epochs sfreq lowpass highpass ch_names ch_types ch_lognos ch_units ch_pos

MSH-MNE string string

1

1

Size

nepoch x 5

1

1

1 nchan (string) nchan x 2 nchan x 1 nchan x 2 nchan x 12

Description

The name of the original ļ¬f ļ¬le speciļ¬ed with the --raw option.

The name of the epoch data ļ¬le produced by

mne_epocs2mat.

Number of channels.

Total number of epochs.

Description of the content of the epoch data

ļ¬le, see Table 9.7.

The sampling frequency in Hz.

Lowpass ļ¬lter frequency (Hz)

Highpass ļ¬lter frequency (Hz)

String array containing the names of the channels included

The column lists the types of the channels (1 =

MEG, 2 = EEG). The second column lists the

coil types, see Tables 5.2 and 5.3. For EEG

electrodes, this value equals one.

Logical channel numbers as listed in the ļ¬ff ļ¬le

Units and unit multipliers as listed in the ļ¬f ļ¬le.

The unit of the data is listed in the ļ¬rst column

(T = 112, T/m = 201, V = 107). At present, the second column will be always zero, i.e., no unit multiplier.

The location information for each channel. The ļ¬rst three values specify the origin of the sensor coordinate system or the location of the electrode. For MEG channels, the following nine number specify the x, y, and z-direction unit vectors of the sensor coordinate system. For

EEG electrodes the ļ¬rst vector after the electrode location speciļ¬es the location of the reference electrode. If the reference is not speciļ¬ed this value is all zeroes. The remaining unit vectors are irrelevant for EEG electrodes.

Table 9.6 The ļ¬elds of the raw data info structure.

241

9

Data conversion ch_cals

Variable

meg_head_trans

Size

nchan x 2

4 x 4

Description

The raw data output by mne_raw2mat are not calibrated. The ļ¬rst column is the range member of the ļ¬ff data structures and while the second is the cal member. To get calibrated data values in the units given in ch_units from the raw data, the data must be multiplied with the product of range and cal.

The coordinate frame transformation from the

MEG device coordinates to the MEG head coordinates.

Table 9.6 The ļ¬elds of the raw data info structure.

4

5

2

3

1

Column Contents

The raw data type (2 or 16 = 2-byte signed integer, 3 = 4byte signed integer, 4 = single-precision ļ¬‚oat). The epoch data are written using the big-endian byte order.

The data are stored sample by sample.

Byte location of this epoch in the binary epoch ļ¬le.

First sample of this epoch in the original raw data ļ¬le.

First sample of the epoch with respect to the event.

Number of samples in the epoch.

Table 9.7 The epochs member of the raw data info structure.

Tip: For source modelling purposes, it is recommended that the MNE

Matlab toolbox, see Chapter 10 is employed to read the measurement info

instead of using the channel information in the raw data info structure

described in Table 9.6.

242 MSH-MNE

10

C H A P T E R 1 0

The Matlab toolbox

10.1 Overview

The MNE software contains a collection Matlab m-ļ¬les to facilitate interfacing with binary ļ¬le formats of the MNE software. The toolbox is located at $MNE_ROOT/matlab/toolbox. The names of the MNE

Matlab toolbox functions begin either with mne_ or with ļ¬ff_.To gain access the MNE Matlab toolbox, proceed as follows:

1. Copy the ļ¬le

$MNE_ROOT/matlab/toolbox/mne_setup_toolbox.m

to a directory which is already on your Matlab search path, for example,

$HOME/matlab

,

2. Add the line mne_setup_toolbox to your $HOME/matlab/ startup.m

ļ¬le.

A summary of the available routines is provided in Tables 10.1 – 10.14.

The directory $MNE_ROOT/matlab/examples contains demonstra-

tions of the use of the library. These routines are listed in Table 10.14.

Important: The MNE Matlab Toolbox is compatible with Matlab versions 7.0 or later.

Important: The matlab function ļ¬ff_setup_read_raw has a signiļ¬cant change. The sample numbers now take into account possible initial skip in the ļ¬le, i.e., the time between the start of the data acquisition and the start of saving the data to disk. The ļ¬rst_samp member of the returned structure indicates the initial skip in samples. If you want your own routines, which assume that initial skip has been removed, perform identically with the previous version, subtract ļ¬rst_samp from the sample numbers you specify to ļ¬ff_read_raw_segment. Furthermore, ļ¬ff_setup_read_raw has an optional argument to allow reading of unprocessed MaxShield data acquired with the Elekta MEG systems.

Function

ļ¬ff_ļ¬nd_evoked

Purpose

Find all evoked data sets from a ļ¬le.

Table 10.1 High-level reading routines.

MSH-MNE 243

10

The Matlab toolbox

Function Purpose

ļ¬ff_read_bad_channels ļ¬ff_read_ctf_comp

Read the bad channel list.

Read CTF software gradient compensation data.

Read evoked-response data.

ļ¬ff_read_evoked ļ¬ff_read_evoked_all ļ¬ff_read_meas_info ļ¬ff_read_mri ļ¬ff_read_proj ļ¬ff_read_raw_segment

Read all evoked-response data from a ļ¬le.

Read measurement information.

Read an MRI description ļ¬le.

Read signal-space projection data.

Read a segment of raw data with time limits are speciļ¬ed in samples.

ļ¬ff_read_raw_segment_times Read a segment of raw data with time limits speciļ¬ed in seconds. ļ¬ff_setup_read_raw Set up data structures before using ļ¬ff_read_raw_segment or ļ¬ff_read_raw_segment_times

Table 10.1 High-level reading routines.

Function

ļ¬ff_pick_channels ļ¬ff_pick_channels_evoked ļ¬ff_pick_info ļ¬ff_pick_types ļ¬ff_pick_types_evoked

Purpose

Create a selector to pick desired channels from data according to include and exclude lists.

Pick desired channels from evoked-response data according to include and exclude lists

Modify measurement info to include only selected channels.

Create a selector to pick desired channels from data according to channel types (MEG, EEG, STIM) in combination with include and exclude lists.

Pick desired channels from evoked-response data according to channel types (MEG, EEG, STIM) in combination with include and exclude lists.

Table 10.2 Channel selection utilities.

244 MSH-MNE

The Matlab toolbox

10

Function

ļ¬ff_invert_transform ļ¬ff_reset_ch_pos ļ¬ff_transform_eeg_chs ļ¬ff_transform_meg_chs

Purpose

Invert a coordinate transformation structure.

Reset channel position transformation to the default values present in the ļ¬le.

Transform electrode positions to another coordinate frame.

Apply a coordinate transformation to the sensor location data to bring the integration points to another coordinate frame.

Table 10.3 Coordinate transformation utilities.

Function

ļ¬ff_deļ¬ne_constants ļ¬ff_dir_tree_ļ¬nd ļ¬ff_list_dir_tree ļ¬ff_make_dir_tree ļ¬ff_open ļ¬ff_read_named_matrix ļ¬ff_read_tag ļ¬ff_read_tag_info ļ¬ff_split_name_list

Purpose

Deļ¬ne a structure which contains the constant relevant to ļ¬f ļ¬les.

Find nodes of a given type in a directory tree structure.

List a directory tree structure.

Create a directory tree structure.

Open a ļ¬f ļ¬le and create the directory tree structure.

Read a named matrix from a ļ¬f ļ¬le.

Read one tag from a ļ¬f ļ¬le.

Read the info of one tag from a ļ¬f ļ¬le.

Split a colon-separated list of names into a cell array of strings.

Table 10.4 Basic reading routines.

Function

ļ¬ff_end_block ļ¬ff_end_ļ¬le ļ¬ff_start_block ļ¬ff_start_ļ¬le ļ¬ff_write_ch_info ļ¬ff_write_coord_trans

Purpose

Write a FIFF_END_BLOCK tag.

Write the standard closing.

Write a FIFF_START_BLOCK tag.

Write the appropriate beginning of a ļ¬le.

Write a channel information structure.

Write a coordinate transformation structure.

Table 10.5 Writing routines.

MSH-MNE 245

10

The Matlab toolbox

Function Purpose

ļ¬ff_write_ctf_comp ļ¬ff_write_dig_point ļ¬ff_write_complex ļ¬ff_write_complex_matrix

Write CTF compensation data.

Write one digitizer data point.

Write single-precision complex numbers.

Write a single-precision complex matrix.

ļ¬ff_write_double ļ¬ff_write_double_complex

Write double-precision ļ¬‚oats.

Write double-precision complex numbers.

ļ¬ff_write_double_complex_matrix Write a double-precision complex matrix ļ¬ff_write_double_matrix Write a double-precision matrix ļ¬ff_write_evoked ļ¬ff_write_ļ¬‚oat ļ¬ff_write_ļ¬‚oat_matrix ļ¬ff_write_id ļ¬ff_write_int ļ¬ff_write_name_list ļ¬ff_write_named_matrix ļ¬ff_write_proj ļ¬ff_write_short ļ¬ff_write_string

Write an evoked-reponse data ļ¬le.

Write single-precision ļ¬‚oats.

Write a single-precision matrix.

Write an id tag.

Write 32-bit integers.

Write a name list.

Write a named matrix.

Write SSP data.

Write 16-bit integers.

Write a string.

Table 10.5 Writing routines.

Function

ļ¬ff_write_evoked ļ¬ff_ļ¬nish_writing_raw ļ¬ff_start_writing_raw ļ¬ff_write_dig_ļ¬le ļ¬ff_write_raw_buffer

Purpose

Write an evoked-response data ļ¬le.

Write the closing tags to a raw data ļ¬le.

Start writing raw data ļ¬le, i.e., write the measurement information.

Write a ļ¬f ļ¬le containing digitization data.

Write one raw data buffer. This is used after a call to ļ¬ff_start_writing_raw.

Table 10.6 High-level data writing routines.

246 MSH-MNE

The Matlab toolbox

10

Function

mne_add_coil_defs mne_load_coil_def

Purpose

Add coil deļ¬nitions to an array of channel information structures.

Load a coil deļ¬nition ļ¬le.

Table 10.7 Coil deļ¬nition utilities.

Function

mne_compensate_to mne_get_current_comp mne_make_compensator mne_make_projector mne_make_projector_info mne_set_current_comp

Purpose

Apply or remove CTF software gradient compensation from evoked-response data.

Get the state of software gradient compensation from measurement info.

Make a compensation matrix which switches the status of CTF software gradient compensation from one state to another.

Create a signal-space projection operator with the projection item deļ¬nitions and cell arrays of channel names and bad channel names as input.

Like mne_make_projector but uses the measurement info structure as input.

Change the information about the compensation status in measurement info.

Table 10.8 Routines for software gradient compensation and signal-space projection.

Function

mne_pick_channels_cov mne_pick_channels_forward mne_read_bem_surfaces mne_read_cov mne_read_epoch mne_read_events mne_read_forward_solution mne_read_inverse_operator

Purpose

Pick desired channels from a sensor covariance matrix.

Pick desired channels (rows) from a forward solution.

Read triangular tessellations of surfaces for boundaryelement models

Read a covariance matrix.

Read an epoch of data from the output ļ¬le of

mne_epochs2mat.

Read an event list from a ļ¬f ļ¬le produced by

mne_browse_raw or mne_process_raw.

Read a forward solution from a ļ¬f ļ¬le.

Read an inverse operator from a ļ¬f ļ¬le.

Table 10.9 High-level routines for reading MNE data ļ¬les.

MSH-MNE 247

10

The Matlab toolbox

Function

mne_read_morph_map mne_read_noise_cov mne_read_source_spaces

Purpose

Read an morphing map produced with

mne_make_morph_maps, see Section 8.4.

Read a noise-covariance matrix from a ļ¬f ļ¬le.

Read source space information from a ļ¬f ļ¬le.

Table 10.9 High-level routines for reading MNE data ļ¬les.

Function

mne_write_cov mne_write_cov_ļ¬le mne_write_events mne_write_inverse_sol_stc mne_write_inverse_sol_w

Purpose

Write a covariance matrix to an open ļ¬le.

Write a complete ļ¬le containing just a covariance matrix.

Write a ļ¬f format event ļ¬le compatible with

mne_browse_raw and mne_process_raw.

Write stc ļ¬les containing an inverse solution or other dynamic data on the cortical surface.

Write w ļ¬les containing an inverse solution or other static data on the cortical surface

Table 10.10 High-level routines for writing MNE data ļ¬les.

Function

mne_read_stc_ļ¬le mne_read_w_ļ¬le mne_write_stc_ļ¬le mne_write_w_ļ¬le

Purpose

Read data from one stc ļ¬le.

Read data from one w ļ¬le.

Write a new stc ļ¬le.

Write a new w ļ¬le.

Table 10.11 Routines for reading stc and w ļ¬les.

Function

mne_read_curvature mne_read_surface mne_read_surfaces

Purpose

Read a curvature ļ¬le.

Read one surface, return the vertex locations and triangulation info.

Read surfaces corresponding to one or both hemispheres. Optionally read curvature information and add derived surface data.

Table 10.12 Routines for reading FreeSurfer surfaces.

248 MSH-MNE

The Matlab toolbox

10

Function

mne_reduce_surface

Purpose

Reduce the number of triangles on a surface using the reducepatch Matlab function.

Write a FreeSurfer surface ļ¬le.

mne_write_surface

Table 10.12 Routines for reading FreeSurfer surfaces.

Function Purpose

mne_block_diag mne_combine_xyz mne_ļ¬le_name mne_ļ¬nd_channel mne_ļ¬nd_source_space_hemi

Create a sparse block-diagonal matrix out of a vector.

Calculate the square sum of the three Cartesian components of several vectors listed in one row or column vector.

Compose a ļ¬le name relative to $MNE_ROOT

Find a channel by name from measurement info.

Determine whether a given source space belongs to the left or right hemisphere.

mne_fread3 mne_fwrite3 mne_make_combined_event_ļ¬le Combine data from several trigger channels into one event ļ¬le.

mne_omit_ļ¬rst_line Omit ļ¬rst line from a multi-line message. This routine is useful for formatting error messages.

mne_prepare_inverse_operator

Read a three-byte integer.

Write a three-byte integer.

mne_setup_toolbox mne_transform_coordinates

Prepare inverse operator data for calculating L2 minimum-norm solutions and dSPM.

Set up the MNE Matlab toolbox.

Transform locations between different coordinate systems. This function uses the output ļ¬le from

mne_collect_transforms described in Section 9.9 as

input.

mne_transpose_named_matrix Create a transpose of a named matrix.

mne_transform_source_space_to Transform source space data to another coordinate frame.

Table 10.13 Utility functions.

MSH-MNE 249

10

The Matlab toolbox

Function

mne_ex_average_epochs mne_ex_cancel_noise mne_ex_compute_inverse mne_ex_data_sets mne_ex_evoked_grad_amp mne_ex_read_epochs mne_ex_read_evoked mne_ex_read_raw mne_ex_read_write_raw

Purpose

Example of averaging epoch data produced by

mne_epochs2mat, see Section 9.14.

Example of noise cancellation procedures.

Example of computing a L2 minimum-norm estimate or a dSPM solution

Example of listing evoked-response data sets.

Compute tangential gradient amplitudes from planar gradiometer data.

Read epoch data from a raw data ļ¬le.

Example of reading evoked-response data.

Example of reading raw data.

Example of processing raw data (read and write).

Table 10.14 Examples demostrating the use of the toolbox.

Important: In order for the inverse operator calculation to work correctly with data processed with the Elekta-Neuromag Maxļ¬lter™ software, the so-called processing history block must be included in data ļ¬les. Previous versions of the MNE Matlab functions did not copy processing history to ļ¬les saved. As of March 30, 2009, the Matlab toolbox routines

ļ¬ff_start_writing_raw and ļ¬ff_write_evoked have been enchanced to include these data to the output ļ¬le as appropriate. If you have older raw data ļ¬les created in Matlab from input which has been processed Maxļ¬lter, it is necessary to copy the processing history block from the original to modiļ¬ed raw data ļ¬le using the mne_copy_processing_history utility

described in Section 11.4.8. The raw data processing programs

mne_browse_raw and mne_process_raw have handled copying of the processing history since revision 2.5 of the MNE software.

250

10.2 Some data structures

The MNE Matlab toolbox relies heavily on structures to organize the data.

This section gives detailed information about ļ¬elds in the essential data structures employed in the MNE Matlab toolbox. In the structure deļ¬nitions, data types referring to other MNE Matlab toolbox structures are

shown in italics. In addition, Table 10.15 lists the values of various FIFF

constants deļ¬ned by ļ¬ff_deļ¬ne_constants.m. The documented structures are:

tag

Contains one tag from the ļ¬f ļ¬le, see Table 10.16.

MSH-MNE

MSH-MNE

The Matlab toolbox

10 taginfo

Contains the information about one tag, see Table 10.17.

directory

Contains the tag directory as a tree structure, see Table 10.18.

id

A ļ¬f ID, see Table 10.19.

named matrix

Contains a matrix with names for rows and/or columns, see

Table 10.20. A named matrix is used to store, e.g., SSP vectors and

forward solutions.

trans

A 4 x 4 coordinate-transformation matrix operating on augmented column vectors. Indication of the coordinate frames to which this

transformation relates is included, see Table 10.21.

dig

A Polhemus digitizer data point, see Table 10.22.

coildef

The coil deļ¬nition structure useful for forward calculations and

array visualization, see Table 10.23. For more detailed information

on coil deļ¬nitions, see Section 5.8.

ch

Channel information structure, see Table 10.24.

proj

Signal-space projection data, see Table 10.25.

comp

Software gradiometer compensation data, see Table 10.26.

measurement info

Translation of the FIFFB_MEAS_INFO entity, see Table 10.27.

This data structure is returned by ļ¬ff_read_meas_info.

surf

Used to represent triangulated surfaces and cortical source spaces,

Table 10.28.

cov

Used for storing covariance matrices, Table 10.29.

fwd

Forward solution data returned by mne_read_forward_solution, see

Table 10.30.

251

10

The Matlab toolbox

inv

Inverse operator decomposition data returned by

mne_read_inverse_operator, see Table 10.31. For more information

on inverse operator decomposition, see Section 6.2. For an example

on how to compute inverse solution using this data, see the sample routine mne_ex_compute_inverse

FIFFV_MEG_CH

Name

FIFFV_REF_MEG_CH

FIFFV_EEF_CH

FIFFV_MCG_CH

FIFFV_STIM_CH

FIFFV_EOG_CH

FIFFV_EMG_CH

FIFFV_ECG_CH

FIFFV_MISC_CH

FIFFV_RESP_CH

FIFFV_COORD_UNKNOWN

FIFFV_COORD_ISOTRAK

FIFFV_COORD_ISOTRAK

FIFFV_COORD_HPI

FIFFV_COORD_HEAD

FIFFV_COORD_MRI

FIFFV_COORD_MRI_SLICE

FIFFV_COORD_MRI_DISPLAY

FIFFV_COORD_DICOM_DEVICE

5

6

0

1

2

302

402

502

602

2

201

3

202

Value

1

301

3

4

7

8

Description

This is a MEG channel.

This a reference MEG channel, located far away from the head.

This is an EEG channel.

This a MCG channel.

This is a digital trigger channel.

This is an EOG channel.

This is an EMG channel.

This is an ECG channel.

This is a miscellaneous analog channel.

This channel contains respiration monitor output.

Unknown coordinate frame

The MEG device coordinate frame

The Polhemus digitizer coordinate frame (does not appear in data ļ¬les).

HPI coil coordinate frame (does not appear in data ļ¬les)

The MEG head coordinate frame (Neuromag convention).

The MRI coordinate frame

The coordinate frame of a single MRI slice.

The preferred coordinate frame for displaying the MRIs (used by MRIlab).

The DICOM coordinate frame (does not appear in ļ¬les).

Table 10.15 FIFF constants.

252 MSH-MNE

The Matlab toolbox

10

Name

FIFFV_COORD_IMAGING_DEVICE

FIFFV_MNE_COORD_TUFTS_EEG

FIFFV_MNE_COORD_CTF_DEVICE

FIFFV_MNE_COORD_CTF_HEAD

FIFFV_ASPECT_AVERAGE

FIFFV_ASPECT_STD_ERR

FIFFV_ASPECT_SINGLE

FIFFV_ASPECT_SUBAVERAGE

FIFFV_ASPECT_ALTAVERAGE

FIFFV_ASPECT_SAMPLE

FIFFV_ASPECT_POWER_DENSITY

FIFFV_ASPECT_DIPOLE_WAVE

FIFFV_BEM_SURF_ID_UNKNOWN

FIFFV_BEM_SURF_ID_BRAIN

FIFFV_BEM_SURF_ID_SKULL

FIFFV_BEM_SURF_ID_HEAD

FIFFV_MNE_SURF_LEFT_HEMI

FIFFV_MNE_SURF_RIGHT_HEMI

FIFFV_POINT_CARDINAL

FIFFV_POINT_HPI

FIFFV_POINT_EEG

FIFFV_POINT_ECG

FIFFV_POINT_EXTRA

FIFFV_POINT_LPA

FIFFV_POINT_NASION

FIFFV_POINT_RPA

Value Description

1

2

3

3

4

2

3

3

4

-1

1

101

102

1

9 A generic imaging device coordinate frame (does not appear in ļ¬les).

The Tufts EEG data coordinate frame 300

1001 The CTF device coordinate frame

(does not appear in ļ¬les)

1004 The CTF/4D head coordinate frame

100 Data aspect: average.

101

102

Data aspect: standard error of mean.

Single epoch.

103

104

One subaverage.

One alternating (plus-minus) subaverage.

105

106

200

A sample cut from raw data.

Power density spectrum.

The time course of an equivalent current dipole

Unknown BEM surface

The inner skull surface

The outer skull surface

The scalp surface

Left hemisphere cortical surface

Right hemisphere cortical surface

Digitization point which is a cardinal landmark aka. ļ¬ducial point

Digitized HPI coil location

Digitized EEG electrode location

Digitized ECG electrode location

Additional head surface point

Identiļ¬er for left auricular landmark

Identiļ¬er for nasion

Identiļ¬er for right auricular landmark

Table 10.15 FIFF constants.

MSH-MNE 253

10

The Matlab toolbox

Name

FIFFV_MNE_FIXED_ORI

FIFFV_MNE_FREE_ORI

FIFFV_MNE_MEG

FIFFV_MNE_EEG

FIFFV_MNE_MEG_EEG

FIFFV_MNE_UNKNOWN_COV

FIFFV_MNE_NOISE_COV

FIFFV_MNE_SENSOR_COV

FIFFV_MNE_SOURCE_COV

FIFFV_MNE_FMRI_PRIOR_COV

FIFFV_MNE_SIGNAL_COV

FIFFV_MNE_DEPTH_PRIOR_COV

FIFFV_MNE_ORIENT_PRIOR_COV

FIFFV_PROJ_ITEM_NONE

FIFFV_PROJ_ITEM_FIELD

FIFFV_PROJ_ITEM_DIP_FIX

FIFFV_PROJ_ITEM_DIP_ROT

FIFFV_PROJ_ITEM_HOMOG_GRAD

Value

1

2

1

2

3

0

1

1

2

3

4

5

6

0

1

2

3

4

Description

Fixed orientation constraint used in the computation of a forward solution.

No orientation constraint used in the computation of a forward solution

Indicates an inverse operator based on

MEG only

Indicates an inverse operator based on

EEG only.

Indicates an inverse operator based on both MEG and EEG.

An unknown covariance matrix

Indicates a noise covariance matrix.

Synonym for

FIFFV_MNE_NOISE_COV

Indicates a source covariance matrix

Indicates a covariance matrix associated with fMRI priors

Indicates the data (signal + noise) covariance matrix

Indicates the depth prior (depth weighting) covariance matrix

Indicates the orientation (loose orientation constrain) prior covariance matrix

The nature of this projection item is unknown

This is projection item is a generic ļ¬eld pattern or ļ¬eld patters.

This projection item is the ļ¬eld of one dipole

This projection item corresponds to the ļ¬elds of three or two orthogonal dipoles at some location.

This projection item contains the homogeneous gradient ļ¬elds as seen by the sensor array.

Table 10.15 FIFF constants.

254 MSH-MNE

The Matlab toolbox

10

Name

FIFFV_PROJ_ITEM_HOMOG_FIELD

FIFFV_MNE_PROJ_ITEM_EEG_AVREF

Value

5

10

Description

This projection item contains the three homogeneous ļ¬eld components as seen by the sensor array.

This projection item corresponds to the average EEG reference.

Table 10.15 FIFF constants.

Field

kind type size next data

Data type

int32 uint32 int32 int32 various

Description

The kind of the data item.

The data type used to represent the data.

Size of the data in bytes.

Byte offset of the next tag in the ļ¬le.

The data itself.

Table 10.16 The tag structure.

MSH-MNE 255

10

The Matlab toolbox

Field

version machid secs usecs to trans

Data type

int32 int32(2) int32 int32

Description

The ļ¬f ļ¬le version (major << 16 | minor).

Unique identiļ¬er of the computer this id was created on.

Time since January 1, 1970 (seconds).

Time since January 1, 1970 (microseconds past secs).

Table 10.19 The id structure.

Field Data type

nrow ncol int32 int32 row_names cell(*) col_names data cell(*) various

Description

Number of rows.

Number of columns.

The names of associated with the rows. This member may be empty.

The names of associated with the columns. This member may be empty.

The matrix data, usually of type single or double.

Table 10.20 The named matrix structure.

Field

from

Data type Description

int32 The source coordinate frame, see

Table 10.15. Look for entries starting

with FIFFV_COORD or

FIFFV_MNE_COORD.

The destination coordinate frame.

int32 double(4,4) The 4-by-4 coordinate transformation matrix. This operates from augmented position column vectors given in from coordinates to give results in to coordinates.

Table 10.21 The trans structure.

256 MSH-MNE

The Matlab toolbox

10

r

Field

kind ident

Field

class id accuracy num_points size baseline description coildefs

FV

Data type Description

double double double double

The coil (or electrode) class

The coil (or electrode) id

Representation accuracy

Number of integration points.

double double

Coil size

Coil baseline char(*) struct

Coil description double(num_points,7) Each row contains the integration point weight, followed by location [m] and normal

Contains the faces and vertices which can be used to draw the coil for visualization.

Table 10.23 The coildef structure. For more detailed information, see Section 5.8.

Field

scanno logno

Data type

int32 int32 single(3)

Description

The type of digitizing point. Possible val-

ues are listed in Table 10.15. Look for

entries starting with FIFF_POINT.

Identiļ¬er for this point.

The location of this point.

Table 10.22 The dig structure.

kind range cal

Data type

int32 int32 int32 double double

Description

Scanning order number, starting from 1.

Logical channel number, conventions in the usage of this number vary.

The location of this point.

The hardware-oriented part of the calibration factor. This should be only applied to the continuous raw data.

The calibration factor to bring the channels to physical units.

Table 10.24 The ch structure.

MSH-MNE 257

10

The Matlab toolbox

Field Data type Description

loc coil_trans eeg_loc double(12) The channel location. The ļ¬rst three numbers indicate the location [m], followed by the three unit vectors of the channel-speciļ¬c coordinate frame. These data contain the values saved in the ļ¬f ļ¬le and should not be changed.

The values are speciļ¬ed in device coordinates for MEG and in head coordinates for EEG channels, respectively.

double(4,4) Initially, transformation from the channel coordinates to device coordinates. This transformation is updated by calls to ļ¬ff_transform_meg_chs and

ļ¬ff_transform_eeg_chs.

double(6) The location of the EEG electrode in coord_frame coordinates. The ļ¬rst three values contain the location of the electrode [m]. If six values are present, the remaining ones indicate the location of the reference electrode for this channel.

coord_frame int32 unit unit_mul ch_name coil_def int32 int32 char(*)

coildef

Initially, the coordinate frame is

FIFFV_COORD_DEVICE for MEG channels and

FIFFV_COORD_HEAD for EEG channels.

Unit of measurement. Relevant values are: 201 = T/m,

112 = T, 107 = V, and 202 = Am.

The data are given in units multiplied by 10

unit_mul

.

Presently, unit_mul is always zero.

Name of the channel.

The coil deļ¬nition structure. This is present only if

mne_add_coil_defs has been successfully called.

Table 10.24 The ch structure.

Field

kind active data

Data type Description

int32 int32

The type of the projection item. Possible

values are listed in Table 10.15. Look for

entries starting with FIFFV_PROJ_ITEM or FIFFV_MNE_PROJ_ITEM.

Is this item active, i.e., applied or about to be applied to the data.

named matrix

The projection vectors. The column names indicate the names of the channels associated to the elements of the vectors.

Table 10.25 The proj structure.

258 MSH-MNE

The Matlab toolbox

10

Field

ctfkind kind save_calibrated row_cals col_cals data

Data type Description

int32 int32 logical double(*)

The kind of the compensation as stored in ļ¬le.

ctfkind mapped into small integer numbers.

Were the compensation data saved in calibrated form. If this ļ¬eld is false, the matrix will be decalibrated using the ļ¬elds row_cals and col_cals when the compensation data are saved by the toolbox.

Calibration factors applied to the rows of the compensation data matrix when the data were read.

double(*) Calibration factors applied to the columns of the compensation data matrix when the data were read.

named matrix

The compensation data matrix. The row_names list the names of the channels to which this compensation applies and the col_names the compensation channels. For more information, see

Section 9.2.4

Table 10.26 The comp structure.

Field Data type Description

ļ¬le_id meas_id nchan sfreq highpass

id id

int32 double double

The ļ¬f ID of the measurement ļ¬le.

The ID assigned to this measurement by the acquisition system or during ļ¬le conversion.

Number of channels

Sampling frequency

Highpass corner frequency [Hz]. Zero indicates a DC recording.

lowpass chs double

ch(nchan)

Lowpass corner frequency [Hz].

An array of channel information structures.

ch_names cell(nchan) Cell array of channel names.

dev_head_t

trans

The device to head transformation ctf_head_t

trans

The transformation from 4D/CTF head coordinates to

Neuromag head coordinates. This is only present in 4D/

CTF data.

Table 10.27 The meas info structure.

MSH-MNE 259

10

The Matlab toolbox

Field

dev_ctf_t id sigma np ntri

Field

coord_frame rr nn tris nuse inuse vertno curv dig bads projs comps tri_area tri_cent

Data type

trans

dig(*) cell(*)

proj(*)

comp(*)

Description

The transformation from device coordinates to 4D/CTF head coordinates. This is only present in 4D/CTF data

The Polhemus digitization data in head coordinates.

Bad channel list

SSP operator data.

Software gradient compensation data.

Table 10.27 The meas info structure.

Data type Description

int32 double

The surface ID

The electrical conductivity of the compartment bounded by this surface. This ļ¬eld is present in BEM surfaces only.

int32 int32

Number of vertices on the surface

Number of triangles on the surface int32 Coordinate frame in which the locations and orientations are expressed.

double(np,3) The vertex locations double(np,3) The vertex normals. If derived surface data was not requested, this is empty.

int32(ntri,3) Vertex numbers of the triangles in counterclockwise order as seen from the outside.

int32 int32(np) int32(nuse)

Number of active vertices, i.e., vertices included in a decimated source space.

Which vertices are in use.

Indices of the vertices in use.

double(np) double(ntri)

Curvature values at the vertices. If curvature information was not requested, this ļ¬eld is empty or absent.

The triangle areas in m

2

.If derived surface data was not requested, this ļ¬eld will be missing.

double(ntri,3) The triangle centroids. If derived surface data was not requested, this ļ¬eld will be missing.

Table 10.28 The surf structure.

260 MSH-MNE

The Matlab toolbox

10

tri_nn

Field

nuse_tri use_tris nearest nearest_dist

Field

kind diag dim names data projs bads nfree eig eigvec

Data type Description

double(ntri,3) The triangle normals. If derived surface data was not requested, this ļ¬eld will be missing.

int32 Number of triangles in use. This is present only if the surface corresponds to a source space created with the -

-ico

option.

int32(nuse_tri) The vertices of the triangles in use in the complete triangulation. This is present only if the surface corresponds to a source space created with the --ico option.

int32(np) This ļ¬eld is present only if patch information has been computed for a source space. For each vertex in the triangulation, these values indicate the nearest active source space vertex.

double(np) This ļ¬eld is present only if patch information has been computed for a source space. For each vertex in the triangulation, these values indicate the distance to the nearest active source space vertex.

Table 10.28 The surf structure.

Data type Description

double double int32

What kind of a covariance matrix (1 = noise covariance,

2 = source covariance).

Is this a diagonal matrix.

Dimension of the covariance matrix.

cell(*) Names of the channels associated with the entries (may be empty).

double(dim,dim) The covariance matrix. This a double(dim) vector for a diagonal covariance matrix.

proj(*) cell(*)

The SSP vectors applied to these data.

Bad channel names.

int32 double(dim)

Number of data points used to compute this matrix.

The eigenvalues of the covariance matrix. This ļ¬eld may be empty for a diagonal covariance matrix.

double(dim,dim) The eigenvectors of the covariance matrix.

Table 10.29 The cov structure.

MSH-MNE 261

10

The Matlab toolbox

Field

source_ori coord_frame nsource nchan sol sol_grad mri_head_t src source_rr source_nn

Data type Description

int32 int32

Has the solution been computed for the current component normal to the cortex only (1) or all three source orientations (2).

Coordinate frame in which the locations and orientations are expressed.

Total number of source space points.

Number of channels.

int32 int32

named matrix named matrix trans

The forward solution matrix.

The derivatives of the forward solution with respect

to the dipole location coordinates, see Section 5.9.6.

This ļ¬eld is present only if the forward solution was

computed with the --grad option, see Section 5.9.2.

Transformation from the MRI coordinate frame to the

(Neuromag) head coordinate frame.

surf(*) The description of the source spaces double(nsource,3) The source locations.

double(*,3) The source orientations. Number of rows is either

nsource (ļ¬xed source orientations) or 3*nsource (all source orientations).

Table 10.30 The fwd structure.

nchan

Field

methods source_ori nsource coord_frame source_nn int32 int32 int32 int32 int32

Data type

double(*,3)

Description

Has the solution been computed using MEG data

(1), EEG data (2), or both (3).

Has the solution been computed for the current component normal to the cortex only (1) or all three source orientations (2)

Total number of source space points.

Number of channels.

Coordinate frame in which the locations and orientations are expressed.

The source orientations. Number of rows is either

nsource (ļ¬xed source orientations) or 3*nsource

(all source orientations).

Table 10.31 The inv structure. Note: The ļ¬elds proj, whitener, reginv, and noisenorm are ļ¬lled in by the routine mne_prepare_inverse_operator.

262 MSH-MNE

The Matlab toolbox

10

sing

Field

eigen_leads eigen_ļ¬elds noise_cov source_cov src mri_head_t nave projs proj whitener reginv noisenorm

Data type

double(nchan) double(*,nchan) double(nchan,nchan)

cov cov

surf(*)

trans

double

proj(*) double(nchan)

Description

The singular values, i.e., the diagonal values of

Λ

,

see Section 6.2.5.

The matrix

V

, see Section 6.2.5.

T

The matrix

U

, see Section 6.2.5.

The noise covariance matrix C.

The source covariance matrix R.

The description of the source spaces

Transformation from the MRI coordinate frame to the (Neuromag) head coordinate frame.

The number of averages.

The SSP vectors which were active when the decomposition was computed

The projection operator computed using projs.

A sparse matrix containing the noise normalization factors. Dimension is either nsource (ļ¬xed source orientations) or 3*nsource (all source orientations).

double(nchan) double(*,*) A sparse matrix containing the noise normalization factors. Dimension is either nsource (ļ¬xed source orientations) or 3*nsource (all source orientations).

Table 10.31 The inv structure. Note: The ļ¬elds proj, whitener, reginv, and noisenorm are ļ¬lled in by the routine mne_prepare_inverse_operator.

10.3 On-line documentation for individual routines

Each of the routines listed in Tables 10.1 – 10.14 has on-line documenta-

tion accessible by saying help <routine name> in Matlab.

MSH-MNE 263

10

The Matlab toolbox

264 MSH-MNE

11

C H A P T E R 1 1

Miscellaneous utilities

11.1 Overview

This Chapter describes various utility programs included with the MNE software. Each utility documentation consists of a brief description of the purpose followed by the speciļ¬cation of command-line options.

11.2 Finding software versions

The utility mne_list_versions lists version numbers and compilation dates of all software modules that provide this information. This administration utility is located in $MNE_ROOT/bin/admin, The output from

mne_list_versions or output of individual modules with --version option is useful when bugs are reported to the developers of MNE software.

11.3 Listing contents of a fif file

Using the utility mne_show_ļ¬ff it is possible to display information about the contents of a ļ¬f ļ¬le to the standard output. The command line options for mne_show_ļ¬ff are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the ļ¬f ļ¬le whose contents will be listed.

--verbose

Produce a verbose output. The data of most tags is included in the output. This excludes matrices and vectors. Only the ļ¬rst 80 characters of strings are listed unless the --long option is present.

MSH-MNE 265

11

Miscellaneous utilities

--long

List all data from string tags instead of the ļ¬rst 80 characters. This options has no effect unless the --verbose option is also present.

--tag <number>

List only tags of this kind. Multiple --tag options can be speciļ¬ed to list several different kinds of data.

mne_show_ļ¬ff reads the explanations of tag kinds, block kinds, and units from $MNE_ROOT/setup/mne/fiff_explanations.txt .

11.4 Data file modification utilities

This section contains utilities which can be used to add information or ļ¬x existing information in MEG/EEG data ļ¬f ļ¬les. Unless otherwise noted these utilities can be applied to both raw and evoked data ļ¬les.

11.4.1 Designating bad channels: mne_mark_bad_channels

This utility adds or replaces information about unusable (bad) channels.

The command line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--bad <ļ¬lename>

Specify a text ļ¬le containing the names of the bad channels, one channel name per line. The names of the channels in this ļ¬le must match those in the data ļ¬le exactly. If this option is missing, the bad channel information is cleared.

<data ļ¬le name>

The remaining arguments are taken as data ļ¬le names to be modiļ¬ed.

11.4.2 Fixing the encoding of the trigger channel: mne_fix_stim14

Some earlier versions of the Neuromag acquisition software had a problem with the encoding of the eighth bit on the digital stimulus channel STI

014. This problem has been now ļ¬xed. Old data ļ¬les can be ļ¬xed with

mne_ļ¬x_stim14, which takes raw data ļ¬le names as arguments.

mne_ļ¬x_stim14 also changes the calibration of STI 014 to unity. If the

266 MSH-MNE

MSH-MNE

Miscellaneous utilities

11

encoding of STI 014 is already correct, running mne_ļ¬x_stim14 will not have any effect on the raw data.

In newer Neuromag Vectorview systems with 16-bit digital inputs the upper two bytes of the samples may be incorrectly set when stimulus input 16 is used and the data are acquired in the 32-bit mode. This problem can be ļ¬xed by running mne_ļ¬x_stim14 on a raw data ļ¬le with the --

32

option: mne_fix_stim14 --32

<raw data ļ¬le>

In this case, the correction will be applied to the stimulus channels

‘STI101’ and ‘STI201’.

11.4.3 Updating EEG location info: mne_check_eeg_locations

Some versions of the Neuromag acquisition software did not copy the

EEG channel location information properly from the Polhemus digitizer information data block to the EEG channel information records if the number of EEG channels exceeds 60. The purpose of

mne_check_eeg_locations is to detect this problem and ļ¬x it, if requested.

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--ļ¬le <name>

Specify the measurement data ļ¬le to be checked or modiļ¬ed.

--dig <name>

Name of the ļ¬le containing the Polhemus digitizer information.

Default is the data ļ¬le name.

--ļ¬x

By default mne_check_eeg_locations only checks for missing EEG locations (locations close to the origin). With --ļ¬x

mne_check_eeg_locations reads the Polhemus data from the speciļ¬ed ļ¬le and copies the EEG electrode location information to the channel information records in the measurement ļ¬le. There is no harm running mne_check_eeg_locations on a data ļ¬le even if the

EEG channel locations were correct in the ļ¬rst place.

267

11

Miscellaneous utilities

11.4.4 Updating magnetometer coil types: mne_fix_mag_coil_types

The purpose of mne_ļ¬x_mag_coil_types is to change coil type 3022 to

3024 in the MEG channel deļ¬nition records in the data ļ¬les speciļ¬ed on the command line.

As shown in Tables 5.2 and 5.3, the Neuromag Vectorview systems can

contain magnetometers with two different coil sizes (coil types 3022 and

3023 vs. 3024). The systems incorporating coils of type 3024 were introduced last. At some sites (including the Martinos Center) the data ļ¬les have still deļ¬ned the magnetometers to be of type 3022 to ensure compatibility with older versions of Neuromag software. In the MNE software as well as in the present version of Neuromag software coil type 3024 is fully supported. Therefore, it is now safe to upgrade the data ļ¬les to use the true coil type.

If the --magnes option is speciļ¬ed, the 4D Magnes magnetometer coil type (4001) is changed to 4D Magnes gradiometer coil type (4002). Use this option always and only if your Magnes data comes from a system with axial gradiometers instead of magnetometers. The ļ¬f converter included with the Magnes system does not assign the gradiometer coil type correctly.

Note: The effect of the difference between the coil sizes of magnetometer types 3022 and 3024 on the current estimates computed by the MNE software is very small. Therefore the use of mne_ļ¬x_mag_coil_types is not mandatory.

11.4.5 Modifying channel names and types: mne_rename_channels

Sometimes it is necessary to change the names types of channels in MEG/

EEG data ļ¬les. Such situations include:

• Designating an EEG as an EOG channel. For example, the EOG channels are not recognized as such in the ļ¬f ļ¬les converted from CTF data ļ¬les.

• Changing the name of the digital trigger channel of interest to STI 014 so that mne_browse_raw and mne_process_raw will recognize the correct channel without the need to specify the --digtrig option or the

MNE_TRIGGER_CH_NAME environment variable every time a data ļ¬le is loaded.

The utility mne_rename_channels was designed to meet the above needs.

It recognizes the following command-line options:

--version

Show the program version and compilation date.

268 MSH-MNE

MSH-MNE

Miscellaneous utilities

11

--help

List the command-line options.

--ļ¬f <name>

Speciļ¬es the name of the data ļ¬le to modify.

--alias <name>

Speciļ¬es the text ļ¬le which contains the modiļ¬cations to be applied, see below.

--revert

Reverse the roles of old and new channel names in the alias ļ¬le.

Each line in the alias ļ¬le contains the old name and new name for a channel, separated by a colon. The old name is a name of one of the channels presently in the ļ¬le and the new name is the name to be assigned to it. The old name must match an existing channel name in the ļ¬le exactly. The new name may be followed by another colon and a number which is the channel type to be assigned to this channel. The channel type options are

listed in Table 11.1.

Channel type

MEG

MCG

EEG

EOG

EMG

ECG

MISC

STIM

Corresponding

302

402

502

3

1

201

2

202

number

Table 11.1 Channel types.

Warning: Do not attempt to designate MEG channels to EEG channels or vice versa. This may result in strange errors during source estimation.

Tip: You might consider renaming the EEG channels with descriptive labels related to the standard 10-20 system. This allows you to use stan-

dard EEG channel names when deļ¬ning derivations, see Sections 11.5

and 4.4.12, as well as in the channel selection ļ¬les used in

mne_browse_raw, see Section 4.5.5.

269

11

Miscellaneous utilities

11.4.6 Modifying trigger channel data: mne_add_triggers

11.4.6.1 Purpose

The utility mne_add_triggers modiļ¬es the digital trigger channel

(STI 014) in raw data ļ¬les to include additional transitions. Since the raw data ļ¬le is modiļ¬ed, it is possible to make irreversible changes. Use this utility with caution. It is recommended that you never run

mne_add_triggers on an original raw data ļ¬le.

11.4.6.2 Command line options

mne_add_triggers accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--raw <name>

Speciļ¬es the raw data ļ¬le to be modiļ¬ed.

--trg <name>

Speciļ¬es the trigger line modiļ¬cation list. This text ļ¬le should contain two entries per line: the sample number and the trigger number to be added into the ļ¬le. The number of the ļ¬rst sample in the ļ¬le is zero. It is recommended that trigger numbers whose binary equivalent has lower eight bits equal to zero are used to avoid conļ¬‚icts with the ordinary triggers occurring in the ļ¬le.

--delete

Delete the triggers deļ¬ned by the trigger ļ¬le instead of adding them.

This enables changing the ļ¬le to its original state, provided that the trigger ļ¬le is preserved.

Note: Since mne_browse_raw and mne_process_raw can employ an event ļ¬le which effectively adds new trigger instants, mne_add_triggers is for the most part obsolete but it has been retained in the MNE software suite for backward compatibility.

11.4.7 Removing identifying information

Depending no the settings during acquisition in the Elekta-Neuromag

EEG/MEG systems the data ļ¬les may contain subject identifying information in unencrypted form. The utility mne_anonymize was written to

270 MSH-MNE

Miscellaneous utilities

11

clear tags containing such information from a ļ¬f ļ¬le. Speciļ¬cally, this utility removes the following tags from the ļ¬f ļ¬le:

Tag Description

FIFF_SUBJ_FIRST_NAME First name of the subject

FIFF_SUBJ_MIDDLE_NAME Middle name of the subject

FIFF_SUBJ_LAST_NAME

FIFF_SUBJ_BIRTH_DAY

Last name of the subject

Birthday of the subject (Julian day number)

FIFF_SUBJ_SEX

FIFF_SUBJ_HAND

FIFF_SUBJ_WEIGHT

FIFF_SUBJ_HEIGHT

FIFF_SUBJ_COMMENT

The sex of the subject

Handedness of the subject

Weight of the subject in kg

Height of the subject in m

Comment about the subject

Table 11.2 Tags cleared by mne_anonymize.

Important: mne_anonymize keeps the FIFF_SUBJ_HIS_ID tag which can be used to identify the subjects uniquely after the information listed in

Table 11.2 have been removed. The data of the tags listed in Table 11.2

are overwritten with zeros and the space claimed by omitting these tags is added to the free space list of the ļ¬le. Therefore, after mne_anonymize has processed a data ļ¬le there is no way to recover the removed information.

Use this utility with caution.

mne_anonymize recognizes the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--ļ¬le <name>

Speciļ¬es the name of the ļ¬le to be modiļ¬ed.

Note: You need write permission to the ļ¬le to be processed.

MSH-MNE

11.4.8 Copying the processing history

In order for the inverse operator calculation to work correctly with data processed with the Elekta-Neuromag Maxļ¬lter™ software, the so-called

processing history block must be included in data ļ¬les. Previous versions

271

11

Miscellaneous utilities of the MNE Matlab functions did not copy processing history to ļ¬les saved. As of March 30, 2009, the Matlab toolbox routines

ļ¬ff_start_writing_raw and ļ¬ff_write_evoked have been enchanced to include these data to the output ļ¬le as appropriate. If you have older raw data ļ¬les created in Matlab from input which has been processed Maxļ¬lter, it is necessary to copy the processing history block from the original to modiļ¬ed raw data ļ¬le using the mne_copy_processing_history utility described below. The raw data processing programs mne_browse_raw and

mne_process_raw have handled copying of the processing history since revision 2.5 of the MNE software.

mne_copy_processing_history is simple to use: mne_copy_processing_history --from

<from> --to <to>, where <from> is an original raw data ļ¬le containing the processing history and <to> is a ļ¬le output with older MNE Matlab routines. Be careful: this operation cannot be undone. If the <from> ļ¬le does not have the processing history block or the <to> ļ¬le already has it, the destination ļ¬le remains unchanged.

11.5 Creating a derivation file

11.5.1 Purpose

In mne_browse_raw, channel derivations are deļ¬ned as linear combinations of real channels existing in the data ļ¬les. The utility

mne_make_derivations reads derivation data from a suitably formatted text ļ¬le and produces a ļ¬f ļ¬le containing the weights of derived channels as a sparse matrix. Two input ļ¬le formats are accepted:

1. A ļ¬le containing arithmetic expressions deļ¬ning the derivations and

2. A ļ¬le containing a matrix which speciļ¬es the weights of the channels in each derivation.

Both of these formats are described in

11.5.2 Command-line options

mne_make_derivations recognizes the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

272 MSH-MNE

Miscellaneous utilities

11

--in <name>

Speciļ¬es a measurement ļ¬le which contains the EEG electrode locations. This ļ¬le is not modiļ¬ed.

--inmat <name>

Speciļ¬es the output ļ¬le where the layout is stored. Sufļ¬x .lout is recommended for layout ļ¬les. mne_analyze and mne_browse_raw look for the custom layout ļ¬les from the directory $HOME/.mne/ lout

.

--trans

Indicates that the ļ¬le speciļ¬ed with the --inmat option contains a transpose of the derivation matrix.

--thresh <value>

Speciļ¬es the threshold between values to be considered zero and non-zero in the input ļ¬le speciļ¬ed with the --inmat option. The default threshold is

10

– 6

.

--out <name>

Speciļ¬es output ļ¬f ļ¬le to contain the derivation data. The recommended name of the derivation ļ¬le has the format <name>deriv.fif

.

--list <name>

List the contents of a derivation ļ¬le to standard output. If this option is missing and --out is speciļ¬ed, the content of the output ļ¬le will be listed once it is complete. If neither --list nor --out is present, and --in or --inmat is speciļ¬ed, the interpreted contents of the input ļ¬le is listed.

MSH-MNE

11.5.3 Derivation file formats

All lines in the input ļ¬les starting with the pound sign (#) are considered to be comments. The format of a derivation in a arithmetic input ļ¬le is:

<name> = [<

w

1

> *]<

name

1

> + [<

w

2

> *]<

name

2

>

… where <name> is the name of the derived channel, of the channels comprising the derivation, and

w k name k

are the names

are their weights. Note that spaces are necessary between the items. Channel names containing spaces must be put in quotes. For example,

EEG-diff = “EEG 003” - “EEG 002” deļ¬nes a channel EEG-diff which is a difference between EEG 003 and EEG 002. Similarly,

EEG-der = 3 * “EEG 010” - 2 * “EEG 002”

273

11

Miscellaneous utilities deļ¬nes a channel which is three times EEG 010 minus two times EEG

002

.

The format of a matrix derivation ļ¬le is:

<nrow>

<ncol>

<names of the input channels>

<

name

1

> <weights>

The combination of the two arithmetic examples, above can be thus represented as:

2 3

“EEG 002” “EEG 003” “EEG 010”

EEG-diff -1 1 0

EEG-der -2 0 3

Before a derivation is accepted to use by mne_browse_raw, the following criteria have to be met:

1. All channels to be combined into a single derivation must have identical units of measure.

2. All channels in a single derivation have to be of the same kind, e.g.,

MEG channels or EEG channels.

3. All channels speciļ¬ed in a derivation have to be present in the currently loaded data set.

The validity check is done when a derivation ļ¬le is loaded into

mne_browse_raw, see Section 4.4.12.

Tip: You might consider renaming the EEG channels with descriptive labels related to the standard 10-20 system using the

mne_rename_channels utility, see Section 11.4.5. This allows you to use

standard EEG channel names in the derivations you deļ¬ne as well as in

the channel selection ļ¬les used in mne_browse_raw, see Section 4.5.5.

274

11.6 Creating a custom EEG layout

11.6.1 Purpose

Both MNE software (mne_analyze and mne_browse_raw) and Neuromag software (xplotter and xļ¬t) employ text layout ļ¬les to create topographical displays of MEG and EEG data. While the MEG channel layout is ļ¬xed, the EEG layout varies from experiment to experiment, depending on the number of electrodes used and the electrode cap conļ¬guration. The utility

mne_make_eeg_layout was created to produce custom EEG layout ļ¬les

MSH-MNE

MSH-MNE

Miscellaneous utilities

11

based on the EEG electrode location information included in the channel description records.

mne_make_eeg_layout uses azimuthal equidistant projection to map the

EEG channel locations onto a plane. The mapping consists of the following steps:

1. A sphere is ļ¬tted to the electrode locations and the locations are translated by the location of the origin of the best-ļ¬tting sphere.

2. The spherical coordinates (

r k

θ and lated electrode location are computed.

φ

k

) corresponding to each trans-

3. The projected locations puted. By default,

R

=

u k

20

=

(

R

θ

k

) cos

φ

k

and

v k

=

R

θ

k

, i.e. at the equator ( sin

θ

φ

=

k

are com-

) the multiplier is 20. This projection radius can be adjusted with the -prad

option. Increasing or decreasing makes the spacing between the channel viewports larger or smaller, respectively.

4. A viewport with width 5 and height 4 is placed centered at the projected location. The width and height of the viewport can be adjusted with the --width and --height options

The command-line options are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--lout <name>

Speciļ¬es the name of the layout ļ¬le to be output.

--noļ¬t

Do not ļ¬t a sphere to the electrode locations but use a standard sphere center (

x

=

y

=

0

, and

z

=

40 mm

instead.

--prad <value>

--width <value>

Speciļ¬es the width of the viewports. Default value = 5.

--height <value>

Speciļ¬es the height of the viewports. Default value = 4.

275

11

Miscellaneous utilities

11.7 Adding topology information to a source space

11.7.1 Purpose

The utility mne_add_patch_info uses the surface topology information to add data about cortical patches corresponding to each source space point to a source space ļ¬le. A new copy of the source space is created with the patch information included.

Note: Depending on the speed of your computer, mne_add_patch_info takes 5 - 30 minutes to run.

11.7.2 Command line options

mne_add_patch_info accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--srcp <name>

The input source space ļ¬le. The source space ļ¬les usually end with

-src.fif

.

--srcp <name>

The output source space ļ¬le which will contain the patch information. If the ļ¬le exists it will overwritten without asking for permission. A recommended naming convention is to add the letter p after the source spacing included in the ļ¬le name. For example, if the input ļ¬le is mh-7-src.fif, a recommended output ļ¬le name is mh-7p-src.fif

.

--w <name>

Name of a w ļ¬le, which will contain the patch area information.

Two ļ¬les will be created: <name>-lh.w and <name>-rh.w. The numbers in the ļ¬les are patch areas in mm

2

. The source space vertices are marked with value 150.

--labeldir <directory>

Create a label ļ¬le corresponding to each of the patches in the given directory. The directory must be created before running

mne_add_patch_info.

276 MSH-MNE

MSH-MNE

Miscellaneous utilities

11

11.8 Converting covariance data into an SSP operator

11.8.1 Purpose

The utility mne_cov2proj picks eigenvectors from a covariance matrix and outputs them as a signal-space projection (SSP) ļ¬le.

11.8.2 Command line options

mne_cov2proj accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--cov <name>

The covariance matrix ļ¬le to be used a source. The covariance matrix ļ¬les usually end with -cov.fif.

--proj <name>

The output ļ¬le to contain the projection. It is recommended that the ļ¬le name ends with -proj.fif.

--bad <name>

Specify channels not to be included when an eigenvalue decomposition of the covariance matrix is computed.

--include <val

1

>[:<val

2

>]

Select an eigenvector or a range of eigenvectors to include. It is recommended that magnetometers, gradiometers, and EEG data are handled separately with help of the --bad, --meg, --megmag, -

-meggrad

, and --eeg options.

--meg

After loading the covariance matrix, modify it so that only elements corresponding to MEG channels are included.

--eeg

After loading the covariance matrix, modify it so that only elements corresponding to EEG channels are included.

--megmag

After loading the covariance matrix, modify it so that only elements corresponding to MEG magnetometer channels are included.

277

11

Miscellaneous utilities

--meggrad

After loading the covariance matrix, modify it so that only elements corresponding to MEG planar gradiometer channels are included.

Important: The --megmag and --meggrad employ the Vectorview channel numbering scheme to recognize MEG magnetometers (channel names ending with ‘1’) and planar gradiometers (other channels). Therefore, these options are only meaningful in conjunction with data acquired with a Neuromag Vectorview system.

11.9 Fitting a sphere to a surface

11.9.1 Purpose

The utility mne_ļ¬t_sphere_to_surf ļ¬nds the sphere which best ļ¬ts a given surface.

11.9.2 Command line options

mne_ļ¬t_sphere_to_surf accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--bem <name>

A BEM ļ¬le to use. The names of these ļ¬les usually end with bem.fif

or bem-sol.fif.

--surf <name>

A FreeSurfer surface ļ¬le to read. This is an alternative to using a surface from the BEM ļ¬le.

--scalp

Use the scalp surface instead of the inner skull surface in sphere ļ¬tting. If the surface is speciļ¬ed with the --surf option, this one is irrelevant.

--mritrans <name>

A ļ¬le containing a transformation matrix between the MEG head coordinates and MRI coordinates. With this option, the sphere origin will be output in MEG head coordinates. Otherwise the output will be in MRI coordinates.

278 MSH-MNE

Miscellaneous utilities

11

11.10 Computing sensitivity maps

11.10.1 Purpose

mne_sensitivity_map computes the size of the columns of the forward operator and outputs the result in w ļ¬les.

MSH-MNE

11.10.2 Command line options

mne_sensitivity_map accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--fwd <name>

Speciļ¬es a forward solution ļ¬le to analyze. By default the MEG forward solution is considered.

--eeg

Use the EEG forward solution instead of the MEG one. It does not make sense to consider a combination because of the different units of measure. For the same reason, gradiometers and magnetometers have to be handled separately, see --mag option below. By default

MEG gradiometers are included.

--mag

Include MEG magnetometers instead of gradiometers

--w <name>

Speciļ¬es the stem of the output w ļ¬les. To obtain the ļ¬nal output ļ¬le names, -lh.w and -rh.w is appended for the left and right hemisphere, respectively.

--smooth <number>

Speciļ¬es the number of smooth steps to apply to the resulting w ļ¬les. Default: no smoothing.

--map <number>

Select the type of a sensitivity map to compute. At present, valid

numbers are 1, 2, and 3. For details, see Section 11.10.3, below.

11.10.3 Available sensitivity maps

In the following, let

279

11

Miscellaneous utilities

G

k

=

g

xk

g

yk

g

zk

denote the three consecutive columns of the gain matrix

G

corresponding ther, lets assume that the source coordinate system has been selected so that the -axis points to the cortical normal direction and the

xy

plane is compute the SVD

G

k

=

U

k

Λ

k

V

k

and let

g

1k

= and the corresponding left singular vector of , respectively. It is easy to see that

g

1k

u

1k

λ

1k

, where

λ

1k

and

u

1k

are the largest singular value

G

k

is has the largest power among the signal distributions pro-

k

With these deļ¬nitions the map selections deļ¬ned with the --map option correspond to the following

--map 1

Compute

g

T

1k

g

1k

=

λ

1k

at each source space point. Normalize the result so that the maximum values equals one.

--map 2

Compute

g

T z

g

z

at each source space point. Normalize the result so that the maximum values equals one. This is the amplitude of the signals produced by unit dipoles normal to the cortical surface.

--map 3

Compute

g

z

T

g

z

g

T

1k

g

1k

at each source space point.

--map 4

Compute 1 –

g

T z

g

z

g

T

1k

g

1k be called the radiality index.

at each source space point. This could

11.11 Transforming locations

11.11.1 Purpose

mne_transform_points applies the coordinate transformation relating the

MEG head coordinates and the MRI coordinates to a set of locations listed in a text ļ¬le.

280 MSH-MNE

Miscellaneous utilities

11

11.11.2 Command line options

mne_transform_points accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the input ļ¬le. The ļ¬le must contain three numbers on each line which are the x, y, and z coordinates of point in space. By default, the input is in millimeters.

--iso <name>

Speciļ¬es a name of a ļ¬f ļ¬le containing Isotrak data. If this option is present ļ¬le will be used as the input instead of the text ļ¬le speciļ¬ed with the --in option.

--trans <name>

Speciļ¬es the name of a ļ¬f ļ¬le containing the coordinate transformation between the MEG head coordinates and MRI coordinates. If this ļ¬le is not present, the transformation will be replaced by a unit transform.

--out <name>

Speciļ¬es the output ļ¬le. This ļ¬le has the same format as the input ļ¬le.

--hpts

Output the data in the head points (hpts) format accepted by

tkmedit. In this format, the coordinates are preceded by a point category (hpi, cardinal or ļ¬ducial, eeg, extra) and a sequence number,

see Section 9.3.1.

--meters

The coordinates are listed in meters rather than millimeters.

--tomri

By default, the coordinates are transformed from MRI coordinates to MEG head coordinates. This option reverses the transformation to be from MEG head coordinates to MRI coordinates.

MSH-MNE

11.12 Inquiring and changing baselines

The utility mne_change_baselines computes baseline values and applies them to an evoked-response data ļ¬le. The command-line options are:

281

11

Miscellaneous utilities

--version

Show the program version and compilation date.

--help

List the command-line options.

--in <name>

Speciļ¬es the input data ļ¬le.

--set <number>

The data set number to compute baselines from or to apply baselines to. If this option is omitted, all average data sets in the input ļ¬le are processed.

--out <name>

The output ļ¬le.

--baselines <name>

Speciļ¬es a text ļ¬le which contains the baseline values to be applied.

Each line should contain a channel name, colon, and the baseline value given in ‘native’ units (T/m, T, or V). If this option is encountered, the limits speciļ¬ed by previous --bmin and --bmax options will not have an effect.

--list <name>

Speciļ¬es a text ļ¬le to contain the baseline values. Listing is provided only if a speciļ¬c data set is selected with the --set option.

--bmin <value/ms>

Lower limit of the baseline. Effective only if --baselines option is not present. Both --bmin and --bmax must be present to compute the baseline values. If either --bmin or --bmax is encountered, previous --baselines option will be ignored.

--bmax <value/ms>

Upper limit of the baseline.

11.13 Data simulator

11.13.1 Purpose

The utility mne_simu creates simulated evoked response data for investigation of the properties of the inverse solutions. It computes MEG signals generated by dipoles normal to the cortical mantle at one or several ROIs deļ¬ned with label ļ¬les. Colored noise can be added to the signals.

282 MSH-MNE

MSH-MNE

Miscellaneous utilities

11

11.13.2 Command-line options

mne_simu has the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--fwd <name>

Specify a forward solution ļ¬le to employ in the simulation.

--label <name>

Specify a label

--meg

Provide MEG data in the output ļ¬le.

--eeg

Provide EEG data in the output ļ¬le.

--out <name>

Specify the output ļ¬le. By default, this will be an evoked data ļ¬le in the ļ¬f format.

--raw

Output the data as a raw data ļ¬f ļ¬le instead of an evoked one.

--mat

Produce Matlab output of the simulated ļ¬elds instead of the ļ¬f evoked ļ¬le.

--label <name>

Deļ¬ne an ROI. Several label ļ¬les can be present. By default, the sources in the labels will have cos

2

-shaped non-overlapping timecourses, see below.

--timecourse <name>

Explain the option here.

--sfreq <freq/Hz>

Explain the option here (default 1000 Hz).

--tmin <time/ms>

Explain the option here (default -200 ms).

--tmax <time/ms>

Explain the option here (default 500 ms).

283

11

Miscellaneous utilities

--seed <number>

Speciļ¬es the seed for random numbers. This seed is used both for

adding noise, see Section 11.13.3 and for random numbers in source

waveform expressions, see Section 11.13.5. If no seed is speciļ¬ed,

the current time in seconds since Epoch (January 1, 1970) is used.

--all

Activate all sources on the cortical surface uniformly. This overrides the --label options.

11.13.3 Noise simulation

Noise is added to the signals if the --senscov and --nave options are present. If --nave is omitted the number of averages is set to

L

=

100

.

The noise is computed by ļ¬rst generating vectors of Gaussian random numbers matrix

C

n t

with

n j

∼ is used to color the noise:

)

. Thereafter, the noise-covariance

n

c

=

1

ΛU

L

T

where we have used the eigenvalue decomposition positive-deļ¬nite covariance matrix:

C

=

U

Λ

2

U

T

.

Note that it is assumed that the noise-covariance matrix is given for raw data, i.e., for

L

= 1 .

284

11.13.4 Simulated data

t kp

100 k – 1 =

k p

0

…100

k

th

The default source waveform

q

for the label is nonzero at times

=

( (

s

, with:

q k

(

t kp

)

=

Q k

cos

2

ļ£«

ļ£­

100

– ---

2

ļ£ø

ļ£¶ , i.e., the source waveforms are non-overlapping 100-samples wide cos

2 pulses. The sampling frequency

f s

= 600Hz . The source amplitude

Q k

is determined so that the strength of each of the dipoles in a label will be

k

.

Let us denote the sums of the magnetic ļ¬elds and electric potentials produced by the dipoles normal to the cortical mantle at label by

x

k

. The simulated signals are then:

MSH-MNE

MSH-MNE

Miscellaneous utilities

11

j

=

N

s k

= 1

q k

where

N s

is the number of sources.

k

+

n

c

11.13.5 Source waveform expressions

The --timecourse option provides ļ¬‚exible possibilities to deļ¬ne the source waveforms in a functional form. The source waveform expression ļ¬les consist of lines of the form:

<variable> = <arithmetic expression>

Each ļ¬le may contain multiple lines. At the end of the evaluation, only the

values in the variable y (q) are signiļ¬cant, see Table 11.3. They assume

the role of

q k

( )

to compute the simulated signals as described in

Section 11.13.4, above.

All expressions are case insensitive. The variables are vectors with the length equal to the number of samples in the responses, determined by the

--tmin

, --tmax, and --sfreq options. The available variables are

listed in Table 11.3.

Variable Meaning

y q t x

time [s] current value of x in [ms] the source amplitude [Am] synonym for y

a, b, c, d help variables, initialized to zeros

Table 11.3 Available variable names in source waveform expressions.

The arithmetic expressions can use usual arithmetic operations as well as

mathematical functions listed in Table 11.4. The arguments can be vectors

or scalar numbers. In addition, standard relational operators (<, >, ==, <=,

285

11

Miscellaneous utilities

>=) and their textual equivalents (lt, gt, eq, le, ge) are available. Table

Table 11.5 gives some useful examples of source waveform expressions.

Function

abs(x) acos(x) asin(x) atan(x) atan2(x,y) ceil(x) cos(x) cosw(x,a,b,c)

Description

absolute value cos

1

x

sin

– 1

x

tan

– 1

x

tan

– 1

(

y x

) nearest integer larger than x cos

x

cos

2 deg(x) erf(x) erfc(x) exp(x) ļ¬‚oor(x) hypot(x,y) ln(x) log(x) maxp(x,y) minp(x,y) mod(x,y) degrees

2

π

x

0 exp

(

t

2

d

1

– erf x

e x

Largest integer value not larger than

x x

2

+

y

2 ln

x

log

10

x y y y

Table 11.4 Mathematical functions available for source waveform expressions

286 MSH-MNE

Miscellaneous utilities

11

pi

Function

rand rnorm(x,y)

Description

Ratio of the circumference of a circle and its diameter.

Gives a vector of uniformly distributed random numbers from 0 to 1.

Gives a vector of Gaussian random numbers distributed as

N x y

) are vectors, each number generated will a different mean and variance according to the arguments.

shift(x,s) sin(x) sqr(x) sqrt(x) tan(x) must be a scalar.

sin

x x

2

x

tan

x

Table 11.4 Mathematical functions available for source waveform expressions

Expression Meaning

q = 20e-9*sin(2*pi*10*x) q = 20e-9*sin(2*pi*2*x)*sin(2*pi*10*x)

A 10-Hz sine wave with 20 nAm amplitude

A 10-Hz 20-nAm sine wave, amplitude modulated sinusoidally at 2 Hz.

q = 20e-9*cosw(t,100,100,100) cos

2

-shaped pulse, centered at

t

=

100 ms

with 100 ms leading and trailing slopes, 20 nAm amplitude.

q = 30e-9*(t > 0)*(t < 300)*sin(2*pi*20*x) 20-Hz sine wave, 30 nAm amplitude, cropped in time to 0...300 ms.

Table 11.5 Examples of source waveform expressions.

MSH-MNE 287

11

Miscellaneous utilities

11.14 Converting parcellation data into labels

The utility mne_annot2labels converts cortical parcellation data into a set of labels. The parcellation data are read from the directory

$SUBJECTS_DIR/$SUBJECT/label

and the resulting labels are written to the current directory. mne_annot2labels requires that the environment variable $SUBJECTS_DIR is set. The command line options for

mne_annot2labels are:

--version

Show the program version and compilation date.

--help

List the command-line options.

--subject <name>

Speciļ¬es the name of the subject. If this option is not present the

$SUBJECT

environment variable is consulted. If the subject name cannot be determined, the program quits.

--parc <name>

Speciļ¬es the parcellation name to convert. The corresponding parcellation ļ¬le names will be $SUBJECTS_DIR/$SUBJECT/ label/

<hemi>h.<name>.annot where <hemi> is l or r for the left and right hemisphere, respectively.

288 MSH-MNE

12

C H A P T E R 1 2

The sample data set

12.1 Purpose

This Chapter gives a detailed description of the processing of a sample data set, which can be employed to familiarize with the workļ¬‚ow

described in Chapter 3.

Important: Going through the analysis exercise in this chapter is not a substitute for reading other chapters of this manual and understanding the concepts underlying MNE software.

12.2 Overview

The MNE software is accompanied by a sample data set which includes the MRI reconstructions created with FreeSurfer and the an MEG/EEG data set. These data were acquired with the Neuromag Vectorview system at MGH/HMS/MIT Athinoula A. Martinos Center Biomedical Imaging.

EEG data from a 60-channel electrode cap was acquired simultaneously with the MEG. The original MRI data set was acquired with a Siemens

1.5 T Sonata scanner using an MPRAGE sequence.

Important: These data are provided solely for the purpose of getting familiar with the MNE software. They should not be redistributed to third parties. The data should not be used to evaluate the performance of the

MEG or MRI system employed.

In the MEG/EEG experiment, checkerboard patterns were presented into the left and right visual ļ¬eld, interspersed by tones to the left or right ear.

The interval between the stimuli was 750 ms. Occasionally an smiley face was presented at the center of the visual ļ¬eld. The subject was asked to press a key with the right index ļ¬nger as soon as possible after the appear-

MSH-MNE 289

12

The sample data set ance of the face. A listing of the corresponding trigger codes is provided

in Table 12.1

Name

LA

RA

LV

RV smelly button

3

4

1

2

5

32

# Contents

Response to left-ear auditory stimulus

Response to right-ear auditory stimulus

Response to left visual ļ¬eld stimulus

Response to right visual ļ¬eld stimulus

Response to the smiley face

Response triggered by the button press

Table 12.1 Trigger codes for the sample data set.

12.3 Setting up

The sample data set is distributed with the MNE software as a compressed tar archive located at $MNE_ROOT/sample-data/MNE-sampledata.tar.gz

. To make a personal copy of the sample data set, follow these steps:

1. Set up for using the MNE software as instructed in Section 2.4 of this

manual.

2. Create a directory for your personal copy: mkdir <yourdir>, where

<yourdir> is the location where you want your personal copy to reside.

Tho store the sample data set and to ļ¬nish the tutorials in this Chapter, you need approximately 600 MBytes of space on the disk where

<yourdir> is located.

3. Go to your newly created sample data directory: cd <yourdir>.

4. Extract the sample data: tar zxvf <dir>/MNE-sampledata.tar.gz

, where <dir> is the location of the tar archive, provided by your system administrator.

To start the tutorials you need to:

1. Set up MNE software user environment, see Section 2.4.

2. Set the SUBJECTS_DIR environment variable: setenv SUBJECTS_DIR

<yourdir>/subjects (csh and tcsh) or export SUBJECTS_DIR=<yourdir>/subjects (POSIXcompatible shell). Most users at the Martinos Center have tcsh as their login shell.

3. Assign the SUBJECT environment variable the value sample.

290 MSH-MNE

The sample data set

12

4. For convenience, you can also set the environment variable SAMPLE to <yourdir>. The following tutorial examples assume you have done this.

5. Set up the FreeSurfer environment using the commands speciļ¬c to your site. The FreeSurfer license is needed for the source space cre-

ation covered in Section 12.5.2.

Note: From this point on, directories and ļ¬les under your personal copy of the sample data set under <yourdir> will be referred to by relative pathnames. For example, the ļ¬le <yourdir>/MEG/sample/audvis.ave

will be simply called MEG/sample/audvis.ave.

Note: You can also proceed without FreeSurfer installed if you choose to use source space creation using the recursively subdivided octahedron or icosahedron method. For more information, see the Note in

Section 12.5.2.

MSH-MNE

12.4 Contents of the data set

The sample data set contains two main directories: MEG/sample (the

MEG/EEG data) and subjects/sample (the MRI reconstructions).

An overview of the data provided is given in Tables 12.2 and 12.3. In

addition to subject sample, the MRI surface reconstructions from another subject, morph, are provided to demonstrate the morphing capabilities of the MNE software.

File Contents

sample/audvis_raw.ļ¬f The raw MEG/EEG data audvis.ave

A template script for off-line averaging auvis.cov

A template script for the computation of a noise-covariance matrix

Table 12.2 Contents of the MEG/sample directory.

File / directory Contents

bem bem/watershed

Directory for the forward modelling data

BEM surface segmentation data computed with the watershed algorithm bem/inner_skull.surf

Inner skull surface for BEM bem/outer_skull.surf

Outer skull surface for BEM

Table 12.3 Overview of the contents of the subjects/sample directory.

291

12

The sample data set

File / directory Contents

bem/outer_skin.surf

Skin surface for BEM sample-head.ļ¬f Skin surface in ļ¬f format for mne_analyze visualizations surf mri/T1

Surface reconstructions

The T1-weighted MRI data employed in visualizations

Table 12.3 Overview of the contents of the subjects/sample directory.

The following preprocessing steps have been already accomplished in the sample data set:

1. The MRI surface reconstructions have been computed using the Free-

Surfer software.

2. The BEM surfaces have been created with the watershed algorithm, see

Section A.1.

3. The MEG/EEG raw data ļ¬le has been checked with the utilities

described in Sections 3.9.1 and 3.9.2.

4. Template scripts for averaging and computation of the noise-covariance matrices have been written.

12.5 Setting up subject-specific data

12.5.1 Structural MRIs

To set up the structural MRIs for processing with the Neuromag MRI viewer, MRIlab, say mne_setup_mri

This command sets up the directories subjects/sample/mri/T1neuromag

and subjects/sample/mri/brain-neuromag. For

more information, see Section 3.4.

12.5.2 Source space

The source space with a 5-mm grid spacing is set up by saying: mne_setup_source_space --ico -6

This command sets up the source-space related ļ¬les in directory subjects/sample/bem

as described in Section 3.5.

292 MSH-MNE

MSH-MNE

The sample data set

12

12.5.3 Boundary-element models

The geometry calculations for the single-layer boundary-element model are accomplished with the command: mne_setup_forward_model --homog --surf --ico 4

This command sets up the homogeneous BEM-model related ļ¬les in

directory subjects/sample/bem as described in section Section 3.7.

In addition to the homogeneous BEM, you also need the three-layer BEM model, which can be used for both EEG and MEG: mne_setup_forward_model --surf --ico 4

The above commands employ the inner_skull.surf, outer_skull.surf

, and outer_skin.surf triangulation ļ¬les located in subjects/sample/bem. The option --ico 4 will create a model with 5120 triangles on each surface. Depending on the speed of your computer, the three-layer model may take quite a while to set up.

12.6 Setting up a custom EEG layout

A data speciļ¬c EEG layout will facilitate viewing of the EEG data. The

MNE programs mne_browse_raw and mne_analyze look for user-speciļ¬c layouts in $HOME/.mne/lout. Thus, you can create an EEG layout for the sample data set with the following commands: mkdir -p $HOME/.mne/lout cd $SAMPLE/MEG/sample mne_make_eeg_layout --fif sample_audvis_raw.fif \

--lout $HOME/.mne/lout/sample-EEG.lout

Please refer to Section 11.6

for more information on

mne_make_eeg_layout.

Note: It is usually sufļ¬cient to create one EEG layout for each electrode cap you are using in your experiment rather than using a different layout ļ¬le for each data ļ¬le generated using the same cap.

12.7 Previewing the data

Previewing your raw data before proceeding to averaging and computation of the current estimates is most important to avoid unintentional errors caused by noisy or dysfunctional channels, frequent eye blinks, inappropriate bandpass ļ¬ltering etc.

293

12

The sample data set

One possible routemap for the preview session is outlined below:

1. Go to the MEG/EEG data directory: cd $SAMPLE/MEG/sample.

2. Launch mne_browse_raw.

3. Open the raw data ļ¬le sample_audvis_raw.fif from File/

Open...

.

4. Switch all SSP vectors off from Adjust/Projection....

5. Set the lowpass ļ¬lter corner to a high value, e.g., 150 Hz from Adjust/

Filter...

.

6. Browse through all channels using the selections available under

Adjust/Selection... and look for very noisy or ļ¬‚at channels. You should be able to readily identify two such channels among all MEG and EEG channels. You may need to click Remove DC to reliably associate the noisy or ļ¬‚at waveform with the channel name on the left. Also, experiment with switching the EEG average reference projection on and off and you will notice that the EEG bad channel cannot be seen after the projection.

7. Mark the channels you identiļ¬ed in step 6. bad for this viewing session by clicking on their channel names on the left. You can save the bad channel selection to the ļ¬le from File/Apply bad channels. Bad channel marking can be removed by clicking on their channel names again and selecting File/Apply bad channels. Alternatively, you can use the utility

mne_mark_bad_channels to set a bad channel selection, see

Section 11.4.1.

8. Switch the projections back on and change ļ¬lter to a 40-Hz lowpass.

9. Compute a preliminary average for the left-ear auditory stimulus: a. Open the averaging preferences dialog (Adjust/Averaging prefer-

ences....

b. Set the time scale to -100...300 ms.

c. Click on the text next to Average: in the main window and press return. After a while, a topographical display appears with the averaged responses. Notice that the bad channels are not displayed.

d. Change to different layouts from Adjust/Full view layout.... Inspect both the MEG and EEG waveforms.

5. Compute a preliminary average for the right-ear auditory stimulus: a. Open the averaging preferences.

b. Click on the Trace color... button and change the trace color to something different from the default yellow.

c. Change the text next to Average: to 2 and press return. Average to the right-ear tones will be computed. Compare the to sets of averages and verify that all channels show reasonable data.

4. Go to Adjust/Manage averages... and delete the preliminary averages just computed.

After these steps, you are ready to proceed to the actual analysis.

294 MSH-MNE

The sample data set

12

12.8 Off-line averaging

Go to directory $SAMPLE/MEG/sample . With help of Section 4.13,

familiarize yourself with the averaging script audvis.ave.

12.8.1 Using the averaging script interactively

You can invoke an averaging script in mne_browse_raw from Process/

Average...

. Select the audvis.ave script from the ļ¬le selection box that appears. Once averaging is complete, you can inspect the details of the averaged responses in the Averages window, which appears automatically.

You can redisplay it from Windows/Show averages.... The window, which appears when you select Adjust/Manage averages... allows you to:

1. Select which conditions (categories) are displayed.

2. Change the trace colors.

3. Inspect the averaging log.

4. Save the averaged data.

5. Delete this set of averages.

Note: If you decide to save the averages in the interactive mode, use the name sample_audvis-ave.fif for the result.

MSH-MNE

12.8.2 Using the averaging script in batch mode

The batch-mode version of mne_browse_raw, mne_process_raw can be used for averaging as well. Batch mode averaging can be done with the command: mne_process_raw --raw sample_audvis_raw.fif \

--lowpass 40 --projoff \

--saveavetag -ave --ave audvis.ave

The functions of the options are:

--raw

Speciļ¬es the raw ļ¬le.

--lowpass

Speciļ¬es the lowpass ļ¬lter corner frequency.

--projoff

Do not apply signal-space projection and average electrode reference to the data. Regardless, the projection information is included with the data ļ¬le so that it can be applied later. It is also possible to specify the --projon option but then there is no possibility to view the original data in subsequent phases of the analysis.

295

12

The sample data set

--saveavetag

Speciļ¬es how the averages are named. With this option, the

_raw.fif

ending is stripped of the original raw data ļ¬le and the tag speciļ¬ed with this option (-ave) is added. The average ļ¬le and the corresponding log ļ¬le will have the extensions .fif and .log, respectively.

--ave

Speciļ¬es the averaging script.

As a result of running the averaging script a ļ¬le called sample_audvis-ave.fif

is created. It contains averages to the left and right ear auditory as well as to the left and right visual ļ¬eld stimuli.

12.9 Viewing the off-line average

The average ļ¬le computed in the previous section can be viewed in

mne_browse_raw.

To view the averaged signals, invoke mne_browse_raw: cd $SAMPLE/MEG/sample mne_browse_raw &

This Section gives only very basic information about the use of

mne_browse_raw for viewing evoked-response data. Please consult

Chapter 4 for more comprehensive information.

296

12.9.1 Loading the averages

mne_browse_raw loads all the available data from an average ļ¬le at once:

1. Select Open evoked... from the File menu.

2. Select the average ļ¬le sample_audvis-ave.fif ļ¬le from the list and click OK.

3. A topographical display of the waveforms with gradiometer channels included appears.

12.9.2 Inspecting the auditory data

Select the left and right ear auditory stimulus responses for display:

1. Select Manage averages... from the Adjust menu.

2. Click off all other conditions except the auditory ones.

Set the time scale and baseline:

MSH-MNE

The sample data set

12

1. Select Scales… from the Adjust menu.

2. Switch off Autoscale time range and set the Average time range from -

200 to 500 ms.

3. Switch on Use average display baseline and set Average display base-

line from -200 to 0 ms.

4. Click OK.

You can display a subset of responses from the topographical display by holding the shift key down and dragging with the mouse, left button down. When you drag on the response with just the left button down, the signal timing, and channel name are displayed at the bottom. If the left mouse button is down and you press shift down the time is give both in absolute units and relative to the point where shift was pressed down.

Observe the following:

1. The main deļ¬‚ection occurs around 100 ms over the left and right temporal areas.

2. The left-ear response (shown in yellow) is stronger on the right than on the left. The opposite is true for the right-ear response, shown in red.

12.9.3 Inspecting the visual data

Go back to the Manage averages... dialog and switch all other conditions except the visual ones.

Observe the following:

1. The left and right visual ļ¬eld responses are quite different in spatial distribution in the occipital area.

2. There is a later response in the right parietal area, almost identical to both visual stimuli.

Tip: If you have the Neuromag software available, the averaged data can

be also viewed in the Neuromag data plotter (xplotter). See Section B.2

for instructions on how to use the Neuromag software at the MGH Martinos Center.

MSH-MNE

12.10 Computing the noise-covariance matrix

Another piece of information derived from the raw data ļ¬le is the estimate for the noise-covariance matrix, which can be computed with the command: mne_process_raw --raw sample_audvis_raw.fif \

--lowpass 40 --projon \

--savecovtag -cov --cov audvis.cov

297

12

The sample data set

Using the deļ¬nitions in audvis.cov, this command will create the noise-covariance matrix ļ¬le sample_audvis-cov.fif. In this case the projections are set on. The projection information is then attached to the noise-covariance matrix and will be automatically loaded when the inverse-operator decomposition is computed.

Tip: You can study the contents of the covariance matrix computation

description ļ¬le audvis.cov with help of Section 4.14

12.11 MEG-MRI coordinate system alignment

The mne_analyze module of the MNE is one option for the coordinate alignment. It uses a triangulated scalp surface to facilitate the alignment.

298

12.11.1 Initial alignment

Follow these steps to make an initial approximation for the coordinate alignment.

1. Go to directory MEG/sample.

2. Launch mne_analyze

3. Select File/Load digitizer data... and load the digitizer data from sample_audvis_raw.fif

.

4. Load an inļ¬‚ated surface for subject sample from File/Load surface...

5. Bring up the viewer window from View/Show viewer...

6. Click Options... in the viewer window. Make the following selections: a. Switch left and right cortical surface display off.

b. Make the scalp transparent.

c. Switch Digitizer data on.

4. After a while, the digitizer points will be shown. The color of the circles indicates whether the point is inside (blue) or outside (red) of the scalp. The HPI coils are shown in green and the landmark locations in light blue or light red color. The initial alignment is way off!

5. Switch the Digitizer data off to get the big circles out of the way.

6. Bring up the coordinate alignment window from Adjust/Coordinate

alignment...

7. Click on the RAP (Right Auricular Point) button. It turns red, indicating that you should select the point from the viewer window. Click at the approximate location of this point in the viewer. The button jumps up, turns to normal color, and the MRI coordinates of the point appear in the text ļ¬elds next to the button.

8. Proceed similarly for the other two landmark points: Nasion and LAP

(Left Auricular Point).

9. Press Align using ļ¬ducials. Notice that the coordinate transformation changes from a unit transformation (no rotation, no origin translation) to a one determined by the identiļ¬ed landmark locations. The rotation matrix (upper left 3 x 3 part of the transformation) should have positive

MSH-MNE

The sample data set

12

values close to one on the diagonal. Three is a signiļ¬cant rotation around the x axis as indicated by elements (3,2) and (2,3) of the rotation matrix. The x and y values of the translation should be small and the z value should be negative, around -50 mm. An example of an ini-

tial coordinate transformation is shown in Figure 12.1.

10.Make the Digitzer data again visible from the options of the viewer window. Note that the points are now much coloser to the scalp surface.

MSH-MNE

Figure 12.1 Example of an initial coordinate alignment.

12.11.2 Refining the coordinate transformation

Before proceeding to the reļ¬nement procedure, it is useful to remove outlier digitizer points. When you rotate the image in the viewer window, you will notice that there is at least one such point over the right cheek. To discard this point:

1. Click on Discard in the Adjust coordinate alignment window.

2. Enter 10 for the distance of the points to be discarded.

3. Click done. The outlier point disappears.

The coordinate transformation can be adjusted manually with the arrow buttons in the middle part of the Adjust coordinate alignment dialog.

These buttons move the digitizer points in the directions indicated by the amount listed next to each of the buttons.

An automatic iterative procedure, Iterative Closest Point (ICP) matching is also provided. At each iteration step

1. For each digitizer point, transformed from MEG to the MRI coordinate frame, the closest point on the triangulated surface is determined.

2. The best coordinate transformation aligning the digitizer points with the closest points on the head surface is computed.

299

12

The sample data set

In step 2 of the iteration, the nasion is assigned ļ¬ve times the weight of the other points since it can be assumed that the nasion is the easiest point to identify reliably from the surface image.

The ICP alignment can be invoked by entering the desired number of iterations next to the ICP align button followed by return or simply pressing the ICP align button. The iteration will converge in 10 to 20 steps.

Warning: Use the ICP alignment option in mne_analyze with caution.

The iteration will not converge to a reasonable solution unless and initial

alignment is performed ļ¬rst according to Section 12.11.1. Outlier points

should be excluded as described above. No attempt is made to compensate for the possible distance of the digitized EEG electrode locations from the scalp.

300

12.11.3 Saving the transformation

To create a MRI ļ¬f description ļ¬le which incorporates the coordinate transformation click Save MRI set in the Adjust coordinate alignment dialog. This will create the MRI set ļ¬le in the $SUBJECTS_DIR/sample/mri/T1-neuromag/sets

directory, which was created by

mne_setup_mri_data, see Section 12.5.1. The ļ¬le will be called

COR-

<username>-<date>-<time>.ļ¬f where <username> is your login name.

You can also save transformation to a ļ¬f ļ¬le through the Save... button. If the ļ¬le does not exist, it will only contain the coordinate transformation. If the ļ¬le exists it will be inserted to the appropriate context. An existing transformation will not be replaced unless Overwrite existing transform is checked in the save dialog.

Once you have saved the coordinate transformation, press Done and quit

mne_analyze (File/Quit).

Important: If you dismiss the alignment dialog before saving the transformation, it will be lost.

12.12 The forward solution

To compute the forward solution, say: cd $SAMPLE/MEG/sample mne_do_forward_solution --mindist 5 \

--spacing oct-6 --meas sample_audvis-ave.fif

MSH-MNE

MSH-MNE

The sample data set

12

This produces an EEG and MEG forward solution with source space points closer than 5 mm to the inner skull surface omitted. The source

space created in Section 12.5.2 will be employed. As the output from this

command will indicate The forward solution will be stored in ļ¬le sample_audvis-ave-oct-6-fwd.fif

.

This command uses the three-layer BEM model sample-5120-5120-

5120-bem-sol.fif

created in Section 12.5.3. If you want to use the

single-compartment BEM sample-5120-bem-sol.fif usable for

MEG data only say: cd $SAMPLE/MEG/sample mne_do_forward_solution --mindist 5 \

--spacing oct-6 --meas sample_audvis-ave.fif \

--bem sample-5120 --megonly

12.13 The inverse operator decomposition

The inverse operator information, necessary for the computation of the

MNEs and dSPMs is accomplished by the command: mne_do_inverse_operator \

--fwd sample_audvis-ave-oct-6-fwd.fif \

--depth --loose 0.2 --meg --eeg

This produces a depth-weighted inverse operator decomposition with

‘loose’ orientation constraint applied. More details on the convenience

script mne_do_inverse_operator are provided in Section 3.13.

The above command employs both EEG and MEG data. To create separate solution for EEG and MEG, run the commands: mne_do_inverse_operator \

--fwd sample_audvis-ave-oct-6-fwd.fif \

--depth --loose 0.2 --meg and mne_do_inverse_operator \

--fwd sample_audvis-ave-oct-6-fwd.fif \

--depth --loose 0.2 --eeg

Note: If you were using a single-compartment BEM to compute the forward solution, you can only compute the MEG inverse operator.

301

12

The sample data set

12.14 Interactive analysis

The most exciting part of this exercise is to explore the data and the current estimates in mne_analyze. This section contains some useful steps to get you started. A lot of information about the capabilities of mne_analyze

is given in Chapter 7. Batch-mode processing with mne_make_movie is

discussed in Section 6.5. Cross-subject averaging is covered in Chapter 8.

Before launching mne_analyze it is advisable to go to the directory MEG/ sample

. The current working directory can be also changed from

mne_analyze.

12.14.1 Getting started

Launch mne_analyze. Select Help/On GLX..., which brings up a window containing Open GL rendering context information. If ļ¬rst line in the information dialog that pops up says Nondirect rendering context instead of Direct rendering context you will experience slow graphics performance. To ļ¬x this, your system software, graphics adapter or both need to be updated. Consult a computer support person for further information.

12.14.2 Load surfaces

It is reasonable to start the analysis by loading the display surfaces: choose the inļ¬‚ated surface for subject sample from the dialog that appears when you select File/Load surface....

12.14.3 Load the data

Select File/Open.... Select sample_audvis-ave.fif as your data ļ¬le and select the Left auditory data set. Select the inverse operator sample_audvis-ave-oct-6-meg-eeg-inv.fif

and press OK.

After a while the signals appear in the sample waveform and topographical displays. Click on the N100m peak in the auditory response. A dSPM map appears in the main surface display.

12.14.4 Show field and potential maps

Select Windows/Show viewer.... After a while the viewer window appears.

Click on the N100m peak again. Once the ļ¬eld map preparation computations are complete, the magnetic ļ¬eld and potential maps appear. Investi-

gate the viewer window options with help of Section 7.10.

302 MSH-MNE

MSH-MNE

The sample data set

12

12.14.5 Show current estimates

The options affecting the current estimates are accessible from Adjust/

Estimate parameters...

. With help of Section 7.12, investigate the effects

of the parameter settings.

12.14.6 Labels and timecourses

While in directory MEG/sample, create a directory called label: mkdir label

Using the information in Section 7.13.4 create two labels: A-lh.label

and A-rh.label in the approximate location of the left and right auditory cortices. Save these labels in the newly created label directory.

Load all labels from the label directory and investigate the timecourses in these two labels as well as at invidual vertices. Information on label

processing can be found from Section 7.13.

12.14.7 Morphing

Goto to $SUBJECTS_DIR and create the directory morph-maps. Load the inļ¬‚ated surface for subject morph as the morphing surfaces. Try switching between the original and morphing surfaces. More information

about morphing is available in Section 7.9 and in Chapter 8.

There is also a left-hemisphere occipital patch ļ¬le available for subject

morph. Load a righ-hemiļ¬eld visual response instead of the auditory one and investigate mapping of the current estimates on the patch.

303

12

The sample data set

304 MSH-MNE

13

C H A P T E R 1 3

Useful reading

13.1 General MEG reviews

M. Hämäläinen, R. Hari, R. Ilmoniemi, J. Knuutila, and O. V. Lounasmaa,

"Magnetoencephalography – theory, instrumentation, and applications to noninvasive studies of the working human brain," Reviews of Modern

Physics, vol. 65, pp. 413-497, 1993.

S. Baillet, J. C. Mosher, and R. M. Leahy, "Electromagnetic Brain Mapping," IEEE Signal Processing Magazine, vol. 18, pp. 14 - 30, 2001.

M. Hämäläinen and R. Hari, "Magnetoencephalographic Characterization of Dynamic Brain Activation: Basic Principles and Methods of Data Collection and Source Analysis," in Brain mapping : the methods, A. W. Toga and J. C. Mazziotta, Eds. Amsterdam ; Boston: Academic Press, 2002.

13.2 Cortical surface reconstruction and morphing

A. M. Dale, B. Fischl, and M. I. Sereno, "Cortical surface-based analysis.

I. Segmentation and surface reconstruction," Neuroimage, vol. 9, pp. 179-

94., 1999.

B. Fischl, M. I. Sereno, and A. M. Dale, "Cortical surface-based analysis.

II: Inļ¬‚ation, ļ¬‚attening, and a surface-based coordinate system," Neuroimage, vol. 9, pp. 195-207., 1999.

B. Fischl, M. I. Sereno, R. B. Tootell, and A. M. Dale, "High-resolution intersubject averaging and a coordinate system for the cortical surface,"

Hum Brain Mapp, vol. 8, pp. 272-84, 1999.

13.3 Forward modeling

M. S. Hämäläinen and J. Sarvas, "Realistic conductivity geometry model of the human head for interpretation of neuromagnetic data," IEEE Trans.

Biomed. Eng., vol. BME-36, pp. 165-171, 1989.

MSH-MNE 305

13

Useful reading

B. Fischl, D. H. Salat, A. J. van der Kouwe, N. Makris, F. Segonne, B. T.

Quinn, and A. M. Dale, "Sequence-independent segmentation of magnetic resonance images," Neuroimage, vol. 23 Suppl 1, pp. S69-84, 2004.

F. Segonne, A. M. Dale, E. Busa, M. Glessner, D. Salat, H. K. Hahn, and

B. Fischl, "A hybrid approach to the skull stripping problem in MRI,"

Neuroimage, vol. 22, pp. 1060-75, Jul 2004.

J. Jovicich, S. Czanner, D. Greve, E. Haley, A. van der Kouwe, R. Gollub,

D. Kennedy, F. Schmitt, G. Brown, J. Macfall, B. Fischl, and A. Dale,

"Reliability in multi-site structural MRI studies: effects of gradient nonlinearity correction on phantom and human data," Neuroimage, vol. 30, pp. 436-43, 2006.

J. C. Mosher, R. M. Leahy, and P. S. Lewis, "EEG and MEG: forward solutions for inverse methods," IEEE Trans Biomed Eng, vol. 46, pp. 245-

59, 1999.

13.4 Signal-space projections

C. D. Tesche, M. A. Uusitalo, R. J. Ilmoniemi, M. Huotilainen, M. Kajola, and O. Salonen, "Signal-space projections of MEG data characterize both distributed and well-localized neuronal sources," Electroencephalogr Clin

Neurophysiol, vol. 95, pp. 189-200, 1995.

M. A. Uusitalo and R. J. Ilmoniemi, "Signal-space projection method for separating MEG or EEG into components," Med Biol Eng Comput, vol.

35, pp. 135-40, 1997.

13.5 Minimum-norm estimates

M. Hämäläinen and R. Ilmoniemi, "Interpreting magnetic ļ¬elds of the brain: minimum norm estimates," Helsinki University of Technology,

Espoo TKK-F-A559, 1984.

A. Dale and M. Sereno, "Improved localization of cortical activity by combining EEG and MEG with MRI cortical surface reconstruction: A linear approach," J. Cog. Neurosci, vol. 5, pp. 162-176, 1993.

M. S. Hämäläinen and R. J. Ilmoniemi, "Interpreting magnetic ļ¬elds of the brain: minimum norm estimates," Med Biol Eng Comput, vol. 32, pp.

35-42., 1994.

A. M. Dale, A. K. Liu, B. R. Fischl, R. L. Buckner, J. W. Belliveau, J. D.

Lewine, and E. Halgren, "Dynamic statistical parametric mapping: com-

306 MSH-MNE

MSH-MNE

Useful reading

13

bining fMRI and MEG for high-resolution imaging of cortical activity,"

Neuron, vol. 26, pp. 55-67, 2000.

A. K. Liu, A. M. Dale, and J. W. Belliveau, "Monte Carlo simulation studies of EEG and MEG localization accuracy," Hum Brain Mapp, vol. 16, pp. 47-62, 2002.

F. H. Lin, J. W. Belliveau, A. M. Dale, and M. S. Hamalainen, "Distributed current estimates using cortical orientation constraints," Hum Brain

Mapp, 2005.

13.6 fMRI-weighted estimates

A. M. Dale, A. K. Liu, B. R. Fischl, R. L. Buckner, J. W. Belliveau, J. D.

Lewine, and E. Halgren, "Dynamic statistical parametric mapping: combining fMRI and MEG for high-resolution imaging of cortical activity,"

Neuron, vol. 26, pp. 55-67, 2000.

A. K. Liu, J. W. Belliveau, and A. M. Dale, "Spatiotemporal imaging of human brain activity using functional MRI constrained magnetoencephalography data: Monte Carlo simulations," Proc Natl Acad Sci U S A, vol.

95, pp. 8945-50., 1998.

F. H. Lin, T. Witzel, M. S. Hamalainen, A. M. Dale, J. W. Belliveau, and

S. M. Stufļ¬‚ebeam, "Spectral spatiotemporal imaging of cortical oscillations and interactions in the human brain," Neuroimage, vol. 23, pp. 582-

95, 2004.

307

13

Useful reading

308 MSH-MNE

A

A P P E N D I X A

Creating the BEM meshes

MSH-MNE

A.1 Using the watershed algorithm

The watershed algorithm [Segonne et al., 2004] is part of the FreeSurfer software. The name of the program is mri_watershed. Its use in the MNE environment is facilitated by the script mne_watershed_bem, which assumes the following options:

--subject <subject>

Deļ¬nes the name of the subject. This can be also accomplished by setting the SUBJECT environment variable.

--overwrite

Overwrite the results of previous run of mne_watershed_bem.

--atlas

Makes mri_watershed to employ atlas information to correct the segmentation.

After mne_watershed_bem has completed, the following ļ¬les appear in the subject’s bem/watershed directory:

<subject>_brain_surface

Contains the brain surface triangulation.

<subject>_inner_skull_surface

Contains the inner skull triangulation.

<subject>_outer_skull_surface

Contains the outer skull triangulation.

<subject>_outer_skin_surface

Contains the scalp triangulation.

All of these surfaces are in the FreeSurfer format. In addition, there will be a directory called bem/watershed/ws which contains the brain

MRI volume. Furthermore, mne_watershed_bem script converts the scalp surface to ļ¬f format and saves the result to bem/<subject>-head.fif .

The mne_analyze tool described Chapter 7 looks for this ļ¬le the visualiza-

tions involving the scalp surface.

309

A

Creating the BEM meshes

A.2 Using FLASH images

This method depends on the availablily of MRI data acquired with a multi-echo FLASH sequence at two ļ¬‚ip angles (5 and 30 degrees). These data can be acquired separately from the MPRAGE data employed in

FreeSurfer cortical reconstructions but it is strongly recommended that they are collected at the same time with the MPRAGEs or at least with the same scanner. For easy co-registration, the images should have FOV, matrix, slice thickness, gap, and slice orientation as the MPRAGE data.

For information on suitable pulse sequences, see reference [B. Fischl et

al.

and J. Jovicich et al., 2006] in Section 13.3. At the Martinos Center,

use of the 1.5-T Avanto scanner (Bay 2) is recommended for best results.

Creation of the BEM meshes using this method involves the following steps:

1. Organizing the MRI data. This is facilitated by the script

mne_organize_dicom, see Section A.2.1.

2. Creating a synthetic 5-degree ļ¬‚ip angle FLASH volume, register it with the MPRAGE data, and run the segmentation and meshing program. This step is accomplished by running the script mne_ļ¬‚ash_bem,

see Section A.2.2.

3. Inspecting the meshes with tkmedit, see Section A.2.3.

Note: The following sections assume that you have run the appropriate setup scripts to make both MNE and FreeSurfer software available.

A.2.1 Organizing MRI data into directories

Since all images comprising the multi-echo FLASH data are contained in a single series, it is necessary to organize the images according to the echoes before proceeding to the BEM surface reconstruction. This is accomplished by the mne_organize_dicom script, which creates a directory tree with symbolic links to the original DICOM image ļ¬les. To run

mne_organize_dicom, proceed as follows:

1. Copy all of your images or create symbolic links to them in a single directory. The images must be in DICOM format. We will refer to this directory as <source>.

2. Create another directory to hold the output of mne_organize_dicom.

We will refer to this directory as <dest>.

3. Change the working directory to <dest>.

4. Say mne_organize_dicom <source>. Depending on the total number of images in <source> this script may take quite a while to run.

Progress is indicated by listing the number of images processed at 50image intervals.

310 MSH-MNE

Creating the BEM meshes

A

As a result, <dest> will contain several directories named <three-digit

number>

_<protocol_name> corresponding to the different series of images acquired. Spaces and parenthesis in protocol names will be replaced by underscores. Under each of these directories there are one or more directories named <three-digit> number corresponding to one or more subsets of images in this series (protocol). The only subset division scheme implemented in mne_organize_dicom is that according to different echoes, typically found in multi-echo FLASH data. These second level directories will contain symbolic links pointing to the original image data.

Note: mne_organize_dicom was developed speciļ¬cally for Siemens

DICOM data. Its correct behavior with DICOM ļ¬les originating from other MRI scanners has not been veriļ¬ed at this time.

Tip: Since mne_organize_dicom processes all images, not only the

FLASH data, it may be a useful preprocessing step before FreeSurfer reconstruction process as well.

MSH-MNE

A.2.2 Creating the surface tessellations

The BEM surface segmentation and tessellation is automated with the script mne_ļ¬‚ash_bem. It assumes that a FreeSurfer reconstruction for this subject is already in place. To run this utility:

1. Run mne_organize_dicom as described above.

2. Change to the <dest> directory where mne_organize_dicom created the image directory structure.

3. Create symbolic links from the directories containing the 5-degree and

30-degree FLASH series to flash05 and flash30, respectively:

• ln -s <FLASH 5 series dir> flash05

• ln -s <FLASH 30 series dir> flash30

4. Set the SUBJECTS_DIR and SUBJECT environment variables

5. Run mne_ļ¬‚ash_bem.

It may take a while for mne_ļ¬‚ash_bem to complete. It uses the FreeSurfer directory structure under $SUBJECTS_DIR/$SUBJECT. The script encapsulates the following processing steps:

1. It creates an mgz ļ¬le corresponding to each of the eight echoes in each of the FLASH sequences in mri/flash. The ļ¬les will be called mef

<ļ¬‚ip-angle>_<echo-number>.mgz.

2. It creates parameter maps in mri/flash/parameter_maps using

mri_ms_ļ¬tparms.

3. It creates a synthetic 5-degree ļ¬‚ip angle volume in mri/flash/ parameter_maps/flash5.mgz

using mri_synthesize.

4. Using fsl_rigid_register, it creates a registered 5-degree ļ¬‚ip angle volume mri/flash/parameter_maps/flash5_reg.mgz by registering mri/flash/parameter_maps/flash5.mgz to the T1 volume under mri.

311

A

Creating the BEM meshes

5. Using mri_convert, it converts the ļ¬‚ash5_reg volume to COR format under mri/flash5. If necessary, the T1 and brain volumes are also converted into the COR format.

6. It runs mri_make_bem_surfaces to create the BEM surface tessellations.

7. It creates the directory bem/flash, moves the tri-format tringulations there and creates the corresponding FreeSurfer surface ļ¬les in the same directory.

8. The COR format volumes created by mne_ļ¬‚ash_bem are removed.

A.2.3 Inspecting the meshes

It is advisable to check the validity of the BEM meshes before using them.

This can be done with help of tkmedit either before or after executing

mne_setup_forward_model, see Section 3.7.

312

A.3 Using seglab

The brain segmentation provided by FreeSurfer in the directory mri/ brain

can be employed to create the inner skull surface triangulation with help of seglab, the Neuromag MRI segmentation tool. The description below assumes that the user is familiar with the seglab tool. If necessary, consult the seglab manual, Neuromag P/N NM20420A-A.

The data set mri/brain typically contains tissues within or outside the skull, in particular around the eyes. These must be removed manually before the inner skull triangulation is created.The editing and triangulation can be accomplished as outlined below

1. Set up the MRIs for Neuromag software access

Run the mne_setup_mri too as described in Section 3.4. As a result,

the directories mri/T1-neuromag and mri/brain-neuromag are set up.

2. Load the MRI data

Open the ļ¬le mri/brain-neuromag/sets/COR.ļ¬f and adjust the scaling of the data.

3. Preparatory steps

Set the minimum data value to 1 using the min3D operator. Make a backup of the data with the backup3D operator.

4. Manual editing

The maskDraw3D operation is recommended for manual editing. To use it, ļ¬rst employ the grow3D operator with threshold interval

2…255 and the seed point inside the brain. Then do the editing in the slicer window as described in Section 5.4.2 of the seglab man-

MSH-MNE

Creating the BEM meshes

A

ual. Note that it is enough to remove the connectivity to the extracerebral tissues rather than erasing them completely.

5. Grow again and mask

Once manual editing is complete, employ the grow3D operator again and do mask3D with the backup data to see whether the result is satisfactory. If not, undo mask3D and continue manual editing.

Otherwise, undo mask3D and proceed to the next step.

6. Dilation

It is advisable to make the inner skull surface slightly bigger than the brain envelope obtained in the previous step. Therefore, apply the dilate3D operation once or twice. Use the values 1 for nbours and 26 for nhood in the ļ¬rst dilation and 1 and 18 in the second one, respectively.

7. Triangulation

Triangulate the resulting object with the triangulate3D operator.

Use a sidelength of 5 to 6 mm. Check that the triangulation looks reasonable in the 3D viewing window.

8. Save the triangulation

Save the triangulated surface as a mesh into bem/inner_skull.tri.

Select unit of measure as millimeters and employ the MRI coordinate system.

MSH-MNE

A.4 Using BrainSuite

The BrainSuite software running under the Windows operating system can also be used for BEM mesh generation. This software, written by

David W. Shattuck, is distributed as a collaborative project between the

Laboratory of Neuro Imaging at the University of California Los Angeles

(Director: Dr. Arthur W. Toga) and the Biomedical Imaging Research

Group at the University of Southern California (Director: Dr. Richard M.

Leahy). For further information, see http://brainsuite.usc.edu/.

The conversion of BrainSuite tessellation ļ¬les to MNE software compatible formats is accomplished with the mne_convert_surface utility, covered

in Section 9.7.

The workļ¬‚ow needed to employ the BrainSuite tessellations is:

Step 1

Using the mri_convert utility available in FreeSurfer, convert an

MRI volume to the img (Analyze) format. This volume should be the T1.mgz volume or a volume registered with T1.mgz in Free-

Surfer: mri_convert

<volume>.mgz <volume>.img

313

A

Creating the BEM meshes

Step 2

Transfer <volume>.mgz to a location accessible to BrainSuite, running on Windows.

Step 3

Using <volume>.img as input, create the tessellations of scalp, outer skull, and inner skull surfaces in BrainSuite.

Step 4

Transfer the dfs ļ¬les containing the tessellations in the bem directory of your subject’s FreeSurfer reconstruction.

Step 5

Go to the bem directory where you placed the two dfs ļ¬les. Using

mne_convert_surface, convert them to the FreeSurfer surface format, e,g.: mne_convert_surface \

--dfs inner_skull.dfs \

--mghmri ../mri/T1.mgz \

--surf inner_skull_dfs.surf

Step 6

Using tkmedit, check that the surfaces are correct, e.g.: tkmedit -f ../mri/T1.mgz \

-surface inner_skull_dfs.surf

Step7

Using the mne_reduce_surface function in Matlab, reduce the number of triangles on the surfaces to 10000 - 20000. Call the output ļ¬les outer_skin.surf

, outer_skull.surf

, and inner_skull.surf

.

Step 8

Proceed to mne_setup_forward_model. Use the --surf and -noswap

options.

Note: If left and right are ļ¬‚ipped in BrainSuite, use the --ļ¬‚ip option in

mne_convert_surface to set the coordinate transformation correctly.

Tip: The BrainSuite scalp surface can be also used for visualization in

mne_analyze, see Section 7.16.1.

314 MSH-MNE

B

A P P E N D I X B

Setup at the Martinos Center

This Appendix contains information speciļ¬c to the Martinos Center setup.

B.1 User environment

In the Martinos Center computer network, the present location of <MNE> is /space/orsay/8/megdev/megsw. For deļ¬nition of <MNE>, see

Section 2.4. The most up to date development version is available at /

space/orsay/8/megdev/megsw-dev

. The previous release of the software is available at /space/orsay/8/megdev/megsw-prev.

Most users at the Martinos Center use tcsh as their login shell.

B.2 Using Neuromag software

B.2.1 Software overview

The complete set of Neuromag software is available on the LINUX workstations. The programs can be accessed from the command line, see

Table B.1. The corresponding manuals, located at $NEUROMAG_ROOT/

manuals

are listed in Table B.2.

Module

xļ¬t xplotter graph mrilab seglab cliplab

Description

Source modelling

Data plotting

General purpose data processor

MEG-MRI integration

MRI segmentation

Graphics clipboard

Table B.1 Principal Neuromag software modules.

MSH-MNE 315

B

Setup at the Martinos Center

Module pdf

xļ¬t XFit.pdf

xplotter Xplotter.pdf

graph GraphUsersGuide.pdf

GraphReference.pdf

mrilab seglab cliplab

Mrilab.pdf

Seglab.pdf

Cliplab.pdf

Table B.2 List of Neuromag software manuals.

To access the Neuromag software on the LINUX workstations in the Martinos Center, say (in tcsh or csh) source /space/orsay/8/megdev/Neuromag-LINUX/ neuromag_setup_csh or in POSIX shell

. /space/orsay/8/megdev/Neuromag-LINUX/ neuromag_setup_sh

B.2.2 Using MRIlab for coordinate system alignment

The MEG-MRI coordinate system alignment can be also accomplished with the Neuromag tool MRIlab, part of the standard software on Neuromag MEG systems.

In MRIlab, the following steps are necessary for the coordinate system alignment:

1. Load the MRI description ļ¬le COR.fif from subjects/sample/ mri/T1-neuromag/sets

through File/Open.

2. Open the landmark setting dialog from Windows/Landmarks.

3. Click on one of the coordinate setting ļ¬elds on the Nasion line. Click

Goto . Select the crosshair tool and move the crosshair to the nasion.

Click Get.

4. Proceed similarly for the left and right auricular points. Your instructor will help you with the selection of the correct points.

5. Click OK to set the alignment

6. Load the digitization data from the ļ¬le sample_audvis_raw.fif

or sample_audvis-ave.fif (the on-line evoked-response average ļ¬le) in MEG/sample through File/Import/Isotrak data. Click

Make points to show all the digitization data on the MRI slices.

316 MSH-MNE

MSH-MNE

Setup at the Martinos Center

B

7. Check that the alignment is correct by looking at the locations of the digitized points are reasonable. Adjust the landmark locations using the

Landmarks dialog, if necessary.

8. Save the aligned ļ¬le to the ļ¬le suggested in the dialog coming up from

File/Save.

B.3 Mature software

This Section contains documentation for software components, which are still available in the MNE software but have been replaced by new programs.

B.3.1 mne_compute_mne

This chapter contains information about the options accepted by the program mne_compute_mne, which is gradually becoming obsolete. All of its functions will be eventually included to mne_make_movie, see

Section 6.5. At this time, mne_compute_mne is still needed to produce

time-collapsed w ļ¬les unless you are willing to write a Matlab script of your own for this purpose.

mne_compute_mne accepts the following command-line options:

--version

Show the program version and compilation date.

--help

List the command-line options.

--inv <name>

Load the inverse operator decomposition from here.

--meas <name>

Load the MEG or EEG data from this ļ¬le.

--set <number>

The data set (condition) number to load. The list of data sets can be seen, e.g., in mne_analyze, mne_browse_raw, and xplotter.

--bmin <time/ms>

Speciļ¬es the starting time of the baseline. In order to activate baseline correction, both --bmin and --bmax options must be present.

--bmax <time/ms>

Speciļ¬es the ļ¬nishing time of the baseline.

317

B

Setup at the Martinos Center

--nave <value>

Speciļ¬es the number of averaged epochs in the input data. If the input data ļ¬le is one produced by mne_process_raw or

mne_browse_raw, the number of averages is correct in the ļ¬le.

However, if subtractions or some more complicated combinations of simple averages are produced, e.g., by using the xplotter software, the number of averages should be manually adjusted. This is accomplished either by employing this ļ¬‚ag or by adjusting the number of averages in the data ļ¬le with help of mne_change_nave.

--snr <value>

An estimate for the amplitude SNR. The regularization parameter will be set as

λ

=

. If the SNR option is absent, the regularization parameter will be estimated from the data. The regularization parameter will be then time dependent.

--snronly

Only estimate SNR and output the result into a ļ¬le called SNR.

Each line of the ļ¬le contains three values: the time point in ms, the estimated SNR + 1, and the regularization parameter estimated from the data at this time point.

--abs

Calculate the absolute value of the current and the dSPM for ļ¬xedorientation data.

--spm

Calculate the dSPM instead of the expected current value.

--chi2

Calculate an approximate

χ

2

3

statistic instead of the F statistic. This is simply accomplished by multiplying the F statistic by three.

--sqrtF

Take the square root of the

χ

3

or F statistic before outputting the stc ļ¬le.

2

--collapse

Make all frames in the stc ļ¬le (or the wļ¬le) identical. The value at each source location is the maximum value of the output quantity at this location over the analysis period. This option is convenient for determining the correct thresholds for the rendering of the ļ¬nal brain-activity movies.

--collapse1

Make all frames in the stc ļ¬le (or the wļ¬le) indentical. The value at each source location is the

L

1

norm of the output quantity at this location over the analysis period.

318 MSH-MNE

MSH-MNE

Setup at the Martinos Center

B

--collapse2

Make all frames in the stc ļ¬le (or the wļ¬le) identical. The value at each source location is the

L

2

norm of the output quantity at this location over the analysis period.

--SIcurrents

Output true current values in SI units (A/m). By default, the currents are scaled so that the maximum current value is set to 50 (Am).

--out <name>

Speciļ¬es the output ļ¬le name. This is the ‘stem’ of the output file name. The actual name is derived by removing anything up to and including the last period from the end of <name>. According to the hemisphere, -lh or -rh is then appended. Finally, .stc or .w is added, depending on the output ļ¬le type.

--wļ¬les

Use binary w-ļ¬les in the output whenever possible. The noise-normalization factors can be always output in this format. The current estimates and dSPMs can be output as wļ¬les if one of the collapse options is selected.

--pred <name>

Save the predicted data into this ļ¬le. This is a ļ¬f ļ¬le containing the

predicted data waveforms, see Section 6.2.7.

--outputnorm <name>

Output noise-normalization factors to this ļ¬le.

--invnorm

Output inverse noise-normalization factors to the ļ¬le deļ¬ned by the

--outputnorm

option.

--dip <name>

Speciļ¬es a dipole distribution snapshot ļ¬le. This is a ļ¬le containing the current distribution at a time speciļ¬ed with the --diptime option. The ļ¬le format is the ASCII dip ļ¬le format produced by the

Neuromag source modelling software (xļ¬t). Therefore, the ļ¬le can be loaded to the Neuromag MRIlab MRI viewer to display the actual current distribution. This option is only effective if the -spm

option is absent.

--diptime <time/ms>

Time for the dipole snapshot, see --dip option above.

--label <name>

Label to process. The label ļ¬les are produced by tksurfer and specify regions of interests (ROIs). A label ļ¬le name should end with lh.label

for left-hemisphere ROIs and with -rh.label for right-hemisphere ones. The corresponding output ļ¬les are tagged

319

B

Setup at the Martinos Center with -lh-<data type.amp and -rh-<data type.amp , respectively. <data type> equals MNE for expected current data and spm for dSPM data. Each line of the output ļ¬le contains the waveform of the output quantity at one of the source locations falling inside the

ROI.

Note: The --tmin and --tmax options which existed in previous versions of mne_compute_mne have been removed. mne_compute_mne can now process only the entire averaged epoch.

320 MSH-MNE

C

A P P E N D I X C

Installation and configuration

The MNE software is distributed as a compressed tar archive. This

Appendix describes the steps needed to install the software.

C.1 Installation

C.1.1 Create a directory to hold the software

Select a location for the MNE software. This most probably be an NFS ļ¬le system available to all users in your network. Create the directory with the command: mkdir

<MEGswdir>

C.1.2 Unpack the archive

Go to the selected directory and unpack the tar archive: cd

<MEGswdir>

tar zxvf

<name of the tar archive>

C.2 Configuration

C.2.1 Set up a link to Matlab

The Matlab conversion routines make use of libraries distributed with

Matlab. Therefore, a link to the Matlab installation root directory must be provided to the MNE sofware. If you have Matlab available, create the a symbolic link: cd

<MEGswdir>

ln -s

<MATLAB root directory> matlab

If you do not have Matlab available, create a dummy directory:

MSH-MNE 321

C

Installation and configuration cd

<MEGswdir>

mkdir matlab

Should you later acquire Matlab, remove the dummy directory and replace it with the proper symbolic link: cd

<MEGswdir>

rmdir matlab ln -s

<MATLAB root directory> matlab

Note: The utilities mne_convert_mne_data, mne_convert_surface,

mne_raw2mat, and mne_simu require the presence of Matlab software to work.

C.2.2 Run the configuration script

The conļ¬guration of MNE software is accomplished by running a single conļ¬guration script:

<MEGswdir>/mne/bin/admin/mne_setup_mne

Important: The <MEGswdir> must be the absolute path name (starting with /) of the location of the MNE software. If the software was installed on a server, it must be the path name as it will appear to the users accessing the server.

C.2.3 Modify the login scripts

Before using the MNE software the appropriate setup script must be

‘sourced’ to the current shell. This task is discussed in Section 2.4.

C.2.4 Add open source software

The Mac OSX version of the MNE software relies on a few open source library packages. These packages can be installed with ļ¬nk. To install ļ¬nk on your computer, go to http://sourceforge.net/ and look for Fink. There is also a graphical user interface called FinkCommander. The latter is convenient if you want to install open source packages for other purposes. For

MNE, however, it is sufļ¬cient to install Fink.

The necessary packages can be easily accomplished by the script mne_install_packages

, which super-user privileges. To run the script, say: sudo

<MEGswdir>/mne/bin/admin/mne_install_packages

322 MSH-MNE

MSH-MNE

Installation and configuration

C

If you accidentally run this script on a platform other than Mac OSX, nothing happens.

C.2.5 Optional: Remove unnecessary binaries

At present, the MNE software distribution contains binaries and shared libraries for LINUX and Mac OSX platforms. If you are always going to use your installed software on only one of these platforms, you can remove the binary code which is not going to be in use:

1. Source the correct setup script to your shell to get the MNE_ROOT environment variable set correctly.

2. Say $MNE_ROOT/bin/admin/mne_remove_platform <plat-

form>, where <platform> is either darwin or linux depending on whether you want to remove the Mac OSX or LINUX binaries and libraries.

C.2.6 Testing the performance of your OpenGL graphics

The graphics performance of mne_analyze depends on your graphics software and hardware conļ¬guration. You get the best performance if you are using mne_analyze locally on a computer and the hardware acceleration capabilities are in use. You can check the On GLX... item in the help menu of mne_analyze to see whether the hardware acceleration is in effect. If the dialog popping up says Direct rendering context, you are using hardware acceleration. If this dialog indicates Nondirect rendering context, you are either using software emulation locally, rendering to a remote display, or employing VNC connection. If you are rendering to a local display and get an indication of Nondirect rendering context, software emulation is in effect and you should contact your local computer support to enable hardware acceleration for GLX. In some cases, this may require acquiring a new graphics display card. Fortunately, relatively high-performance OpenGL-capable graphics cards can be readily obtained.

There is also an utility mne_opengl_test to assess the graphics performance more quantitatively. This utility renders an inļ¬‚ated brain surface repeatedly, rotating it by 5 degrees around the z axis between redraws. At each revolution, the time spent for the full revolution is reported on the terminal window where mne_opengl_test was started from. The program renders the surface until the interrupt key (usually control-c) is pressed on the terminal window.

mne_opengl_test is located in the bin/admin directory and is thus started as:

$MNE_ROOT/bin/admin/mne_opengl_test

323

C

Installation and configuration

On the fastest graphics cards, the time per revolution is well below 1 second. If this time longer than 10 seconds and hardware accelaration is in effect, you might consider updating your graphics adapter.

C.3 Licensing

Key modules of the MNE software require a valid license to run. The licenses are free; for details of the licensing terms, see, Appendix E.

After you have registered to download the MNE software on our website

(http://www.nmr.mgh.harvard.edu/martinos/userInfo/data/sofMNE.php), you will gain access to the download web site which includes the most recent license ļ¬le called LICENSES. Copy it to <MEGswdir>/mne/ setup/mne/LICENSES

.

The license ļ¬le has a ļ¬nite lifespan. If you have registered to the

mne_analysis mailing list you will receive an email reminder to download an updated license at least two weeks before the expiration date of the current license.

C.4 Obtain FreeSurfer

The MNE software relies on the FreeSurfer software for cortical surface reconstruction and other MRI-related tasks. Please consult the FreeSurfer home page site at http://surfer.nmr.mgh.harvard.edu/.

C.5 How to get started

After you have installed the software, a good place to start is to look at the manual:

• Source the correct setup script, see Section C.2.3, above and

• Say mne_view_manual.

Chapters of interest for a novice user include:

• Chapters 1 and 2 contain introduction to the software and setup instruc-

tions.

• Chapter 3 is an overview of the necessary steps to compute the corti-

cally constrained minimum-norm solutions.

• Chapter 12 is a hands-on exercise demonstrating analysis of the sample

data set.

• Chapter 13 contains a list of useful references for understanding the

methods implemented in the MNE software.

324 MSH-MNE

D

A P P E N D I X D

Release notes

This appendix contains a brief description of the changes in MNE software in each major release.

D.1 Release notes for MNE software 2.4

D.1.1 Manual

The manual has been signiļ¬cantly expanded and reorganized. Chapter 7

describing mne_analyze has been added. Chapter 12 contains instructions

for analyzing the sample data set provided with the software. Useful back-

ground material is listed in Chapter 13. Almost all utility programs are

now covered in the manual.

D.1.2 General software changes

The following overall changes have been made:

1. A forward solution library independent of Neuromag software was written.

2. The MEG sensor information is now imported from the coil deļ¬nition ļ¬le instead of being hardcoded in the software. For details, see

Section 5.8.4.

3. CTF and 4D Neuroimaging sensors are now supported.

4. The number of Neuromag-based utilities was minimized.

5. The LINUX port of Neuromag software modules was completely separated from the MNE software and now resides under a separate directory tree.

6. Support for topologically connected source spaces was added, see

Section 3.5.

7. A lot of bugs were ļ¬xed.

D.1.3 File conversion utilities

The following import utilities were added:

MSH-MNE 325

D

Release notes

1. mne_ctf2ļ¬ff to convert CTF data to the ļ¬f format, see Section 9.2.2.

2. mne_tufts2ļ¬ff to convert EEG data from Tufts university to ļ¬f format,

see Section 9.2.9.

The output of the Matlab conversion utilities was changed to use struc-

tures. For details, see Sections 9.12, 9.7, and 9.13.

Matlab tools to import and export w and stc ļ¬les were added.

D.1.4 mne_browse_raw

Output of decimated and ļ¬ltered data is now available. mne_analyze now fully supports 32-bit integer data found in CTF and new Neuromag raw data ļ¬les.

D.1.5 mne_analyze

The following changes have been made in mne_analyze:

1. Curved and ļ¬‚at surface patches are now supported.

2. An iterative coordinate alignment procedure was added, see Section

7.16.

3. Utility to view continuous HPI information was added, see

Section 7.17.

4. Several small changes and bug ļ¬xes were done.

D.1.6 mne_make_movie

The only major change in mne_make_movie is the addition of support for curved and surface patches.

D.1.7 Averaging

The highly inefļ¬cient program mne_grand_average has been removed from the distribution and replaced with the combined use of

mne_make_movie and a new averaging program mne_average_estimates,

see Section 8.6.

326

D.2 Release notes for MNE software 2.5

D.2.1 Manual

The MNE Matlab toolbox is now covered in a separate chapter. Change bars are employed to indicate changes in the chapters that existed in the

MSH-MNE

MSH-MNE

Release notes

D

previous version of the manual. Note that Chapter 10 describing the Mat-

lab toolbox is totally new and change bars have not been used there. Fur-

thermore, Appendix B now contains all the information speciļ¬c to the

Martinos Center.

D.2.2 mne_browse_raw

There are several improvements in the raw data processor

mne_browse_raw/mne_process_raw:

• Possibility to delete and add channel selections interactively has been added. A nonstandard channel selection ļ¬le can be now speciļ¬ed on the command line.

• Handling of CTF software gradient compensation has been added.

• The vertical scale of the digital trigger channel is now automatically set to accommodate the largest trigger value.

• It is now possible to load evoked-response data sets from ļ¬les. Time scales of the evoked-response data and data averaged in

mne_browse_raw can be now set from the scales dialog. Section 12.9

in Chapter 12 has been updated to employ mne_browse_raw in view-

ing the averages computed from the sample raw data set.

• It is now possible to create new SSP operators in mne_browse_raw, see

Section 4.6.4.

• Listing of amplitude values have been added to both the strip-chart and topographical displays.

• Text format event ļ¬les can now be loaded for easy inspection of rejected epochs, for example.

• Handling of derived channels has been added, see Sections 4.4.12 and

11.5.

• SSS information is now transferred to the covariance matrix output ļ¬les.

• Neuromag processing history is included with the output ļ¬les.

D.2.3 mne_epochs2mat

This new utility extracts epochs from a raw data ļ¬le, applies a bandpass ļ¬lter to them and outputs them in a format convenient for processing in

Matlab, see Section 9.14.

D.2.4 mne_analyze

The following new features have been added:

327

D

Release notes

1. Processing of raw data segment and easy switching between multiple evoked data sets (not in the manual yet).

2. Sketchy surface display mode for source spaces with selection triangulation information created with the --ico option to

mne_setup_source_space.

3. Rotation of the coordinate frame in the coordinate system alignment

dialog, see Section 7.16;

4. Several new graphics output ļ¬le formats as well as automatic and snap-

shot output modes, see Section 7.8.8.

5. It is now possible to inquire timecourses from stc overlays. Both labels and surface picking are supported.

6. Added an option to include surface vertex numbers to the timecourse

output, see Section 7.13.3.1.

7. Overlays matching the scalp surface can now be loaded, see

Section 7.14.

8. The dipole display dialog has now control over the dipole display prop-

erties. Multiple dipoles can be now displayed, see Section 7.15.3.

9. Time stepping with cursor keys has been added.

10.Dynamic cursors have been added to the full view display.

11.The viewer display now automatically rotates to facilitate ļ¬ducial picking from the head surface.

D.2.5 mne_ctf2fiff

Correct errors in compensation channel information and compensation data output. The transformation between the CTF and Neuromag coordinate frames is now included in the output ļ¬le.

D.2.6 mne_make_movie

Added the --labelverts option, see Section 6.5.8.

D.2.7 mne_surf2bem

Added the --shift option to move surface vertices outwards. Fixed some loopholes in topology checks. Also added the --innershift option to mne_setup_forward_model. For more information, see Sections

3.7 and 5.6.

D.2.8 mne_forward_solution

Added code to compute forward solutions for CTF data with software gradient compensation on.

328 MSH-MNE

MSH-MNE

Release notes

D

D.2.9 mne_inverse_operator

The following changes have been made in mne_inverse_operator:

• Added options to regularize the noise-covariance matrix.

• Added correct handling of the rank-deļ¬cient covariance matrix resulting from the use of SSS.

• Additional projections cannot be speciļ¬ed if the noise covariance matrix was computed with projections on.

• Bad channels can be added only in special circumstances if the noise covariance matrix was computed with projections on.

D.2.10 mne_compute_raw_inverse

This utility is now documented in Section 6.6. The utility

mne_make_raw_inverse_operator has been removed from the software.

D.2.11 Time range settings

The tools mne_compute_raw_inverse, mne_convert_mne_data, and

mne_compute_mne no longer have command-line options to restrict the time range of evoked data input.

D.2.12 mne_change_baselines

It is now possible to process all data sets in a ļ¬le at once. All processed data are stored in a single output ļ¬le.

D.2.13 New utilities

D.2.13.1 mne_show_fiff

Replacement for the Neuromag utility show_ļ¬ff. This utility conforms to the standard command-line option conventions in MNE software. For

details, see Section 11.3.

D.2.13.2 mne_make_cor_set

Replaces the functionality of the Neuromag utility create_mri_set_simple to create a ļ¬f format description ļ¬le for the FreeSurfer MRI data. This utility is called by the mne_setup_mri script.

329

D

Release notes

330

D.2.13.3 mne_compensate_data

This utility applies or removes CTF software gradient compensation from

evoked-response data, see Section 9.2.4.

D.2.13.4 mne_insert_4D_comp

This utility merges 4D Magnes compensation data from a text ļ¬le and the main helmet sensor data from a ļ¬f ļ¬le and creates a new ļ¬f ļ¬le

Section 9.2.5.

D.2.13.5 mne_ctf_dig2fiff

This utility reads a text format Polhemus data ļ¬le, transforms the data into the Neuromag head coordinate system, and outputs the data in ļ¬f or hpts format.

D.2.13.6 mne_kit2fiff

The purpose of this new utility is to import data from the KIT MEG sys-

tem, see Section 9.2.7.

D.2.13.7 mne_make_derivations

This new utility will take derivation data from a text ļ¬le and convert it to

ļ¬f format for use with mne_browse_raw, see Section 11.5.

D.2.14 BEM mesh generation

All information concerning BEM mesh generation has been moved to

Appendix A. Utilities for BEM mesh generation using FLASH images

have been added, see Section A.2.

D.2.15 Matlab toolbox

The MNE Matlab toolbox has been signiļ¬cantly enhanced. New features include:

• Basic routines for reading and writing ļ¬f ļ¬les.

• High-level functions to read and write evoked-response ļ¬f data.

• High-level functions to read raw data.

• High-level routines to read source space information, covariance matrices, forward solutions, and inverse operator decompositions directly from ļ¬f ļ¬les.

MSH-MNE

MSH-MNE

Release notes

D

The Matlab toolbox is documented in Chapter 10.

The mne_div_w utility has been removed because it is now easy to perform its function and much more using the Matlab Toolbox.

D.3 Release notes for MNE software 2.6

D.3.1 Manual

The changes described below brieļ¬‚y are documented in the relevant sections of the manual. Change bars are employed to indicate changes with

respect to manual version 2.5. Chapter 5 now contains a comprehensive

discussion of the various coordinate systems used in MEG/EEG data.

D.3.2 Command-line options

All compiled C programs now check that the command line does not contain any unknown options. Consequently, scripts that have inadvertently speciļ¬ed some options which are invalid will now fail.

D.3.3 Changes to existing software

D.3.3.1 mne_add_patch_info

• Changed option --in to --src and --out to --srcp.

• Added --labeldir option.

D.3.3.2 mne_analyze

New features include:

• The name of the digital trigger channel can be speciļ¬ed with the

MNE_TRIGGER_CH_NAME environment variable.

• Using information from the ļ¬f data ļ¬les, the wall clock time corresponding to the current ļ¬le position is shown on the status line

mne_analyze can now be controlled by mne_browse_raw to facilitate interactive analysis of clinical data.

• Added compatibility with Elekta-Neuromag Report Composer (cliplab and improved the quality of hardcopies.

• Both in mne_browse_raw and in mne_analyze, a non-standard default

layout can be set on a user-by-user basis, see Section 4.5.6.

• Added the --digtrigmask option.

• Added new image rotation functionality using the mouse wheel or trackball.

331

D

Release notes

332

• Added remote control of the FreeSurfer MRI viewer (tkmedit), see

Section 7.18.

• Added ļ¬tting of single equivalent current dipoles and channel selec-

tions, see Section 7.15.

• Added loading of FreeSurfer cortical parcellation data as labels.

• Added support for using the FreeSurfer average brain (fsaverage) as a surrogate.

• The surface selection dialog was redesigned for faster access to the ļ¬les and to remove problems with a large number of subjects.

• A shortcut button to direct a ļ¬le selector to the appropriate default directory was added to several ļ¬le loading dialogs.

• The vertex coordinates can now be displayed, see Section 7.8.4.

D.3.3.3 mne_average_forward_solutions

EEG forward solutions are now averaged as well, see Section 5.10.

D.3.3.4 mne_browse_raw and mne_process_raw

Improvements in the raw data processor mne_browse_raw/

mne_process_raw include:

• The name of the digital trigger channel can be speciļ¬ed with the

MNE_TRIGGER_CH_NAME environment variable.

• The format of the text event ļ¬les was slightly changed. The sample numbers are now “absolute” sample numbers taking into account the initial skip in the event ļ¬les. The new format is indicated by an additional “pseudoevent” in the beginning of the ļ¬le. mne_browse_raw and

mne_process_raw are still compatible with the old event ļ¬le format.

For details, see Section 4.10.5.

• Using information from the ļ¬f data ļ¬les, the wall clock time corresponding to the current ļ¬le position is shown on the status line

mne_browse_raw can now control mne_analyze to facilitate interactive analysis of clinical data.

• If the length of an output raw data ļ¬le exceeds the 2-Gbyte ļ¬f ļ¬le size limit, the output is split into multiple ļ¬les.

• -split and --events options was added to mne_process_raw.

• The --allowmaxshield option was added to mne_browse_raw to allow loading of unprocessed data with MaxShield in the Elekta-Neuromag systems. These kind of data should never be used as an input for source localization.

• The --savehere option was added, see Section 4.2.3.

• The stderr parameter was added to the averaging deļ¬nition ļ¬les, see

Section 4.13.3.

• Added compatibility with Elekta-Neuromag Report Composer (cliplab and improved the quality of hardcopies.

• Both in mne_browse_raw and in mne_analyze, a non-standard default

layout can be set on a user-by-user basis, see Section 4.5.6.

MSH-MNE

MSH-MNE

Release notes

D

mne_browse_raw now includes an interactive editor to create derived

channels, see Section 4.5.4.

• The menus in mne_browse_raw were reorganized and an time point speciļ¬cation text ļ¬eld was added

• Possibility to keep the old projection items added to the new projection deļ¬nition dialog.

• Added --cd option.

• Added ļ¬lter buttons for raw ļ¬les and Maxļ¬lter™ output to the open dialog.

• Added possibility to create a graph-compatible projection to the Save

projection

dialog

• Added possibility to compute a projection operator from epochs speciļ¬ed by events.

• Added the keepsamplemean option to the covariance matrix computation ļ¬les.

• Added the --digtrigmask option.

• Added Load channel selections... item to the File menu.

• Added new browsing functionality using the mouse wheel or trackball,

see Section 4.9.1.

• Added optional items to the topographical data displays, see

Section 4.5.2.

• Added an event list window, see Section 4.10.2.

• Added an annotator window, see Section 4.10.4.

• Keep events sorted by time.

• User-deļ¬ned events are automatically kept in a ļ¬f-format annotation

ļ¬le, see Section 4.10.

• Added the delay parameter to the averaging and covariance matrix esti-

mation description ļ¬les, see Sections 4.13.3 and 4.14.3.

Detailed information on these changes can be found in Chapter 4.

D.3.3.5 mne_compute_raw_inverse

The --digtrig, --extra, --noextra, --split, --labeldir,

and --out options were added, see Section 6.6.

D.3.3.6 mne_convert_surface

The functionality of mne_convert_dfs was integrated into

mne_convert_surface. Text output as a triangle ļ¬le and and ļ¬le ļ¬le containing the list of vertex points was added. The Matlab output option was removed. Consequently, mne_convert_dfs, mne_surface2mat, and

mne_list_surface_nodes were deleted from the distribution.

D.3.3.7 mne_dump_triggers

This obsolete utility was deleted from the distribution.

333

D

Release notes

D.3.3.8 mne_epochs2mat

The name of the digital trigger channel can be speciļ¬ed with the

MNE_TRIGGER_CH_NAME environment variable, see Section 9.14.

Added the --digtrigmask option.

D.3.3.9 mne_forward_solution

Added code to compute the derivatives of with respect to the dipole posi-

tion coordinates, see Section 5.9.

D.3.3.10 mne_list_bem

The --surfno option is replaced with the --id option, see Section 9.6.

D.3.3.11 mne_make_cor_set

Include data from mgh/mgz ļ¬les to the output automatically. Include the

Talairach transformations from the FreeSurfer data to the output ļ¬le if

possible. For details, see Section 9.8.

D.3.3.12 mne_make_movie

Added the --noscalebar, --nocomments, --morphgrade, --rate, and --pick-

range options, see Section 6.5.

D.3.3.13 mne_make_source_space

The --spacing option is now implemented in this program, which means mne_mris_trix is now obsolete. The mne_setup_source_space script was modiļ¬ed accordingly. Support for tri, dec, and dip ļ¬les was

dropped, see Section 5.4.

D.3.3.14 mne_mdip2stc

This utility is obsolete and was removed from the distribution.

D.3.3.15 mne_project_raw

This is utility is obsolete and was removed from the distribution. The functionality is included in mne_process_raw.

334 MSH-MNE

Release notes

D

D.3.3.16 mne_rename_channels

Added the --revert option, see Section 11.4.5.

D.3.3.17 mne_setup_forward_model

Added the --outershift and --scalpshift options, see

Section 3.7.

D.3.3.18 mne_simu

Added source waveform expressions and the --raw option, see

Section 11.13.

D.3.3.19 mne_transform_points

Removed the --tomrivol option.

MSH-MNE

D.3.3.20 Matlab toolbox

Several new functions were added, see Chapter 10.

Important: The matlab function ļ¬ff_setup_read_raw has a signiļ¬cant change. The sample numbers now take into account possible intial skip in the ļ¬le, i.e., the time between the start of the data acquisition and the start of saving the data to disk. The ļ¬rst_samp member of the returned structure indicates the initial skip in samples. If you want your own routines, which assume that initial skip has been removed, perform indentically with the previous version, subtract ļ¬rst_samp from the sample numbers you specify to ļ¬ff_read_raw_segment. Furthermore, ļ¬ff_setup_read_raw has an optional argument to allow reading of unprocessed MaxShield data acquired with the Elekta MEG systems.

D.3.4 New utilities

D.3.4.1 mne_collect_transforms

This utility collects coordinate transformation information from several

sources into a single ļ¬le, see Section 9.9.

D.3.4.2 mne_convert_dig_data

This new utility convertes digitization (Polhemus) data between different

ļ¬le formats, see Section 9.3.

335

D

Release notes

D.3.4.3 mne_edf2fiff

This is a new utility to convert EEG data from EDF, EDF+, and BDF for-

mats to the ļ¬f format, see Section 9.2.8.

D.3.4.4 mne_brain_vision2fiff

This is a new utility to convert BrainVision EEG data to the ļ¬f format, see

Section 9.2.10. This utility is also used by the mne_eximia_2ļ¬ff script to

convert EEG data from the Nexstim eXimia EEG system to the ļ¬f format,

see Section 9.2.11.

D.3.4.5 mne_anonymize

New utility to remove subject identifying information from measurement

ļ¬les, see Section 11.4.7.

D.3.4.6 mne_opengl_test

New utility for testing the OpenGL graphics performance, see

Section C.2.6.

D.3.4.7 mne_volume_data2mri

Convert data deļ¬ned in a volume created with mne_volume_source_space

to an MRI overlay, see Section 9.4.

D.3.4.8 mne_volume_source_space

Create a a grid of source points within a volume, see Section 5.5.

mne_volume_source_space also optionally creates a trilinear interpolator matrix to facilitate converting values a distribution in the volume grid into

an MRI overlay using mne_volume_data2mri, see Section 9.4.

D.3.4.9 mne_copy_processing_history

This new utility copies the processing history block from one data ļ¬le to

another, see Section 11.4.8.

336 MSH-MNE

E

A P P E N D I X E

Licence agreement

This appendix includes the terms of the MNE software End-User License

Agreement (EULA).

E.1 License agreement

THE GENERAL HOSPITAL CORPORATION

ACADEMIC RESEARCH USE

SOFTWARE LICENSE AGREEMENT FOR BINARY CODE

By downloading and/or using the MNE software which is the subject of this Agreement (the “Software”), you hereby accept and agree to all of the terms and conditions of this Agreement. As used in this Agreement,

“you” means the individual who clicks the “I accept” button required as a condition of downloading the Software and the not-for-proļ¬t or governmental institution or entity which employs or is otherwise afļ¬liated with such individual at the time of such download (the “Institution”).

1. License Grant. Subject to all of the terms and conditions of this Agreement, [The General Hospital Corporation, d/b/a Massachusetts General

Hospital] [The Brigham and Women's Hospital, Inc.] (“Licensor”) hereby grants you a non-exclusive, non-transferable, non-sublicensable license under Licensor's rights in the Software to copy and use the binary code of the Software solely for research and educational purposes under your direction at the Institution (“Research and Educational Purposes,” which term shall include company sponsored research conducted by you in accordance with Institution's policies).

2. No Transfer. You may not sell, license, distribute, rent, lease, offer on an ASP or service bureau basis, grant a security interest in or otherwise transfer the Software to any third party or use the Software for any commercial purpose.

3. Installation and Maintenance. You are solely responsible for installing and maintaining the Software and for testing the Software for proper operation. Licensor shall have no obligation to provide any support, maintenance, corrections, debugging, improvements, modiļ¬cations, upgrades or updates of the Software or notice of any of the forgoing, or

MSH-MNE 337

E

Licence agreement otherwise assist Licensee in installing, conļ¬guring, integrating, understanding or using the Software.

4. Attributions and Acknowledgments. You must preserve and maintain all applicable attributions, copyright notices and licenses included in or applicable to the Software. You agree to provide acknowledgement of

Licensor and its designated professional staff who participated in the creation of the Software in publications or presentations in accordance with standard academic practice, provided that you may not otherwise use Licensor's name, logos or trademarks or the name of any individual associated with Licensor, or of any funding agency, in any advertising, promotional or sales material or publicity or in any document employed to obtain funds or ļ¬nancing, or to endorse or promote any research results or products related to or arising from the Software, without the prior written consent of a person authorized to make such consent.

5. Third Party Software. This Agreement does not grant any rights with respect to any third party software, except those rights that Licensor has been authorized by a third party to grant to you, and accordingly you are solely responsible for obtaining any permissions from third parties which are necessary to use and copy the Software.

6. Compliance with Law. You must comply with all applicable governmental laws, regulations and orders, including without limitation those relating to export and import control, in exercising your rights under this Agreement.

7. Termination. You may terminate this Agreement at any time by destroying all copies of the Software. Licensor may terminate this

Agreement at any time by providing notice to you of such termination.

Any use or copying of the Software by you which is inconsistent with the terms and conditions of this Agreement shall automatically render this Agreement null and void and terminate the license granted hereunder. Upon any termination of this Agreement you must stop using the

Software and return or destroy all copies of the Software, including any portion thereof.

8. DISCLAIMERS. YOU ACKNOWLEDGE THAT THE SOFTWARE

HAS BEEN DESIGNED FOR RESEARCH PURPOSES ONLY AND

HAS NOT BEEN REVIEWED OR APPROVED BY THE FOOD

AND DRUG ADMINISTRATION OR BY ANY OTHER AGENCY,

AND YOU FURTHER ACKNOWLEDGE THAT CLINICAL APPLI-

CATIONS ARE NEITHER RECOMMENDED NOR ADVISED. The

Software is provided "AS IS", is experimental, may contain errors and is subject to further development and revision. Licensor does not guarantee the accuracy of the Software, or of any results or data. LICEN-

SOR SPECIFICALLY DISCLAIMS ALL EXPRESS AND IMPLIED

WARRANTIES OF ANY KIND INCLUDING, BUT NOT LIMITED

TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR

A PARTICULAR PURPOSE AND NON-INFRINGEMENT

9. LIMITATION OF LIABILITY. IN NO EVENT SHALL LICENSOR

OR ANY OF ITS TRUSTEES, DIRECTORS, OFFICERS, MEDICAL

OR PROFESSIONAL STAFF, EMPLOYEES, STUDENTS OR

AGENTS (“LICENSOR'S PERSONNEL”) BE LIABLE TO ANY

338 MSH-MNE

MSH-MNE

Licence agreement

E

PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,

EXEMPLARY OR CONSEQUENTIAL DAMAGES HOWEVER

CAUSED AND ON ANY THEORY OF LIABILITY ARISING IN

ANY WAY RELATED TO THE SOFTWARE, EVEN IF LICENSOR

OR ANY OF LICENSOR'S PERSONNEL HAS BEEN ADVISED OF

THE POSSIBILITY OF SUCH DAMAGES. EXCEPT TO THE

EXTENT PROHIBITED BY LAW OR REGULATION, YOU

ASSUME ALL RISK AND LIABILITY FOR YOUR USE AND

COPYING OF THE SOFTWARE, AND AGREE TO INDEMNIFY

AND HOLD HARMLESS LICENSOR AND EACH OF LICEN-

SOR'S PERSONNEL FROM AND AGAINST ANY AND ALL

CLAIMS, SUITS, ACTIONS, DEMANDS AND JUDGMENTS

ARISING THEREFROM

10.U.S. Government Rights. For Software supported by federal funding, the license granted under this Agreement is subject to the rights, conditions and limitations imposed by U.S. law including without limitation

35 U.S.C. § 202 et seq. and regulations pertaining thereto.

11.General. This Agreement constitutes the entire understanding between you and Licensor with respect to the subject matter hereof, and supercedes any prior or contemporaneous oral or written agreements with respect thereto. Sections 2, 4, 6, 8, 9, 11 shall survive any termination of this Agreement. This Agreement may be modiļ¬ed or amended only in a writing signed by duly authorized representatives of both Parties hereto. The invalidity or unenforceability of any provision of this

Agreement shall not affect any other provision hereof. This Agreement and the license granted hereunder may not be assigned

339

E

Licence agreement

340 MSH-MNE

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement

Table of contents