Functional Near-Infrared Spectroscopy

Initialize NeuroAnalyzer
using NeuroAnalyzer

Functional Near-Infrared Spectroscopy (fNIRS) is a non-invasive, optical neuroimaging technique that measures brain activity by detecting changes in blood oxygenation and flow. It is based on the principles of near-infrared spectroscopy (NIRS) and provides real-time, portable, and wearable imaging of brain function. fNIRS is increasingly used in cognitive neuroscience, clinical research, and brain-computer interfaces (BCIs) due to its low cost, safety, and ease of use.

fNIRS is a functional neuroimaging modality that uses near-infrared light (650–900 nm) to measure changes in oxygenated hemoglobin (HbO) and deoxygenated hemoglobin (HbR) in the brain. - It is based on the neurovascular coupling principle, where neural activity leads to localized changes in blood flow and oxygenation.

Key Features

Feature Description
Signal Source Changes in HbO and HbR due to neural activity.
Temporal Resolution 0.1–10 Hz (limited by the hemodynamic response).
Spatial Resolution 1–3 cm (dependent on optode spacing).
Invasiveness Non-invasive (no ionizing radiation or contrast agents).
Portability Wearable and portable systems available for real-world use.
Cost Lower cost compared to fMRI or MEG.

Near-Infrared Light and Tissue

  • Near-infrared light (650–900 nm) penetrates scalp and skull but is absorbed by hemoglobin in the brain.
  • Oxyhemoglobin (HbO) and deoxyhemoglobin (HbR) have different absorption spectra:
    • HbO: Higher absorption at ~850 nm.
    • HbR: Higher absorption at ~760 nm.
  • The difference in absorption between HbO and HbR is used to estimate changes in oxygenation.

Modified Beer-Lambert Law

The absorption of light in tissue is described by the Beer-Lambert law:

\[ A = \log \left( \frac{I_0}{I} \right) = \epsilon \cdot c \cdot d + G \]

where:
\(A\) is the absorbance,
\(I_0\) is the incident light intensity,
\(I\) is the transmitted light intensity,
\(\epsilon\) is the molar extinction coefficient (depends on wavelength),
\(c\) is the concentration of HbO or HbR,
\(d\) is the distance between source and detector,
\(G\) is the scattering losses (empirically determined).

For fNIRS, the change in absorbance (\(\Delta A\)) is related to the change in concentration of HbO and HbR:

\[ \Delta A(\lambda) = (\epsilon_{HbO}(\lambda) \cdot \Delta [HbO] + \epsilon_{HbR}(\lambda) \cdot \Delta [HbR]) \cdot d \]

where:
\(\epsilon_{HbO}(\lambda)\) and \(\epsilon_{HbR}\) are extinction coefficients at wavelength \(\lambda\),
\(\Delta [HbO]\) and \(\Delta [HbR]\) are the changes in HbO and HbR concentrations.

Instrumentation

Light Sources

  • Near-infrared LEDs or lasers: Typically use 2–4 wavelengths (e.g., 690 nm, 830 nm) to distinguish between HbO and HbR.
  • Laser diodes: Provide higher power and stability but are more expensive.

Detectors

  • Photodiodes or avalanche photodiodes (APDs): Detect transmitted or reflected light.
  • Avalanche photodiodes (APDs): More sensitive but require higher voltage.

Optodes

  • Source optodes: Emit near-infrared light into the scalp.
  • Detector optodes: Measure the light that passes through the brain.
  • Optode spacing: Typically 2.5–3.5 cm to balance depth penetration and signal quality.

fNIRS Systems

  1. Continuous-Wave (CW) fNIRS:
  • Measures changes in light intensity.
  • No depth resolution (only measures superficial cortex).
  • Lower cost and portable.
  1. Time-Domain (TD) fNIRS:
  • Measures time-of-flight of photons.
  • Provides depth resolution (can distinguish between superficial and deep signals).
  • Higher cost and complexity.
  1. Frequency-Domain (FD) fNIRS:
  • Measures amplitude and phase of modulated light.
  • Provides depth resolution and quantitative concentration measurements.
  • Moderate cost.

fNIRS Signal Analysis

Preprocessing

  1. Noise Reduction:
  • Apply band-pass filters (e.g., 0.01–0.2 Hz) to remove high-frequency noise and low-frequency drifts.
  • Use motion artifact correction (e.g., spline interpolation, PCA-based methods).
  1. Signal Normalization:
  • Normalize signals to baseline or global average to reduce inter-subject variability.
  1. Channel Selection:
  • Select channels based on anatomical landmarks or statistical significance.

Hemodynamic Response Function (HRF)

  • fNIRS signals reflect the hemodynamic response, which is delayed and smoothed compared to neural activity.
  • The canonical HRF is modeled as a gamma function: \(h(t) = \left( \frac{t}{a_1} \right)^{a_1} e^{-(t - a_2)/b} - \left( \frac{t}{a_3} \right)^{a_3} e^{-(t - a_4)/b}\) where \(a_1\), \(a_2\), \(a_3\), \(a_4\), and \(b\) are parameters.

Hemoglobin Concentration Changes

  • The change in HbO and HbR is calculated using the modified Beer-Lambert law:

\[ \begin{bmatrix} \Delta [HbO] \\ \Delta [HbR] \end{bmatrix} = \frac{1}{d \cdot \Delta \epsilon} \begin{bmatrix} \Delta A(\lambda_1) \\ \Delta A(\lambda_2) \end{bmatrix} \]

where \(\Delta \epsilon\) is the difference in extinction coefficients between HbO and HbR.

Statistical Analysis

  1. General Linear Model (GLM):
    • Models the fNIRS signal as a linear combination of task conditions and nuisance variables.
    • Used to identify activation patterns (e.g., HbO increases during task performance).
  2. Connectivity Analysis:
    • Measures functional connectivity between brain regions (e.g., correlation, coherence).
  3. Multivariate Pattern Analysis (MVPA):
    • Uses machine learning to classify brain states or tasks based on fNIRS patterns.

Applications of fNIRS

Application Description
Cognitive Neuroscience Studying attention, memory, language, and decision-making.
Clinical Research Assessing neurodevelopmental disorders (e.g., autism, ADHD), stroke rehabilitation, and depression.
Brain-Computer Interfaces (BCIs) Using fNIRS for real-time neural decoding (e.g., motor imagery, mental arithmetic).
Neurofeedback Training individuals to regulate their brain activity for therapeutic purposes.
Pediatric Neuroimaging Safe and portable imaging for infants and children.
Sleep Research Monitoring brain activity during sleep without disrupting sleep.
Sports Science Assessing brain function during physical exercise.

Advantages of fNIRS

Advantage Description
Non-Invasive No ionizing radiation, no contrast agents, and safe for repeated use.
Portable and Wearable Systems are lightweight and portable, enabling real-world use.
High Temporal Resolution Captures hemodynamic changes at 0.1–10 Hz.
Low Cost Lower cost compared to fMRI, PET, or MEG.
Safe for All Ages Can be used in infants, children, and clinical populations.
Multi-Modal Integration Can be combined with EEG, fMRI, and behavioral measures for comprehensive analysis.

Limitations of fNIRS

Limitation Description
Limited Spatial Resolution 1–3 cm resolution, limited to superficial cortex.
Depth Resolution Shallow penetration (primarily measures superficial cortex).
Hemodynamic Lag Delayed and smoothed response compared to neural activity.
Motion Artifacts Sensitive to head movements and environmental light.
Interpretation Challenges Requires expertise to distinguish neural activity from artifacts or systemic changes.
Cost of High-End Systems Time-domain (TD) and frequency-domain (FD) systems are expensive.

fNIRS vs. Other Neuroimaging Modalities

Modality Temporal Resolution Spatial Resolution Invasiveness Cost Applications
fNIRS 0.1–10 Hz 1–3 cm Non-invasive Low Cognitive neuroscience, clinical research.
EEG Milliseconds 5–10 mm Non-invasive Low Clinical EEG, BCIs.
fMRI Seconds 1–3 mm Non-invasive High Structural-functional mapping.
MEG Milliseconds 2–5 mm Non-invasive High Epilepsy, cognitive neuroscience.
PET Minutes 4–6 mm Invasive High Metabolic imaging.

Future Directions

  • High-Density fNIRS Arrays: Larger arrays with higher channel counts for better spatial resolution.
  • Wearable fNIRS Systems: Development of lightweight, wireless fNIRS headsets for real-world monitoring.
  • Multi-Modal Integration: Combining fNIRS with EEG, fMRI, or behavioral measures for comprehensive analysis.
  • Closed-Loop Systems: Integration with neurofeedback or BCIs for real-time brain activity modulation.
  • AI and Machine Learning: Using AI to decode fNIRS signals for BCIs and brain state prediction.

Processing and Analyzing fNIRS Data

Loading NIRS data:

n = import_nirs("files/fnirs.nirs")
header(n)
              Data type: NIRS
            File format: NIRS
            Source file: files/fnirs.nirs
         File size [MB]: 0.72
       Memory size [MB]: 0.9
                Subject:  
              Recording: 
        Recording notes: 
         Recording date: 
         Recording time: 
     Sampling rate (Hz): 25
Signal length [samples]: 9015
Signal length [seconds]: 360.6
     Number of channels: 12
              Epochs ID: 
       Number of epochs: 1
 Epoch length [samples]: 9015
 Epoch length [seconds]: 360.6
        Wavelength [nm]: [690.0, 830.0]
                Markers: no
      Channel locations: yes
Number of NIRS channels: 12

Loading SNIRF data:

n = import_snirf("files/fnirs.snirf")
header(n)
              Data type: NIRS
            File format: SNIRF
            Source file: files/fnirs.snirf
         File size [MB]: 1.91
       Memory size [MB]: 0.29
                Subject: default:  
              Recording: 
        Recording notes: 
         Recording date: 2022-03-03
         Recording time: 12:03:48
     Sampling rate (Hz): 50
Signal length [samples]: 500
Signal length [seconds]: 10.0
     Number of channels: 72
              Epochs ID: 
       Number of epochs: 1
 Epoch length [samples]: 500
 Epoch length [seconds]: 10.0
        Wavelength [nm]: [760.0, 850.0]
                Markers: yes
      Channel locations: yes
Number of NIRS channels: 72

Viewing optode locations:

plot_locs(n,
          ch = "all",
          src_labels = false,
          det_labels = false,
          opt_labels = false,
          head = false)

Tip: Red (or black in monochrome mode) optodes represent sources, green (white) optodes are detectors.

Getting wavelengths:

n.header.recording[:wavelengths]
2-element Vector{Float64}:
 760.0
 850.0

Getting channel of 760 or 850 nm wavelength:

ch760 = get_channel(n, ch = get_channel(n, wl = 760))
ch850 = get_channel(n, ch = get_channel(n, wl = 850))

Getting data associated with these channels:

d760 = n.data[ch760, :, :]
d850 = n.data[ch850, :, :]

Converting RAW intensity to OD (optical density):

n = import_nirs("files/fnirs.nirs")
intensity2od!(n)
header(n)
              Data type: NIRS
            File format: NIRS
            Source file: files/fnirs.nirs
         File size [MB]: 0.72
       Memory size [MB]: 1.17
                Subject:  
              Recording: 
        Recording notes: 
         Recording date: 
         Recording time: 
     Sampling rate (Hz): 25
Signal length [samples]: 9015
Signal length [seconds]: 360.6
     Number of channels: 16
              Epochs ID: 
       Number of epochs: 1
 Epoch length [samples]: 9015
 Epoch length [seconds]: 360.6
        Wavelength [nm]: [690.0, 830.0]
                Markers: no
      Channel locations: yes
Number of NIRS channels: 16

Tip: OD channels will be added to the object as nirs_od channel type. OD channels will be placed after RAW (intensity channels) and before other channels.

Converting OD (optical density) to hemoglobin concentration:

od2conc!(n)
header(n)
              Data type: NIRS
            File format: NIRS
            Source file: files/fnirs.nirs
         File size [MB]: 0.72
       Memory size [MB]: 1.59
                Subject:  
              Recording: 
        Recording notes: 
         Recording date: 
         Recording time: 
     Sampling rate (Hz): 25
Signal length [samples]: 9015
Signal length [seconds]: 360.6
     Number of channels: 22
              Epochs ID: 
       Number of epochs: 1
 Epoch length [samples]: 9015
 Epoch length [seconds]: 360.6
        Wavelength [nm]: [690.0, 830.0]
                Markers: no
      Channel locations: yes
Number of NIRS channels: 22

Tip: For each channel three channels will be added: nirs_hbo (oxygenated hemoglobin), nirs_hbr (deoxgenated hemoglobin) and nirs_hbt (total hemoglobin). The sequence of added channels is: ch1 HbO, ch1 HbR, ch1 HbT, ch2 HbO, ch2 HbR, ch2 HbT etc.

Tip: It is recommended to run a band-pass filter prior to calculating Hb concentration:

n = import_nirs("files/fnirs.nirs")
intensity2od!(n)
NeuroAnalyzer.filter!(n,
                      ch = "all",
                      fprototype = :fir,
                      ftype = :bp,
                      cutoff = (0.5, 10),
                      bw = 0.1,
                      order = 91)
od2conc!(n)

HbO, HbR, HbT of channel 1:

labels(n)[17:22]
6-element Vector{String}:
 "S1_D1 HbO"
 "S1_D1 HbR"
 "S1_D1 HbT"
 "S1_D2 HbO"
 "S1_D2 HbR"
 "S1_D2 HbT"
n.header.recording[:channel_type][17:22]
6-element Vector{String}:
 "nirs_hbo"
 "nirs_hbr"
 "nirs_hbt"
 "nirs_hbo"
 "nirs_hbr"
 "nirs_hbt"

Chanel 1 data:

ch1_od = n.data[17:22, :, :]

Plotting channels:

NeuroAnalyzer.plot(n,
                   ch = "all",
                   gui = false)

Plotting Hb concentrations:

NeuroAnalyzer.plot(n,
                   ch = ["S1_D1 HbO", "S1_D2 HbO"],
                   type = :butterfly,
                   seg = (0, 30),
                   title = "HbO",
                   ylabel = "HbO [μM/mm]",
                   gui = false)
NeuroAnalyzer.plot(n,
                   ch = ["S1_D1 HbR", "S1_D2 HbR"],
                   type = :butterfly,
                   seg = (0, 30),
                   title = "HbR",
                   ylabel = "HbR [μM/mm]",
                   xlabel = "",
                   gui = false)
NeuroAnalyzer.plot(n,
                   ch = ["S1_D1 HbT", "S1_D2 HbT"],
                   type = :butterfly,
                   seg = (0, 30),
                   title = "HbT",
                   ylabel = "HbT [μM/mm]",
                   gui = false)