Elekta-Neuromag tutorial: Median nerve stimulation

This tutorial describes how to process continuous Elekta-Neuromag MEG recordings. It is based on median nerve stimulation acquired at the Massachusetts General Hospital in 2005 with a Neuromag Vectorview 306 system. The sample dataset contains the results for one subject for both arms: 18 minutes, 300 stimulations per arm.

Note that the operations used here are not detailed, the goal of this tutorial is not to introduce Brainstorm to new users. For in-depth explanations of the interface and theoretical foundations, please refer to the introduction tutorials.

License

This data was collected in a multi-site MEG study administered by the MIND institute.

Presentation of the experiment

Experiment

  • One subject, one acquisition run of 18 minutes
  • The run contains 624 electric stimulations randomly distributed between left and right:
    • 301 stimulations of the left hand
    • 323 stimulations of the right hand

MEG acquisition

  • Acquisition at 1793Hz, with a Neuromag Vectorview 306 system

  • Recorded at the Massachusetts General Hospital in 2005
  • Recorded channels (318):
    • 102 MEG magnetometer
    • 204 MEG planar gradiometers
    • 9 stimulation channels (#307-315)
    • 2 EOG bipolar (#316-317)
    • 1 ECG bipolar (#318)
  • 1 dataset: mind004_050924_median01_raw.fif

Head shape

  • 130 additional head points

Subject anatomy

  • Subject with 1.5T MRI
  • Processed with FreeSurfer 5.2

Download and installation

Import the anatomy

Access the recordings

Review the recordings

Pre-processing

Evaluate the recordings

Remove: 60Hz and harmonics

Signal Space Projection (SSP) is a method for projecting the recordings away from stereotyped artifacts, such as eye blinks and heartbeats.

Epoching and averaging

Import the recordings

Averaging

Stimulation artifact

Gradiometers & magnetometers

Scaling factor

Magnetometers record values in Tesla (T), while gradiometers record values in Tesla per meter (T/m). The range of values obtained is not the same, therefore it is difficult to represent the two types of signals in the same figures.

We can convert the gradiometers values from T/m to T by multiplying them with the distance between the two gradiometer coils (0.0168 meters on the VectorView MEG system). But this still produces values that are too small to be represented with the same scale as the magnetometers. A more practical multiplication factor of 0.04 was proposed by Matti Hamalainen.

In the time series figure and for Elekta-Neuromag systems (all versions), the gradiometer values are always multiplied by 0.04. This is an empirical scaling factor that is used for visualization only, it is never saved in the recordings and is not used for any other purpose. See function bst_scale_gradmag.m.

Magnetic interpolation

Source estimation

We need now to calculate a source model for these recordings, using a noise covariance matrix calculated from the pre-stimulation baselines. This process is not detailed a lot here because it is very similar to what is shown in the introduction tutorials.

Head model

Noise covariance

Inverse model

Scouts

Place scouts to capture the activity in the primary and secondary somatosensory areas to track the processing of the electric stimulations in time, at the surface surface of the brain.

final.gif

Advanced

Existing SSP projectors

In the Record tab, select menu "Artifacts > Select active projectors". You will see the file contains three SSP projectors that are not applied by default.

In general, every Neuromag Vectorview (306 channel) system has at least two default SSP files, one for the supine position and one for upright. The newer Triux machines may contain a third SSP set. The default bases for the Vectorview are rank 5 for planar gradiometers, and rank 8 for magnetometers, for 13 bases total, but applied separately to the two types of sensors. Some sites may have different rank default bases, such as the massive three-layer magnetically shielded rooms, which may use even smaller rank bases sets.

During acquisition, the real-time display projects the data away from these SSP vectors, for display purposes only. If U is the SSP orthonormal basis, then the data are displayed as (d - U U^T d). The original data "d" are stored without the SSP applied, along with all of the default SSP vectors, U.

The default SSP bases are calculated from an empty room recording, often as part of the initial installation of the site, and they rarely need changing, since they are essentially formed by the shape of the room in its environment, and by the position of the instrument within this room, hence the need for different bases dependent on the position of the helmet.

If a subject has a very noisy low frequency baseline disturbance, such as due to metal artifacts on the patient, it is beneficial to recalculate SSP bases from a short period of their data (e.g. 2 minutes). Matti Hamalainen's MNE program can regenerate valid SSP data files compatible with the Vectorview, and these can be used in place of the default SSP bases, after restarting the acquisition program. These custom SSP bases are effective for allowing the technician acquiring the data to confirm that all channels continue to acquire usuable data. The machine can then be reset to the defaults. All of these actions can be effected through relatively simple scripts that regenerate the SSP bases, using MNE, in near real-time.

After the data are acquired, the original SSP bases are often ignored in subsequent processing. They can be useful for initial viewing of the data. For research analyses, rather than use the default SSP bases, it is preferential to recalculate the noise covariance from appropriate baselines, to include brain noise if possible, and use that as the full noise covariance. SSP is essentially an inverted noise covariance with the eigenvalues set to either 0 (reject) or 1 (pass), which is a generally inadequate description of the noise.

At many sites, the MaxFilter "TSSS" program is typically run, which is an implicit LCMV beamformer (programmed as a Generalized Sidelobe Canceller), which has the benefit that it implicitly whitens a lot of the background noise as part of its processing. Therefore, MaxFilter also does not use the original SSP bases, and as part of its default operation, MaxFilter always deletes the original SSP vectors and does not include them in the output FIF file. (As an aside, if motion compensation is on, then MaxFilter adds nine synthetic channels to the data to track head motion, written out using quaternions). Thus when you load data processed by MaxFilter, you will not find any of the original SSP projectors.

This topic is also discussed on the forum: Neuromag autossp

For additional information about SSP, read the tutorial: Artifact cleaning with SSP.

Advanced

Existing SSP and pre-processing

Scripting

The following script from the Brainstorm distribution reproduces the analysis presented in this tutorial page: brainstorm3/toolbox/script/tutorial_neuromag.m

1 function tutorial_neuromag(tutorial_dir) 2 % TUTORIAL_NEUROMAG: Script that reproduces the results of the online tutorials "MEG median nerve (Elekta)" 3 % 4 % CORRESPONDING ONLINE TUTORIALS: 5 % https://neuroimage.usc.edu/brainstorm/Tutorials/TutMindNeuromag 6 % 7 % INPUTS: 8 % tutorial_dir: Directory where the sample_neuromag.zip file has been unzipped 9 10 % @============================================================================= 11 % This function is part of the Brainstorm software: 12 % https://neuroimage.usc.edu/brainstorm 13 % 14 % Copyright (c) University of Southern California & McGill University 15 % This software is distributed under the terms of the GNU General Public License 16 % as published by the Free Software Foundation. Further details on the GPLv3 17 % license can be found at http://www.gnu.org/copyleft/gpl.html. 18 % 19 % FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE 20 % UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY 21 % WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF 22 % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY 23 % LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE. 24 % 25 % For more information type "brainstorm license" at command prompt. 26 % =============================================================================@ 27 % 28 % Author: Francois Tadel, 2010-2016 29 30 31 % ===== FILES TO IMPORT ===== 32 % You have to specify the folder in which the tutorial dataset is unzipped 33 if (nargin == 0) || isempty(tutorial_dir) || ~file_exist(tutorial_dir) 34 error('The first argument must be the full path to the tutorial dataset folder.'); 35 end 36 % Build the path of the files to import 37 AnatDir = fullfile(tutorial_dir, 'sample_neuromag', 'anatomy'); 38 RawFile = fullfile(tutorial_dir, 'sample_neuromag', 'data', 'mind004_050924_median01_raw.fif'); 39 % Check if the folder contains the required files 40 if ~file_exist(RawFile) 41 error(['The folder ' tutorial_dir ' does not contain the folder from the file sample_neuromag.zip.']); 42 end 43 44 % ===== CREATE PROTOCOL ===== 45 % The protocol name has to be a valid folder name (no spaces, no weird characters...) 46 ProtocolName = 'TutorialNeuromag'; 47 % Start brainstorm without the GUI 48 if ~brainstorm('status') 49 brainstorm nogui 50 end 51 % Delete existing protocol 52 gui_brainstorm('DeleteProtocol', ProtocolName); 53 % Create new protocol 54 gui_brainstorm('CreateProtocol', ProtocolName, 0, 0); 55 % Start a new report 56 bst_report('Start'); 57 58 59 % ===== ANATOMY ===== 60 % Subject name 61 SubjectName = 'Subject01'; 62 % Process: Import anatomy folder 63 bst_process('CallProcess', 'process_import_anatomy', [], [], ... 64 'subjectname', SubjectName, ... 65 'mrifile', {AnatDir, 'FreeSurfer'}, ... 66 'nvertices', 15000, ... 67 'nas', [131 232 123], ... 68 'lpa', [ 48 136 74], ... 69 'rpa', [204 131 67]); 70 71 % ===== LINK CONTINUOUS FILE ===== 72 % Process: Create link to raw file 73 sFilesRaw = bst_process('CallProcess', 'process_import_data_raw', [], [], ... 74 'subjectname', SubjectName, ... 75 'datafile', {RawFile, 'FIF'}, ... 76 'channelreplace', 1, ... 77 'channelalign', 1); 78 79 % Process: Events: Read from channel 80 sFilesRaw = bst_process('CallProcess', 'process_evt_read', sFilesRaw, [], ... 81 'stimchan', 'STI 001; STI 002', ... 82 'trackmode', 1, ... % Value: detect the changes of channel value 83 'zero', 0); 84 85 % Process: Events: Group by name (Rename) 86 sFilesRaw = bst_process('CallProcess', 'process_evt_groupname', sFilesRaw, [], ... 87 'combine', ['Right=STI 001_5' 10 'Left=STI 002_5'], ... 88 'dt', 0, ... 89 'delete', 1); 90 91 % Process: Snapshot: Sensors/MRI registration 92 bst_process('CallProcess', 'process_snapshot', sFilesRaw, [], ... 93 'target', 1, ... % Sensors/MRI registration 94 'modality', 1, ... % MEG (All) 95 'orient', 1, ... % left 96 'Comment', 'MEG/MRI Registration'); 97 98 99 % ===== REMOVE 60/120/180 Hz ===== 100 % Process: Apply SSP & CTF compensation 101 sFilesClean = bst_process('CallProcess', 'process_ssp_apply', sFilesRaw, []); 102 103 % Process: Notch filter: 60Hz 120Hz 180Hz 104 sFilesClean = bst_process('CallProcess', 'process_notch', sFilesClean, [], ... 105 'freqlist', [60, 120, 180], ... 106 'sensortypes', 'MEG, EEG', ... 107 'read_all', 0); 108 109 % Process: Power spectrum density (Welch) 110 sFilesPsd = bst_process('CallProcess', 'process_psd', [sFilesRaw, sFilesClean], [], ... 111 'timewindow', [0, 200], ... 112 'win_length', 4, ... 113 'win_overlap', 50, ... 114 'clusters', {}, ... 115 'sensortypes', 'MEG', ... 116 'edit', struct(... 117 'Comment', 'Power', ... 118 'TimeBands', [], ... 119 'Freqs', [], ... 120 'ClusterFuncTime', 'none', ... 121 'Measure', 'power', ... 122 'Output', 'all', ... 123 'SaveKernel', 0)); 124 125 % Process: Snapshot: Frequency spectrum 126 bst_process('CallProcess', 'process_snapshot', sFilesPsd, [], ... 127 'target', 10, ... % Frequency spectrum 128 'modality', 1, ... % MEG (All) 129 'Comment', 'Power spectrum density'); 130 131 132 % ===== CORRECT BLINKS AND HEARTBEATS ===== 133 % Process: Detect heartbeats 134 sFilesClean = bst_process('CallProcess', 'process_evt_detect_ecg', sFilesClean, [], ... 135 'channelname', 'ECG 063', ... 136 'timewindow', [], ... 137 'eventname', 'cardiac'); 138 139 % Process: Detect eye blinks 140 sFilesClean = bst_process('CallProcess', 'process_evt_detect_eog', sFilesClean, [], ... 141 'channelname', 'EOG 062', ... 142 'timewindow', [], ... 143 'eventname', 'blink'); 144 145 % Process: Remove simultaneous 146 sFilesClean = bst_process('CallProcess', 'process_evt_remove_simult', sFilesClean, [], ... 147 'remove', 'cardiac', ... 148 'target', 'blink', ... 149 'dt', 0.25, ... 150 'rename', 0); 151 152 % Process: SSP ECG: cardiac (MAG and GRAD) 153 sFilesClean = bst_process('CallProcess', 'process_ssp_ecg', sFilesClean, [], ... 154 'eventname', 'cardiac', ... 155 'sensortypes', 'MEG MAG', ... 156 'usessp', 1, ... 157 'select', 1); % Force selection of some components 158 sFilesClean = bst_process('CallProcess', 'process_ssp_ecg', sFilesClean, [], ... 159 'eventname', 'cardiac', ... 160 'sensortypes', 'MEG GRAD', ... 161 'usessp', 1, ... 162 'select', 1); % Force selection of some components 163 164 % Process: SSP EOG: blink (MAG and GRAD) 165 sFilesClean = bst_process('CallProcess', 'process_ssp_eog', sFilesClean, [], ... 166 'eventname', 'blink', ... 167 'sensortypes', 'MEG MAG', ... 168 'usessp', 1, ... 169 'select', 1); % Force selection of some components 170 sFilesClean = bst_process('CallProcess', 'process_ssp_eog', sFilesClean, [], ... 171 'eventname', 'blink', ... 172 'sensortypes', 'MEG GRAD', ... 173 'usessp', 1, ... 174 'select', 1); % Force selection of some components 175 176 % Process: Snapshot: SSP projectors 177 bst_process('CallProcess', 'process_snapshot', sFilesClean, [], ... 178 'target', 2, ... % SSP projectors 179 'Comment', 'SSP projectors'); 180 181 182 % ===== IMPORT EVENTS ===== 183 % Process: Import MEG/EEG: Events 184 sFilesEpochs = bst_process('CallProcess', 'process_import_data_event', sFilesClean, [], ... 185 'subjectname', SubjectName, ... 186 'condition', '', ... 187 'eventname', 'Right, Left', ... 188 'timewindow', [], ... 189 'epochtime', [-0.1, 0.3], ... 190 'createcond', 0, ... 191 'ignoreshort', 1, ... 192 'usectfcomp', 1, ... 193 'usessp', 1, ... 194 'freq', [], ... 195 'baseline', [-0.1, 0]); 196 197 % Process: Average: By condition (subject average) 198 sFilesAvg = bst_process('CallProcess', 'process_average', sFilesEpochs, [], ... 199 'avgtype', 6, ... % By trial groups (subject average) 200 'avg_func', 1, ... % Arithmetic average: mean(x) 201 'keepevents', 0); 202 203 % Process: Cut stimulation artifact: [0ms,4ms] 204 sFilesAvg = bst_process('CallProcess', 'process_cutstim', sFilesAvg, [], ... 205 'timewindow', [0, 0.0039], ... 206 'sensortypes', 'MEG, EEG', ... 207 'overwrite', 1); 208 209 % Process: Snapshot: Recordings time series 210 bst_process('CallProcess', 'process_snapshot', sFilesAvg, [], ... 211 'target', 5, ... % Recordings time series 212 'modality', 1, ... % MEG (All) 213 'Comment', 'Evoked response'); 214 215 216 % ===== SOURCE MODELING ===== 217 % Process: Compute head model 218 bst_process('CallProcess', 'process_headmodel', sFilesAvg, [], ... 219 'comment', '', ... 220 'sourcespace', 1, ... 221 'meg', 3); % Overlapping spheres 222 223 % Process: Compute noise covariance 224 bst_process('CallProcess', 'process_noisecov', sFilesEpochs, [], ... 225 'baseline', [-0.100, 0], ... 226 'dcoffset', 1, ... 227 'identity', 0, ... 228 'copycond', 0, ... 229 'copysubj', 0); 230 231 % Process: Compute sources 232 sFilesSrc = bst_process('CallProcess', 'process_inverse', sFilesAvg, [], ... 233 'comment', '', ... 234 'method', 2, ... % dSPM 235 'wmne', struct(... 236 'NoiseCov', [], ... 237 'InverseMethod', 'dspm2018', ... 238 'ChannelTypes', {{}}, ... 239 'SNR', 3, ... 240 'diagnoise', 0, ... 241 'SourceOrient', {{'fixed'}}, ... 242 'loose', 0.2, ... 243 'depth', 1, ... 244 'weightexp', 0.5, ... 245 'weightlimit', 10, ... 246 'regnoise', 1, ... 247 'magreg', 0.1, ... 248 'gradreg', 0.1, ... 249 'eegreg', 0.1, ... 250 'ecogreg', 0.1, ... 251 'seegreg', 0.1, ... 252 'fMRI', [], ... 253 'fMRIthresh', [], ... 254 'fMRIoff', 0.1, ... 255 'pca', 1), ... 256 'sensortypes', 'MEG, MEG MAG, MEG GRAD, EEG', ... 257 'output', 1); % Kernel only: shared 258 259 % Process: Snapshot: Noise covariance 260 bst_process('CallProcess', 'process_snapshot', sFilesSrc, [], ... 261 'target', 3, ... % Noise covariance 262 'Comment', 'Noise covariance'); 263 264 % Process: Snapshot: Sources (one time) 265 bst_process('CallProcess', 'process_snapshot', sFilesSrc, [], ... 266 'target', 8, ... % Sources (one time) 267 'modality', 1, ... % MEG (All) 268 'orient', 3, ... % top 269 'time', 0.023, ... 270 'Comment', 'Source maps at 35ms'); 271 272 273 % Save and display report 274 ReportFile = bst_report('Save', sFilesSrc); 275 bst_report('Open', ReportFile); 276 277

Discussion

Additional Reading

Weisend MP, Hanlon FM, Montano R, Ahlfors SP, Leuthold AC, Pantazis D, Mosher JC, Georgopoulos AP, Hämäläinen MS, Aine CJ. "Paving the way for cross-site pooling of magnetoencephalography (MEG) data." InInternational Congress Series 2007 Jun 1 (Vol. 1300, pp. 615-618). Elsevier. https://doi.org/10.1016/j.ics.2006.12.095





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


Tutorials/TutMindNeuromag (last edited 2024-03-06 20:33:08 by JohnMosher)