# The NIRS Brain AnalyzIR Toolbox
## 4 Image Reconstruction Modules
### Optical Forward Model  
Optical forward model describes the relationship between changes in concentrations of HbO\({}_{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  
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. 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  
\[\Delta OD_{i,j}^{\lambda}=\mathrm{A}_{i,j}^{\lambda}\cdot\left[\varepsilon_{ \mathrm{HbO}_{2}}^{\lambda}\cdot\left(\Delta[\mathrm{HbO}_{2}]+\omega_{\mathrm{ HbO}_{2}}\right)+\varepsilon_{\mathrm{Hb}}^{\lambda}\cdot\left(\Delta[ \mathrm{Hb}]+\omega_{\mathrm{Hb}}\right)\right]+v_{i,j}^{\lambda} \tag{19}\]  
where \(\Delta OD_{i,j}^{\lambda}\) is the change in optical density, \(\mathrm{A}_{i,j}^{\lambda}\) is the jacobian of the optical measurement model corresponding to the sensitivity matrix [52], and \(v_{i,j}^{\lambda}\) is an additive noise in the measurement space along the diffuse path traveled by the light between light emitter and detector pair \((i,j)\) at the wavelength \(\lambda\). \(\varepsilon_{\mathrm{HbX}}^{\lambda}\) is the molar extinction coefficient, \(\Delta[\mathrm{HbX}]\) is the change in molar concentration (fixed effect), and \(\omega_{\mathrm{HbX}}\) is an additive noise (random effect) in the image space for oxy- or deoxy-hemoglobin. \(\Delta[\mathrm{HbX}]\) and \(\omega\) are vectors representing the changes at each position. Changes in oxy- and deoxy-hemoglobin can be inferred from optical measurements at multiple (\(N\)) wavelengths by solving the forward model with spectral priors given by the expression  
\[\left[ \begin{array}{c}\Delta OD_{i,j}^{\lambda_{1}}\\ \Delta OD_{i,j}^{\lambda_{2}}\\ \vdots\\ \Delta OD_{i,j}^{\lambda_{N}}\end{array} \right]=\left[ \begin{array}{cc} \mathrm{A}_{i,j}^{\lambda_{1}}+\varepsilon_{\mathrm{HbO}_{2}}^{\lambda_{1}}& \mathrm{A}_{i,j}^{\lambda_{1}}\cdot\varepsilon_{\mathrm{Hb}}^{\lambda_{1}}\\ \mathrm{A}_{i,j}^{\lambda_{2}}\cdot\varepsilon_{\mathrm{HbO}_{2}}^{\lambda_{2} }&\mathrm{A}_{i,j}^{\lambda_{2}}\cdot\varepsilon_{\mathrm{Hb}}^{\lambda_{2}} \\ \vdots&\vdots\\ \mathrm{A}_{i,j}^{\lambda_{N}}\end{array} \right]\cdot\left(\left[ \begin{array} []{c}\Delta[\mathrm{HbO}_{2}]\\ \Delta[\mathrm{Hb}]\end{array} \right]+\left[ \begin{array}{c}\omega_{\mathrm{ HbO}_{2}}\\ \omega_{\mathrm{Hb}}\end{array} \right]\right)+\left[ \begin{array}{c}\omega_{ \mathrm{HbO}_{2}}\\ \vdots\\ \upsilon_{i,j}^{\lambda_{N}}\end{array} \right] \tag{20}\]  
where \(\lambda_{N}\) denotes the \(N\)-th wavelength. The optical forward model can be written in a compact form using matrix notation. \[\mathbf{Y}=\mathbf{H}\cdot\left(\mathbf{\beta}+\mathbf{\omega}\right)+\mathbf{v}\] (21a) where \[\mathbf{\beta}\] is used to describe the unknown values of the combination of oxy- or deoxy-hemoglobin changes in the tissue, given by \[\mathbf{\beta}=\left[ \begin{array}{c}\Delta[\mathrm{HbO}_{2}]\\ \Delta[\mathrm{Hb}]\end{array}