Skip to content

Workshop fNIRS 2022

Edouard Delaire edited this page Oct 8, 2022 · 22 revisions

NIRSTORM

This page corresponds the mini-course given at the fNIRS conference in 20222. More information here: https://fnirs2022.fnirs.org/educational/mini-courses/minicourse-20/

Authors

  • Edouard Delaire, Physics Department and PERFORM Center, Concordia University, Montreal, Canada
  • Thomas Vincent, EPIC center, Montreal Heart Institute, Montreal, Canada
  • Zhengchen Cai, Physics Department and PERFORM Center, Concordia University, Montreal, Canada
  • Christophe Grova, Physics Department and PERFORM Center, Concordia University, Montreal, Canada

Outline:

Requirements

  • Hardware: a basic recent laptop should be fine.
  • An internet connection. A dedicated wifi connection will be available on site for the participants of the workshop.
  • Operating system: Linux, windows or Mac OS. Everything should work on all systems though we recommend using Linux since more tests have been done with it.
  • Disk space: the full installation with dependencies and sample data should take no more than 4Gb. Some space can be freed by cleaning the CPLEX dependency (saves ~3Gb).
  • Matlab: version > R2015b is recommended.
    The Matlab Curve Fitting Toolbox is required to perform motion correction. If you don't have it, you may skip this step in the first tutorial. The provided data do not contain too much movement.
  • Before attending the workshop: Please complete the following Setup section.

Setup

Brainstorm

If Brainstorm is already installed, update to the latest version (Menu bar: Update > Update Brainstorm).

For a new installation, Brainstorm requires a user to be registered in order to download it. This allows their development team to track their usage. Consult Brainstorm tutorial for instruction on how to download Brainstorm

For the first time it runs, brainstorm asks to specify a database folder. This will be the place where all the data imported by brainstorm will go. Create a folder named brainstorm_db in your Documents folder and specify it as your main brainstorm database. Then, the main brainstorm interface will be displayed.

No prior knowledge of brainstorm is mandatory for the current workshop session which should cover the basics. However, if one wishes to get familiar with brainstorm features, we refer to the brainstorm tutorials page.

Important for mac users: If the right-click doesn't work anywhere in the Brainstorm interface and you cannot get to see the popup menus in the database explorer, try to change the configuration of your trackpad in the system preferences and enable left-click. Alternatively, connect a standard external mouse with two buttons. Some Apple pointing devices do not interact very well with Java/Matlab.

CPLEX

CPLEX is a set of tools to perform functional optimization edited by IBM. It is used here to solve the integer programming problem during the optimal montage computation (last tutorial of this workshop).
For license concerns, we cannot bundle the CPLEX library within NIRSTORM. One can purchase a free copy of CPLEX if they are students or academics.

For this tutorial, download CPLEX 12.10.

To download CPLEX :

  • Visit http://ibm.biz/CPLEXonAI and create an account using your institutional email
  • Once you are connected; go down the page and click on software and then ILOG CPLEX Optimization Studio and click on download. A new page will open
  • In the search options, select text, and write: "IBM ILOG CPLEX Optimization Studio V12.10 Multiplatform Multilingual eAssembly"
  • Download "IBM ILOG CPLEX Optimization Studio V12.10 for X Multiplatform Multilingual" where X is your operating system (eg. Windows, linux, MacOs)
  • For MacOs, install CPlex.
  • For Linux, and Windows, unzip the file in your Documents

Finally, add the path to the CPLEX Matlab bindings to the Matlab path: go to the "Home" tab, click "Set path" (yellow folder icon) then click on "Add with subfolders" and select the folder of the CPLEX Matlab bindings.

In Mac, this file is in your application folder.

If you cannot get a working version of CPLEX, let us know during the workshop and we'll try to help you.

Plug-In

enter image description here

Using Brainstorm plug-in system, download the following plugins :

  • NIRS > NIRSTORM
  • NIRS > MCXLAB-cl
  • SPM12
  • Inverse > Brainentropy

Tutorials

The tutorial is separated in three modules

  • Module 1: Channel-space analysis: extraction of the motor response
  • Module 2: Source-space analysis: Reconstruction of the motor response on the cortical surface
  • Module 3: Optimal montage computation

Presentation of the experiment

  • One subject, one run of 19 minutes acquired with a sampling rate of 10Hz
  • Finger tapping task: 20 blocks of 10 seconds each, with rest period of 30 to 60 seconds
  • 3 sources, 15 detectors and 1 proximity detector
  • 2 wavelengths: 685nm and 830nm
  • 3T MRI anatomy processed by FreeSurfer 5.3.0 and SPM12

Download data sets and check installation

The total disk space required after data download and installation is ~1.3Go. The size is quite large because of optical data which are required for the computation of the forward model. The dataset can be downloaded from : https://drive.google.com/file/d/1b8AYRc7_4vIxdFCpMs5QCri_kTcCK-G7/view?usp=sharing

** Licence ** This tutorial dataset (NIRS and MRI data) remains proprietary of the MultiFunkIm Laboratory of Dr Grova, at PERFORM centre, Concordia University, Montreal. Its use and transfer outside the Brainstorm tutorial, e.g. for research purposes, is prohibited without written consent from our group. For questions please contact Christophe Grova: [email protected]

Module 1 : Channel-space analysis

This tutorial illustrates how to estimate the NIRS response to a finger tapping task at the sensor level and to perform statistical analysis using a general linear model (GLM) at the subject level.

Here is a cheat sheet on the main brainstorm features that will be used during the tutorials:

enter image description here

Creation of a new protocol and subject

First, start by creating a new protocol called For more details, please consult Brainstorm tutorials #1-5

Subject importation

To ensure, that we are all working on the same dataset, we prepared a subject with the anatomy already imported. To import this subject in Brainstorm, click on File > load protocol > import subject from zip and then select TutorialNIRSTORM_Subject01.zip under the bst_db folder.

Your Brainstorm database should looks like this:

enter image description here

Import NIRS functional data

The functional data used in this tutorial was produced by the Brainsight acquisition software and is available in the Functional folder. It contains the following files:

  • fiducials.txt: the coordinates of the fudicials (nasion, left ear, right ear). The positions of the Nasion, LPA and RPA have been digitized at the same location as the fiducials previously marked on the anatomical MRI. These points will be used by Brainstorm for the registration, hence the consistency between the digitized and marked fiducials is essential for good results.
  • optodes.txt: the coordinates of the optodes (sources and detectors), in the same referential as in fiducials.txt. Note: the actual referential is not relevant here, as the registration will be performed by Brainstorm afterwards.
  • tapping.nirs: the NIRS data in a Homer-based format. Note: The fields ''SrcPos'' and ''DetPos'' will be overwritten to match the given coordinates in "optodes.txt"

To import this dataset in Brainstorm:

  • Go to the "functional data" view of the protocol.
  • Right-click on Subject 01 > '''Review raw file
  • Select file type '''NIRS: Brainsight (.nirs)
  • Select file sample_nirs/data/S01_Block_FO_LH_Run01.nirs
  • Note: the importation process assumes that the files optodes.txt and fiducials.txt are in the same folder as the .nirs data file.

Registration

In the same way as in the tutorial Channel file / MEG-MRI coregistration, the registration between the MRI and the NIRS is first based on three reference points Nasion, Left and Right ears. It can then be refined with the either the full head shape of the subject or with manual adjustment.

  • The initial registration is based on the three fiducial point that define the Subject Coordinate System (SCS): nasion, left ear, right ear.

  • These same three points have also been marked before the acquisition of the NIRS recordings. The person who recorded this subject digitized their positions with a tracking device (here Brainsight). The position of these points are saved in the NIRS datasets (see fiducials.txt).

  • When the NIRS recordings are loaded into the Brainstorm database, they are aligned on the MRI using these fiducial points: the NAS/LPA/RPA points digitized with Brainsight are matched with the ones we placed in the MRI Viewer.

  • To improve this registration, we recommend our users to always digitize additional points on the head of the subjects: around 100 points uniformly distributed on the hard parts of the head (skull from nasion to inion, eyebrows, ear contour, nose crest). Avoid marking points on the softer parts (cheeks or neck) because they may have a different shape when the subject is seated on the or lying down in the MRI. More information on digitizing head points.

To import the head points, right click on NIRS-BRS channels (104) and select Digitalized head points > add points. Then select the file called headpoints in the Functional folder with the format EEG: ASCII, name,XYZ(.). then Right click on NIRS-BRS channels (104) and select Digitalized head points > Remove points bellow nasion, finally Right click on NIRS-BRS channels (104) and select `MRI registration > Refine using head points (ignore 0% of the headpoints)

The following figure showing the coregistration between the subject anatomy and the montage should appear : enter image description here.

Visualize NIRS signals

Right click on Link to raw file under the tapping condition and use NIRS > Display time series. It will open a new figure with superimposed channels.

enter image description here

The default temporal window may be limited to a couple a seconds. To actually see the whole time series, in the main brainstorm window -- right panel, go to the "Record" tab, and change "Start" to 0 and "Duration:" to 709.3s (you can see the total duration at the top right of the brainstorm main window).

If coloring is not visible, right-click on the figure the select "Montage > NIRS Overlay > NIRS Overlay" Indeed, brainstorm uses a dynamical montage, called ''NIRS Overlay,'' to regroup and color-code nirs time-series depending on the wavelength (red: 830nm, green:686nm). The signals for a given pair of source and detectors are also grouped when using the selection tool. So clicking one curve for one wavelength will also select the other wavelength for the same pair.

To isolate the signals of a selected pair, the default behaviour of brainstorm can be used by pressing ENTER or right-click on the figure then "Channel > View selected". However, the NIRS overlay dynamic montage is not activated in this case (will be fixed in the future).

Extract stimulation events

During the experiment, the stimulation paradigm was run using E-Prime and sent triggers through the parallel port to the acquisition device. These stimulation events are then stored as a box signal in channel AUX1: values above a certain threshold indicate a stimulation block.

To view the auxiliary data, right click on Link to raw file and select NIRS_AUX > Display time series

In the event panel, click on file > Read events from channel and use the following options:

enter image description here

Double click on Àux1and rename it tapping. Latter in the tutorial, we will need to have access to the duration of the task, to specify it, first duplicate the event using Events > Duplicate groups, and rename it tapping_ext. Finally use Events > Convert to extended events and specify 0 for the time to include before the event and 10000 for the time to include after the event.

Pre-processing

Drag and drop the file Link to raw to the process box, and click run. You can create a pipeline by adding process one after the other that will get executed sequentially.

Add the following process to your pipeline

  • NIRS > Pre-process > Detect Bad channels
  • NIRS > dOD and MBLL > raw to delta OD
  • Pre-process > Band-pass filter
  • NIRS > Pre-process > Remove superficial noise
  • NIRS > dOD and MBLL > MBLL delta OD to delta [HbO], [HbR] & [HbT]

For the process, use the following parameters : enter image description here

then click on Run. The following report should appear : enter image description here

Windows averaging

The goal is to get the response elicited by the motor paradigm. For this, we perform window-averaging time-locked on each motor onset while correcting for baseline differences across trials.

The first step is to split the data into chunks corresponding to the window over which we want to average. The average window is wider than the stimulation events: we'd like to see the return to baseline / undershoot after stimulation.

Right-click on "Link to raw file | band(0.01-0.1Hz)| SSC (mean): [0.000s,1123.200s]" under the condition "tapping_dOD_Hb" and use Import in database using the following parameter :

enter image description here

Ensure that "Use events" is checked and that the tapping events are selected. The epoch time should be: -10000 to 30000 ms. This means that there will be 10 seconds prior to the stimulation event to check if the signal is steady. There will also be 30 seconds after the stimulation to check the return to baseline / undershoot. In the "Pre-processing" panel, check "Remove DC offset" and use a Time range of -10000 to 0 ms. This will set a reference window prior over which to remove chunk offsets. All signals will be zero-centered according to this window. Finally, ensure that the option "Create a separate folder for each event type" is unchecked".

This will create 20 tapping file corresponding to each trial that you can review individually. A trial showing execive motion can be discarded by right clicking on it and using reject trial. In our example, we want to reject the first trial as it is contaminated y the transient effect of the filter (presence of the event transient_bandpass)

To compute the average response, Drag and drop the 20 files to the process box, it will show `tapping (20 files) [19]. 19 means that only 19 files out of the 20 will be used (since we rejected 1 trial).

Click on run, and select the process Average > Average files. Use the function Arithmetic average + Standard error and use the option Keep all event markers from the individual epochs.

You can then visualize the average by inspecting the file AvgStderr: tapping (19)

General Linear Model

Note on the preprocessing : Short-channel regression should not be done twice. If you use the GLM, we recommend to perform the short-channel regression inside the GLM module.

Drag and drop the file "Link to raw file | band(0.01-0.1Hz)" from the condition tapping_dOD and create the following pipeline :

  • NIRS > dOD and MBLL > MBLL delta OD to delta [HbO], [HbR] & [HbT]
  • NIRS > GLM > 1st level design and fit
  • NIRS > GLM > 1st level contrast
  • NIRS > GLM > contrast t-test

enter image description here

References

Boas D, Culver J, Stott J, Dunn A. Three dimensional Monte Carlo code for photon migration through complex heterogeneous media including the adult human head. Opt Express. 2002 Feb 11;10(3):159-70 pubmed

Boas D.A., Dale A.M., Franceschini M.A. Diffuse optical imaging of brain activation: approaches to optimizing image sensitivity, resolution, and accuracy. NeuroImage. 2004. Academic Press. pp. S275-S288 pubmed

Hansen C. and O’Leary DP., The Use of the L-Curve in the Regularization of Discrete Ill-Posed Problems. SIAM J. Sci. Comput., 14(6), 1487–1503 SIAM

Arridge SR, Methods in diffuse optical imaging. Philos Trans A Math Phys Eng Sci. 2011 Nov 28;369(1955):4558-76 pubmed

Amblard C,, Lapalme E. and Jean-Marc Lina JM, Biomagnetic source detection by maximum entropy and graphical models. IEEE Trans Biomed Eng. 2004 Mar;51(3):427-42 pubmed

Grova, C. and Makni, S. and Flandin, G. and Ciuciu, P. and Gotman, J. and Poline, JB. Anatomically informed interpolation of fMRI data on the cortical surface Neuroimage. 2006 Jul 15;31(4):1475-86. Epub 2006 May 2. pubmed

Chowdhury RA, Lina JM, Kobayashi E, Grova C., MEG source localization of spatially extended generators of epileptic activity: comparing entropic and hierarchical bayesian approaches. PLoS One. 2013;8(2):e55969. doi: 10.1371/journal.pone.0055969. Epub 2013 Feb 13. pubmed

Machado A, Marcotte O, Lina JM, Kobayashi E, Grova C., Optimal optode montage on electroencephalography/functional near-infrared spectroscopy caps dedicated to study epileptic discharges. J Biomed Opt. 2014 Feb;19(2):026010 pubmed

Pellegrino G, Machado A, von Ellenrieder N, Watanabe S, Hall JA, Lina JM, Kobayashi E, Grova C., Hemodynamic Response to Interictal Epileptiform Discharges Addressed by Personalized EEG-fNIRS Recordings Front Neurosci. 2016 Mar 22;10:102. pubmed

Fang Q. and Boas DA., Monte Carlo simulation of photon migration in 3D turbid media accelerated by graphics processing units, Opt. Express 17, 20178-20190 (2009) pubmed