# The NIRS Brain AnalyzIR Toolbox

^{1}

^{2}

^{3}

^{4}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Architecture of Toolbox

#### 2.1. Data Classes

#### 2.1.1. nirs.core.Data

#### 2.1.2. nirs.core.Data

#### 2.1.3. nirs.core.ChannelStats

^{T}. In the toolbox, the contrast can be specified directly as a vector or by human-readable strings; e.g., MyStats.ttest([1–1000]) or MyStats.ttest(“task1–task2”) where “task1/2” are the names of two event types in the data.

_{α}(998,1) = 1.64 at α = 0.05. Solving for the power, (1-β) = 0.82 or the measurement is 82% powered to detect a p < 0.05 change for the one-sided test. For both first- and higher-level models, the power for an fNIRS measurement is returned within the ChannelStats object using this equation. Compared to other modalities, such as fMRI, where the measurement error (and therefore power) is more uniform across space or participants, the power in fNIRS measurements can vary significantly across the probe or between subjects with more or less hair under the fNIRS sensors.

^{2}value is used within the toolbox to define contrast across hemoglobin species (e.g., the null hypothesis of no change in signal given the joint probability of oxy- and deoxy-hemoglobin) and follows a F (p,n−1) statistical distribution. This value is stored in a related object class called ChannelFStats is also contained within the toolbox, which is also used in the higher-level ANOVA models.

#### 2.1.4. nirs.core.ImageStats

#### 2.1.5. Multimodal Object Classes

#### 2.2. Processing Modules Classes

#### 2.2.1. Data Management

#### 2.2.2. Pre-Processing

#### 2.2.2.1. Baseline Correction

**w**) varies from 0 (discard; definitely an outlier) to 1 (keep), $\sigma $ is the standard deviations of the errors, and $\kappa $ is the tuning constant ($\kappa =4.685$ for the bisquare produce 95% efficiency when the errors are normal). This weighting is then applied to the innovations and the autoregressive process is then applied in the forward direction to recover the filtered original time-course.

#### 2.2.2.2. PCAfilter

#### 2.2.3. Calculate CMRO_{2}

_{t}O

_{2}), relative pulsatile blood flow (pCBF) [39], and estimates of the cerebral metabolic rate of oxygen (CMRO

_{2}). The CMRO

_{2}module within the toolbox pipeline supports both a steady-state and dynamic model of metabolism. The CMRO

_{2}models are given by the two models:

_{0}) and blood volume/total hemoglobin (HbT(t)/HbT

_{0}), and blood flow signals respectively. OEF(t) is the oxygen extraction fraction (OEF = (S

_{a}O

_{2}− S

_{v}O

_{2})/S

_{a}O

_{2}where S

_{a}O

_{2}and S

_{v}O

_{2}are the arterial and venous oxygen saturations). Further details of these models can be found in Hoge et al. [40] and Rierra et al. [41]. These two model versions are then fit to the fNIRS data using the option of either a nonlinear search method or an extended Kalman filter implementation. The output of these modules is an estimate of the state variables (flow, CMRO

_{2}) as time-course variables in the toolbox. Using these models, oxygen metabolism, oxygen extraction fraction, and blood flow can be estimated as hidden state variables from fNIRS measurements of the changes in oxy- and deoxy-hemoglobin under the assumptions of the two models. It is important to note that these are not directly measured variables and users are strongly encouraged to background in the Hoge et al. [40] and Rierra et al. [41] in order to understand the limitations of these models. Although some research shows that these simplified models may not estimate oxygen metabolism as accurately when compared to more detailed multiple compartment models [42,43,44], these models may provide some basis to interpret the relationships of oxy- and deoxy-hemoglobin signals.

#### 2.2.4. HOMER-2 Interface

## 3. Statistical Modules

#### 3.1. First-Level Statistical Models

#### 3.1.1. OLS

#### 3.1.2. AR-IRLS

_{AR}) determined by an Akaike model-order (AIC) selection to whiten both sides of this expression, e.g.,

**W**) is applied to both sides of the original model and then resolved and repeated until convergence. This AR filter alleviates serially correlated errors in the data that result from physiological noise and/or motion artifacts. AR whitening, however, does not address the heavy-tailed noise from motion artifacts. To do this, the AR-whitened model is solved using robust weighted regression, which is a procedure to iteratively down-weight outliers such as motion artifacts.

_{AR}**S**is

#### 3.1.3. NIRS-SPM

#### 3.1.4. Nonlinear GLM

#### 3.2. Canonical and Basis Sets

#### 3.2.1. Canonical HRF

^{−1}) and ${b}_{2}$ (default 1 s

^{−1}) are the dispersion times constants for the peak and undershoot period, and ${a}_{1}$ (default 4 s) and ${a}_{2}$ (default 16 s) are the peak time and undershoot time. c (default 1/6) is the ratio of the height of the main peak to the undershoot. $\mathsf{\Gamma}$(.) is the scalar value of the gamma function and is a normalizing factor. The canonical basis set has the option to include the first derivatives in the regression model, which are computed as a finite difference with respect to the ${a}_{1}$ and ${b}_{1}$ variables.

#### 3.2.2. Gamma Function

^{−1}) is the dispersion times constants and ${a}_{1}$ (default 6 s) is the peak time.

#### 3.2.3. Boxcar Function

#### 3.2.4. FIR-Deconvolution

#### 3.2.5. FIR-Impulse Response Deconvolution

#### 3.2.6. General Canonical

#### 3.2.7. Vestibular Canonical

#### 3.3. Parametric Models

#### 3.4. Comparison of Models

#### 3.5. Second-Level Statistical Models

**A**is the fixed effects model and

**B**is the random effects model matrices. In this example of using inclusion of the age as a cofactor is given by

_{low}, $\Gamma $

_{med}, and $\Gamma $

_{highT}denote the main group level effects for the three task conditions and the terms $\Gamma $

_{X:Age}denote the interaction terms between the three conditions and age. The second matrix (

**B**) and coefficients ($\mathsf{\Theta}$) denote the random effects terms (here indicating subject as a random effect).

**I**

_{CHAN}is an identity matrix of size number of fNIRS source-to-detector pairs and ⊗ is the Kronecker operator. In this way, all fNIRS source-detector pairs are analyzed simultaneously, which allows the use of the full covariance noise model (including spatial relationships) to be used in whitening the model via Equation (17). When running the higher-order statistical models, there is a program flag for including “diagnostics” as part of the toolbox. If selected, this flag will store additional model assessment information in the output variable which can be used to select outlier subjects, examine goodness-of-fit of the model, and plot the model (e.g., showing a scatter plot of how brain activity varies with age).

## 4. Image Reconstruction Modules

_{2}and Hb in the tissue and the changes in optical density using a hierarchal Bayesian inverse model. The group-level image is reconstructed by involving random-effects. The statistical testing for the significance of the solution is also given in the image reconstruction module.

#### 4.1. Optical Forward Model

_{2}and Hb in the tissue, and the changes in optical density as recorded on the surface between optical sources and detectors. The toolbox is using the implementation of optical forward model in NIRFAST toolbox [19,20] that is integrated into our toolbox as an external resource. The toolbox also interfaces with the Mesh-based Monte Carlo (MMC) [51], graphics processing unit (GPU) based Monte Carlo eXtreme (MCX) [24], and volume-based Monte Carlo (tMCimg) [26] models. A semi-infinite slab solution is also included. These forward model solvers will generate the linear optical forward model jacobian (A

_{i,j}) in a consistent form across all solvers. The optical forward model describes the relationship between changes in hemoglobin in the underlying brain space and the optical density measurements between optodes and is given by the expression

#### 4.2. Hierarchal Bayesian Inverse Models

#### 4.3. Group-Level Image Reconstruction

#### 4.4. Statistical Testing

_{0}, T follows a Student t distribution with $N-\mathrm{tr}\left(\mathbb{H}\right)$ degrees of freedom. Then the statistic and degrees of freedom can be used to report the p-value for the significance of ${\beta}_{j}$. In order to save memory in the code, the Cholesky decomposition of the covariance matrix Equation (17b) is stored instead of the full model and the full elements are computed as needed.

## 5. Connectivity and Hyper-Scanning Modules

#### 5.1. Correlation Models

#### 5.1.1. Pre-Whitening

_{{t}}) can be predicted based on the last several time-points in its history (a

_{1}

^{.}Y

_{{t−1}}… a

_{p}

^{.}Y

_{{t−1}}) and newly added information at that time point, which is called the innovations ($\mathsf{\epsilon}$

_{{t}}). The innovations can be thought of as the new information that is added to the total signal at each time point. The innovations time-course is a whitened signal with no autocorrelation representing the signal information added at each time point. The innovations signal can be estimated by first fitting the autoregressive coefficients of the model and using them to filter the original signal. Pre-whitening is applied to any two signals A and B to yield their respective whitened innovations models A

_{w}and B

_{w}. Instead of correlating the original signals, the two innovations (A

_{w}and B

_{w}) are compared which estimates the correlation of the addition of only the new information being added to both signals at each time point. So-called Wiener causality models [55] are an implementation of this concept that specially look at the relationship of lagged cross terms in the innovations (e.g., the history of signal B predicts the current value of A). In the remainder of this section however, we focus on the zeroth lag correlation terms.

#### 5.1.2. Robust Methods

#### 5.2. Coherence Models

^{2}):

#### 5.3. Hyperscanning

#### 5.4. Group Connectivity Models

#### 5.5. Graph-Models

## 6. Toolbox Utilities

#### 6.1. Probe Registration

#### 6.2. Depth-Maps

#### 6.3. Region of Interest Analysis

^{T}would average over the 2nd and 3rd channel entries.

**H**). The optical forward model (see Section 4) defines the sensitivity of the measurements in channel space to underlying changes in the brain space. This model is calculated by estimation or simulation of the diffusion of light through the tissue (see [67] for details).

_{ROI}and c

_{COND}are the contrast vectors for the region-of-interest (ROI) and for the pooling of conditions. For statistical testing of the region-of-interest, this contrast vector defines the expected response in channel space given the region in brain space. Thus, Equation (37) test the null hypothesis that the signal from the region-of-interest is equal to zero. This does not test if the activity specifically came from only that region. In other words, this does not test if the entire region is active or just a subset. It also does not rule out that the activity could have been from a nearby region, which was also covered by that source-detector pair. This also assumes the optical forward model and probe registration are accurate. Any mismatch in the registration or forward model (e.g., as a result of anatomical differences including brain atrophy) will mean that the contrast vector is testing a slightly non-optimal hypothesis. As discussed in [15], using a sub-optimal contrast vector for the hypothesis is equivalent to using the wrong time-window for computing the effect. In this case, it is akin to a weighted average across the wrong combination of channels. This introduces type-II error (e.g., the false-negative rate will increase and one might miss activity that actually was significant), but does not introduce type I error (false-positive rate).

#### 6.4. Regression Testing

#### 6.4.1. Data Simulation

#### Noise Generation

**S**is the $N\times N$ dimensional covariance matrix between channels.

#### Stimulus Generation

_{2}and Hb) of the brain at stimulus onsets are simulated using the function given by Equation (15).

#### 6.4.2. ROC Definitions

_{2}and Hb, i.e., stimulus present. Then, sort the p-values and use each unique value as the threshold. The false positive rate (FPR) and true positive rate (TPR) at each threshold can be calculated by the fraction of the voxels/ROIs with a p-value that is smaller than or equal to the threshold using stimulus present and noise-only dataset respectively. The ROC curve is defined as TPR against FPR. The area under the ROC curve (AUC) [68] means the probability that the HbO

_{2}and Hb changes in stimulus-containing voxels/ROIs are more significant than that in noise-only voxels/ROIs based on the estimations given by the pipeline. Therefore, a larger AUC indicates higher detection accuracy.

## 7. Graphical Interfaces

## 8. Minimum Processing Recommendations

## 9. Future Direction

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## References

- Wolf, M.; Ferrari, M.; Quaresima, V. Progress of near-infrared spectroscopy and topography for brain and muscle clinical applications. J. Biomed. Opt.
**2007**, 12, 062104. [Google Scholar] [PubMed] - Ferrari, M.; Quaresima, V. A brief review on the history of human functional near-infrared spectroscopy (fNIRS) development and fields of application. Neuroimage
**2012**, 63, 921–935. [Google Scholar] [CrossRef] [PubMed] - Scholkmann, F.; Kleiser, S.; Metz, A.J.; Zimmermann, R.; Pavia, J.M.; Wolf, U.; Wolf, M. A review on continuous wave functional near-infrared spectroscopy and imaging instrumentation and methodology. Neuroimage
**2014**, 85, 6–27. [Google Scholar] [CrossRef] [PubMed][Green Version] - 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**, 23, 275S–S288. [Google Scholar] [CrossRef] [PubMed] - Tachtsidis, I.; Scholkmann, F. False positives and false negatives in functional near-infrared spectroscopy: Issues, challenges, and the way forward. Neurophotonics
**2016**, 3, 031405. [Google Scholar] [CrossRef] [PubMed] - Takahashi, T.; Takikawa, Y.; Kawagoe, R.; Shibuya, S.; Iwano, T.; Kitazawa, S. Influence of skin blood flow on near-infrared spectroscopy signals measured on the forehead during a verbal fluency task. Neuroimage
**2011**, 57, 991–1002. [Google Scholar] [CrossRef] [PubMed] - Lloyd-Fox, S.; Blasi, A.; Elwell, C.E. Illuminating the developing brain: The past, present and future of functional near infrared spectroscopy. Neurosci. Biobehav. Rev.
**2010**, 34, 269–284. [Google Scholar] [CrossRef] [PubMed] - Obrig, H. NIRS in clinical neurology—A ‘promising’ tool? Neuroimage
**2014**, 85 Pt 1, 535–546. [Google Scholar] [CrossRef] [PubMed] - Huppert, T.J.; Barker, J.W.; Schmidt, B.; Walls, S.; Ghuman, A. Comparison of group-level, source localized activity for simultaneous functional near-infrared spectroscopy-magnetoencephalography and simultanous fNIRS-fMRI during parametric median nerve stimulation. Neurophotonics
**2017**, 4, 015001. [Google Scholar] [CrossRef] [PubMed] - Yucel, M.A.; Selb, J.J.; Huppert, T.J.; Franceschini, M.A.; Boas, D.A. Functional near infrared spectroscopy: Enabling routine functional brain imaging. Curr. Opin. Biomed. Eng.
**2017**, 4, 78–86. [Google Scholar] [CrossRef] [PubMed] - Miyai, I.; Tanabe, H.C.; Sase, I.; Eda, H.; Oda, I.; Konishi, I.; Tsunazawa, Y.; Suzuki, T.; Yanagida, T.; Kubota, K. Cortical mapping of gait in humans: A near-infrared spectroscopic topography study. Neuroimage
**2001**, 14, 1186–1192. [Google Scholar] [CrossRef] [PubMed] - Quaresima, V.; Ferrari, M. Functional near-infrared spectroscopy (fNIRS) for assessing cerebral cortex function during human behavior in natural/social situations: A concise review. Organ. Res. Methods
**2016**. [Google Scholar] [CrossRef] - SPSS. Available online: www.ibm.com/products/spss-statistics (accessed on 28 March 2018).
- SAS. Available online: www.sas.com (accessed on 28 March 2018).
- Huppert, T.J. Commentary on the statistical properties of noise and its implication on general linear models in functional near-infrared spectroscopy. Neurophotonics
**2016**, 3, 010401. [Google Scholar] [CrossRef] [PubMed] - Barker, J.W.; Aarabi, A.; Huppert, T.J. Autoregressive model based algorithm for correcting motion and serially correlated errors in fnirs. Biomed. Opt. Express
**2013**, 4, 1366–1379. [Google Scholar] [CrossRef] [PubMed] - Barker, J.W.; Rosso, A.L.; Sparto, P.J.; Huppert, T.J. Correction of motion artifacts and serial correlations for real-time functional near-infrared spectroscopy. Neurophotonics
**2016**, 3, 031410. [Google Scholar] [CrossRef] [PubMed] - Santosa, H.; Aarabi, A.; Perlman, S.B.; Huppert, T.J. Characterization and correction of the false-discovery rates in resting state connectivity using functional near-infrared spectroscopy. J. Biomed. Opt.
**2017**, 22, 055002. [Google Scholar] [CrossRef] [PubMed] - Huppert, T.J.; Diamond, S.G.; Franceschini, M.A.; Boas, D.A. Homer: A review of time-series analysis methods for near-infrared spectroscopy of the brain. Appl. Opt.
**2009**, 48, D280–D298. [Google Scholar] [CrossRef] [PubMed] - Ye, J.C.; Tak, S.; Jang, K.E.; Jung, J.; Jang, J. NIRS-SPM: Statistical parametric mapping for near-infrared spectroscopy. Neuroimage
**2009**, 44, 428–447. [Google Scholar] [CrossRef] [PubMed] - Jermyn, M.; Ghadyani, H.; Mastanduno, M.A.; Turner, W.; Davis, S.C.; Dehghani, H.; Pogue, B.W. Fast segmentation and high-quality three-dimensional volume mesh creation from medical images for diffuse optical tomography. J. Biomed. Opt.
**2013**, 18, 086007. [Google Scholar] [CrossRef] [PubMed] - Dehghani, H.; Eames, M.E.; Yalavarthy, P.K.; Davis, S.C.; Srinivasan, S.; Carpenter, C.M.; Pogue, B.W.; Paulsen, K.D. Near infrared optical tomography using NIRFAST: Algorithm for numerical model and image reconstruction. Commun. Numer. Methods Eng.
**2008**, 25, 711–732. [Google Scholar] [CrossRef] [PubMed] - Fang, Q.; Boas, D. Tetrahedral mesh generation from volumetric binary and gray-scale images. In Proceedings of the IEEE International Symposium on Biomedical Imaging, Boston, MA, USA, 28 June–1 July 2009; pp. 1142–1145. [Google Scholar]
- Fang, Q.; Kaeli, D.R. Accelerating mesh-based Monte Carlo method on modern CPU architectures. Biomed. Opt. Express
**2012**, 3, 3223–3230. [Google Scholar] [CrossRef] [PubMed] - Chen, J.; Fang, Q.; Intes, X. Mesh-based Monte Carlo method in time-domain widefield fluorescence molecular tomography. J. Biomed. Opt.
**2012**, 17, 106009. [Google Scholar] [CrossRef] [PubMed] - 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**, 10, 159–170. [Google Scholar] [CrossRef] [PubMed] - Benjamini, Y.; Hochberg, E. Controlling the false discovery rate: A practical and powerful approach to multiple testing. J. R. Stat. Soc. B Methodol.
**1995**, 57, 289–300. [Google Scholar] - Harcum, J.B.; Dressing, S.A. Technical Memorandum #3: Minimum Detectable Change and Power Analysis; Agency USEP: Washington, DC, USA, 2015; p. 10. [Google Scholar]
- Hotelling, H. The generalization of student’s ratio. Ann. Math. Stat.
**1931**, 2, 360–378. [Google Scholar] [CrossRef] - CIFTI-2 Specification. Available online: https://www.nitrc.org/projects/cifti/ (accessed on 28 March 2018).
- Huppert, T.J.; Diamond, S.G.; Boas, D.A. Direct estimation of evoked hemoglobin changes by multimodality fusion imaging. J. Biomed. Opt.
**2008**, 13, 054031. [Google Scholar] [CrossRef] [PubMed] - Yucel, M.A.; Evans, K.C.; Selb, J.; Huppert, T.J.; Boas, D.A.; Gagnon, L. Validation of the hypercapnic calibrated fMRI method using DOT-fMRI fusion imaging. Neuroimage
**2014**, 102 Pt 2, 729–735. [Google Scholar] [CrossRef] [PubMed] - Abdelnour, F.; Genovese, C.; Huppert, T. Hierarchical bayesian regularization of reconstructions for diffuse optical tomography using multiple priors. Biomed. Opt. Express
**2010**, 1, 1084–1103. [Google Scholar] [CrossRef] [PubMed] - Jacques, S.L. Optical properties of biological tissues: A review. Phys. Med. Biol.
**2013**, 58, R37–R61. [Google Scholar] [CrossRef] [PubMed] - Molavi, B.; Dumont, G.A. Wavelet-based motion artifact removal for functional near-infrared spectroscopy. Physiol. Meas.
**2012**, 33, 259–270. [Google Scholar] [CrossRef] [PubMed] - Abdelnour, F.; Huppert, T. A random-effects model for group-level analysis of diffuse optical brain imaging. Biomed. Opt. Express
**2010**, 2, 1–25. [Google Scholar] [CrossRef] [PubMed] - Abdelnour, F.; Schmidt, B.; Huppert, T.J. Topographic localization of brain activation in diffuse optical imaging using spherical wavelets. Phys. Med. Biol.
**2009**, 54, 6383–6413. [Google Scholar] [CrossRef] [PubMed] - Zhang, Y.; Brooks, D.H.; Franceschini, M.A.; Boas, D.A. Eigenvector-based spatial filtering for reduction of physiological interference in diffuse optical imaging. J. Biomed. Opt.
**2005**, 10, 11014. [Google Scholar] [CrossRef] [PubMed] - Themelis, G.; D’Arceuil, H.; Diamond, S.G.; Thaker, S.; Huppert, T.J.; Boas, D.A.; Franceschini, M.A. Near-infrared spectroscopy measurement of the pulsatile component of cerebral blood flow and volume from arterial oscillations. J. Biomed. Opt.
**2007**, 12, 014033. [Google Scholar] [CrossRef] [PubMed] - Hoge, R.D.; Franceschini, M.A.; Covolan, R.J.; Huppert, T.; Mandeville, J.B.; Boas, D.A. Simultaneous recording of task-induced changes in blood oxygenation, volume, and flow using diffuse optical imaging and arterial spin-labeling MRI. Neuroimage
**2005**, 25, 701–707. [Google Scholar] [CrossRef] [PubMed] - Riera, J.J.; Watanabe, J.; Kazuki, I.; Naoki, M.; Aubert, E.; Ozaki, T.; Kawashima, R. A state-space model of the hemodynamic approach: Nonlinear filtering of bold signals. Neuroimage
**2004**, 21, 547–567. [Google Scholar] [CrossRef] [PubMed] - Huppert, T.J.; Allen, M.S.; Diamond, S.G.; Boas, D.A. Estimating cerebral oxygen metabolism from fMRI with a dynamic multicompartment windkessel model. Hum. Brain Mapp.
**2009**, 30, 1548–1567. [Google Scholar] [CrossRef] [PubMed] - Boas, D.A.; Jones, S.R.; Devor, A.; Huppert, T.J.; Dale, A.M. A vascular anatomical network model of the spatio-temporal response to brain activation. Neuroimage
**2008**, 40, 1116–1129. [Google Scholar] [CrossRef] [PubMed] - Huppert, T.J.; Allen, M.S.; Benav, H.; Jones, P.B.; Boas, D.A. A multicompartment vascular model for inferring baseline and functional changes in cerebral oxygen metabolism and arterial dilation. J. Cereb. Blood Flow Metab.
**2007**, 27, 1262–1279. [Google Scholar] [CrossRef] [PubMed] - Beaton, A.E.; Tukey, J.W. The fitting of power series, meaning polynomials, illustrated on band-spectroscopic data. Technometrics
**1974**, 16, 147–185. [Google Scholar] [CrossRef] - Jang, K.E.; Tak, S.; Jung, J.; Jang, J.; Jeong, Y.; Ye, J.C. Wavelet minimum description length detrending for near-infrared spectroscopy. J. Biomed. Opt.
**2009**, 14, 034004. [Google Scholar] [CrossRef] [PubMed] - Karim, H.; Fuhrman, S.I.; Sparto, P.; Furman, J.; Huppert, T. Functional brain imaging of multi-sensory vestibular processing during computerized dynamic posturography using near-infrared spectroscopy. Neuroimage
**2013**, 74, 318–325. [Google Scholar] [CrossRef] [PubMed] - Karim, H.T.; Fuhrman, S.I.; Furman, J.M.; Huppert, T.J. Neuroimaging to detect cortical projection of vestibular response to caloric stimulation in young and older adults using functional near-infrared spectroscopy (fNIRS). Neuroimage
**2013**, 76, 1–10. [Google Scholar] [CrossRef] [PubMed] - Karim, H.T.; Sparto, P.J.; Aizenstein, H.J.; Furman, J.M.; Huppert, T.J.; Erickson, K.I.; Loughlin, P.J. Functional MR imaging of a simulated balance task. Brain Res.
**2014**, 1555, 20–27. [Google Scholar] [CrossRef] [PubMed] - Wilkinson, G.N.; Rogers, C.E. Symbolic description of factorial models for analysis of variance. J. R. Stat. Soc. Ser. C (Appl. Stat.)
**1973**, 22, 3920399. [Google Scholar] [CrossRef] - Fang, Q. Mesh-based Monte Carlo method using fast ray-tracing in Plucker coordinates. Biomed. Opt. Express
**2010**, 1, 165–175. [Google Scholar] [CrossRef] [PubMed] - Arridge, S.R. Optical tomography in medical imaging. Inverse Probl.
**1999**, 15, R41. [Google Scholar] [CrossRef] - Cule, E.; Vineis, P.; De Iorio, M. Significance testing in ridge regression for genetic data. BMC Bioinform.
**2011**, 12, 372. [Google Scholar] [CrossRef] [PubMed] - Schwarz, G. Estimating the dimension of a model. Ann. Stat.
**1978**, 6, 461–464. [Google Scholar] [CrossRef] - Wiener, N. The theory of prediction. In Modern Mathematics for the Engineer; Beckenbach, E.F., Ed.; McGraw-Hill: New York, NY, USA, 1956. [Google Scholar]
- Grinsted, A.; Moore, J.C.; Jevrejeva, S. Application of the cross wavelet transform and wavelet coherence to geophysical time series. Nonlinear Process. Geophys.
**2004**, 11, 561–566. [Google Scholar] [CrossRef] - Rubinov, M.; Sporns, O. Complex network measures of brain connectivity: Uses and interpretations. Neuroimage
**2010**, 52, 1059–1069. [Google Scholar] [CrossRef] [PubMed] - Langville, A.; Meyer, C. Google’s PageRank and Beyond: The Science of Search Engine Rankings; Princeton University Press: Princeton, NJ, USA, 2006. [Google Scholar]
- Bonacich, P. Factoring and weighting approaches to status scores and clique identification. J. Math. Sociol.
**1972**, 2, 113–120. [Google Scholar] [CrossRef] - Bonanich, P. Some unique properties of eigenvector centrality. Soc. Netw.
**2007**, 29, 555–564. [Google Scholar] [CrossRef] - Aasted, C.M.; Yücel, M.A.; Cooper, R.J.; Dubb, J.; Tsuzuki, D.; Becerra, L.; Petkov, M.P.; Borsook, D.; Dan, I.; Boas, D.A. Anatomical guidance for functional near-infrared spectroscopy: AtlasViewer tutorial. Neurophotonics
**2015**, 2, 020801. [Google Scholar] [CrossRef] [PubMed] - Holmes, C.J.; Hoge, R.; Collins, L.; Woods, R.; Toga, A.W.; Evans, A.C. Enhancement of mr images using registration for signal averaging. J. Comput. Assist. Tomogr.
**1998**, 22, 324–333. [Google Scholar] [CrossRef] [PubMed] - Dale, A.M.; Fischl, B.; Sereno, M.I. Cortical surface-based analysis. I. Segmentation and surface reconstruction. Neuroimage
**1999**, 9, 179–194. [Google Scholar] [CrossRef] [PubMed] - Tzourio-Mazoyer, N.; Landeau, B.; Papathanassiou, D.; Crivello, F.; Etard, O.; Delcroix, N.; Mazoyer, B.; Joliot, M. Automated anatomical labeling of activations in SPM using a macroscopic anatomical parcellation of the MNI MRI single-subject brain. Neuroimage
**2002**, 15, 273–289. [Google Scholar] [CrossRef] [PubMed] - Rolls, E.T.; Joliot, M.; Tzourio-Mazoyer, N. Implementation of a new parcellation of the orbitofrontal cortex in the automated anatomical labeling atlas. Neuroimage
**2015**, 122, 1–5. [Google Scholar] [CrossRef] [PubMed] - Fischl, B.; van der Kouwe, A.; Destrieux, C.; Halgren, E.; Segonne, F.; Salat, D.H.; Busa, E.; Seidman, L.J.; Goldstein, J.; Kennedy, D.; et al. Automatically parcellating the human cerebral cortex. Cereb. Cortex
**2004**, 14, 11–22. [Google Scholar] [CrossRef] [PubMed] - Huppert, T.J.; Karim, H.; Lin, C.C.; Alqahtani, B.A.; Greenspan, S.L.; Sparto, P.J. Functional imaging of cognition in an old-old population: A case for portable functional near-infrared spectroscopy. PLoS ONE
**2017**, 12, e0184918. [Google Scholar] [CrossRef] [PubMed] - Hanley, J.A.; McNeil, B.J. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology
**1982**, 143, 29–36. [Google Scholar] [CrossRef] [PubMed]

**Figure 1.**Example plot for data objects: (

**a**) Example time series from 3 fNIRS channels with stimulus information shown along the bottom. An example of the same probe object shown in (

**b**) 2D probe geometry; (

**c**) 10–20 International System, and (

**d**) registered 3D probe geometry is also demonstrated.

**Figure 2.**Illustration of the parametric stimulus design: (

**a**) Conventional box-car function as the stimulus design; (

**b**) parametric stimulus design with time varying models; (

**c**) evoked signal from parametric stimulus design in (

**b**).

**Figure 3.**General linear model (GLM) comparison of no motion (left column) and motion-affected (right column). In panels (

**a**,

**d**), raw signals with no motion artifacts and with artifacts are shown. After simulations, the ROC curves for the various processing applied to the simulated data are shown in (

**b**,

**e**). Panels (

**c**,

**f**) show control for type-I errors for the same data and processing. An ideal curve would be along the diagonal (slope = 1), where the reported and actual FPRs would be the same.

**Figure 4.**Group level comparison of no outliers (left column) and with outliers (right column). In panels (

**a**,

**d**), raw signals with no outliers and with outliers are shown. After simulations, the ROC curves for the various processing in the group level applied to the simulated data are shown in (

**b**,

**e**). Panels (

**c**,

**f**) show control for type-I errors for the same data and processing. An ideal curve would be along the diagonal (slope = 1), where the reported and actual FPRs would be the same.

**Figure 5.**Examples of connectivity analyses employed by AnalyzIR: (

**a**) Connectivity between two subjects during cooperation on a puzzle task; (

**b**) relative PageRank centrality for a single subject.

**Figure 6.**The fNIRS probe was registered to the Colin27 atlas, which was used in combination with the automatic anatomical labeling toolbox (AAL2) to label the Brodmann area 10. The images above show topology maps (Clarke azimuthal map projection) showing the depth of the nearest cortical point in the region-of-interest to the surface of the head. A yellow indicates a depth of greater than 30 mm, which would be inaccessible to fNIRS.

Class | Purpose | Methods | Description |
---|---|---|---|

nirs.core.Data | Holds time-series information including stimulus events | < >.draw([channel index]) | Draws the time-course of a channel of data |

nirs.core.Probe | Holds information about | < >.draw() | Draws the layout of the probe in 2D or 3D |

the probe design and | <> .default_draw_function | Sets the default draw behavior on 3D registered probes | |

registration | < >.link | A table describing the connections of source-detector pairs | |

< >.optodes | A table describing the source-detector and any additional probe points | ||

nirs.core.ChannelStats | Holds the statistical maps in | < >.draw(type,range,alpha) | Draws the statistical map according to the probe |

first and second-level | < >.table | Returns a formatted table of the statistical values | |

analysis | < >.ttest(conditions) | Performs a student’s t-test to compare two or more contrasts | |

< >.jointTest() | Returns a FChannelStats variable for the T^2 test using HbO_{2}/Hb | ||

< >.printAll(*, outfolder, imagetype) | Draws and saves the figures in TIFF or JPEG format | ||

< >.sorted | Returns sorted stats by columns in variables | ||

nirs.core.ChannelFStats | Holds F-statistics in channel | < >.draw(range, alpha) | Draws the statistical map according to the probe |

Space | < >.table | Returns a table of all channel wise stats | |

< >.getCritF | Returns critical F value | ||

nirs.core.ImageStats | Holds the statistics for reconstructed images | < >.draw(type, range, alpha, beta, [power]) | Draws the statistical map according to the probe |

< >.jointTest() | Performs a joint hypothesis test across all channels in each source-detector pair | ||

nirs.core.sFCStats | Holds connectivity and | < >.draw | Draws the correlation values |

hyper-scanning statistical | < >.table | Returns a table of all stats | |

models | < >.graph | Returns a graph object from the connectivity model |

Modules | Description | Citation |
---|---|---|

Pre-processing | ||

BeerLambertLaw | Converts optical density to hemoglobin | [34] |

Resample | Nyquist filter and resample the data | Matlab: resample.m function |

OpticalDensity | Conversion of raw data to optical density | |

Data management | ||

AddDemographics | Add subject information from the table | |

ChangeStimulusInfo | Change stimulus info to data given a table | |

DiscardStims | Removes specified stimulus conditions from design | |

FixStims | Modify onset/duration/amplitude of stimulus | |

KeepStims | Removes all stimuli except those specified | |

RemoveStimLess | Discard data files with no stimulus information | |

Filter | ||

BaselineCorrection | Motion-correction filter to remove DC sifts | See Section 2.2.2.1 |

PCAFilter | PCA filter for motion or physiology | [19] |

WaveletFilter | Filter to remove outliers and low-frequency characteristics | [35] |

Statistical analysis | ||

ANOVA | Group-level ANOVA model | Matlab: fitlme.m function |

AR-IRLS | GLM analysis using autoregressive model | [16] |

Connectivity | Computes all-to-all connectivity model | [18] |

Hyperscanning | Computes all-to-all connectivity between two files | [18] |

ImageReconstruction | Subject or group-level image reconstruction model | [33,36,37] |

MixedEffects | Group-level linear mixed effects model | Matlab: fitlme.m function |

NIRS-SPM | GLM analysis using NIRS-SPM | [20] |

OLS | GLM analysis using ordinary least squares | [19] |

RemoveOutlierSubjects | Flags and removes outlier subjects based on leverage | |

SubjLevelStats | Subject-level analysis | Matlab: fitlme.m function |

Additional | ||

HOMER2 | Interface to HOMER2 code | [10,19] |

Formula | Interpretation |
---|---|

beta ~ −1 + cond + (1|subject) | Effect of condition, controlling for subject |

beta ~ −1 + group:cond + (1|age) | Effect of condition for each group, controlling for age |

beta ~ −1 + group + cond + group*cond + (1|IQ) | Main effects of group and condition, and a group x condition interaction, controlling for IQ |

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Santosa, H.; Zhai, X.; Fishburn, F.; Huppert, T. The NIRS Brain AnalyzIR Toolbox. *Algorithms* **2018**, *11*, 73.
https://doi.org/10.3390/a11050073

**AMA Style**

Santosa H, Zhai X, Fishburn F, Huppert T. The NIRS Brain AnalyzIR Toolbox. *Algorithms*. 2018; 11(5):73.
https://doi.org/10.3390/a11050073

**Chicago/Turabian Style**

Santosa, Hendrik, Xuetong Zhai, Frank Fishburn, and Theodore Huppert. 2018. "The NIRS Brain AnalyzIR Toolbox" *Algorithms* 11, no. 5: 73.
https://doi.org/10.3390/a11050073