PHOEBE: a method for real time mapping of optodes-scalp coupling in functional near-infrared spectroscopy

: Recent functional instrumentation encompasses several dozen of optodes to enable reconstructing a hemodynamic image of the entire cerebral cortex. Despite its potential clinical applicability, widespread use of fNIRS with human subjects is currently limited by unresolved issues, namely the collection from the entirety of optical channels of signals with a signal-to-noise ratio (SNR) sufficient to carry out a reliable estimation of cortical hemodynamics, and the considerable amount of time that placing numerous optodes take with individuals for whom achieving good optical coupling to the scalp is difficult due to thick or dark hair. To address these issues, we developed a numerical method that: 1) at the channel level, computes an objective measure of the signal-to-noise ratio (SNR) related to its optical coupling to the scalp, akin to electrode conductivity used in electroencephalography (EEG), and 2) at the optode level, determines and displays the coupling status of all individual optodes in real time on a model of a human head. This approach aims to shorten the pre-acquisition preparation time by visually displaying which optodes require further adjustment for optimum scalp coupling, and to maximize the signal-to-noise ratio (SNR) of all optical channels contributing to the functional hemodynamic mapping. The methodology described in this paper has been implemented in a software tool named PHOEBE (placing headgear optodes efficiently before experimentation) that is freely available for use by the fNIRS community.


Introduction
The ability to map the neural activity of the working brain has revolutionized the study of brain function. Electroencephalography (EEG) and magneto encephalography (MEG) directly measure electrical activity within the brain; positron emission tomography (PET) and functional magnetic resonance imaging (fMRI) measure indirect changes in oxygen metabolism when local neural activity increases. Functional near-infrared spectroscopy (fNIRS) is an optical imaging technique for mapping neural activity that also measures hemodynamic changes in the cerebral cortex associated with brain activity [1]. Benefits of NIRS over other techniques for measuring brain activity are that it is non-harmful, portable, and relatively inexpensive. Changes in concentration of oxyhemoglobin (HbO) and deoxyhemoglobin (HbR) within a neuronally active cortical region are associated to colocalized optical absorption changes in the near-infrared spectral range (650-1000 nm). The latter are measurable in-vivo by transcranially illuminating the cortical region of interest with multiple NIR wavelengths and collecting the backscattered light at a certain distance (typically 25-35 mm) from the illumination point. Although the cortical volume investigated by a single pair of optodes (i.e., one NIR source and one photodetector) is limited to the interspace between the optodes, probing multiple cortical sites concurrently with an array of optodes allows construction of a functional map that reveals both the location and intensity of cortical hemodynamic activity over a much larger cortical area. With recent fNIRS instrumentation encompassing tens of optodes, it is possible to reconstruct a hemodynamic image of the entire cerebral cortex with a lateral resolution on the order of a few centimeters [1], which can be improved to a few millimeters when regional cortical activity is investigated using a smaller but denser optode layout [2,3].
Despite these advantages, use of fNIRS in research on human subjects is currently limited by several unresolved issues. One of the main challenges encountered by fNIRS researchers is collecting optical signals with a signal-to-noise ratio (SNR) from the entire set of channels that is sufficient to carry out a reliable estimation of cortical hemodynamics. Indeed, noisy optical measurements due to weak optical signals may result in areas of the hemodynamic map being functionally undetermined. While the instrument noise associated with photodetectors and front-end electronic amplifiers can be minimized with good engineering practices, collecting strong optical signals is primarily the result of an optimal experimental preparation. One critical aspect to achieving the best preparation is to position the lightemitting and light-collecting optodes in contact with the subject's scalp so as to maximize the transfer of light across the skin/optode interface. Since hair obstructs the delivery and collection of light to and from the scalp, using optodes with small footprints that penetrate the hair layer and parting the hair underneath each optode using a non-abrasive tool helps reduce such optical losses. This issue can usually be overcome by researchers learning through practical experience how to place the headgear to achieve good optode-scalp coupling. Thus, channel-by-channel signal loss can be effectively managed by instituting a quantitative method for verifying an adequate SNR prior to experimental data collection.
This can take a lot of time, particularly when testing an individual with particularly thick or dark hair, because it may be difficult to achieve good optical coupling to the scalp. Although a lengthy experimental setup is generally acceptable in a research environment as a compromise for achieving optimal quality of fNIRS data, this is often not the case for clinical or translational studies of patients recruited from medical clinics. Many patients are not agreeable to participating in long research protocols, particularly after already sitting through a long wait for their clinic appointment. Furthermore, most pediatric patients are intolerant to prolonged sitting for fNIRS research. Therefore, the need for a lengthy preparation time affects human subject cooperation during the data collection period, thus compromising overall data acquisition and quality.
A method that substantially reduces the fNIRS set-up time is fitting the subject with optodes built into an ergonomic headgear that does not require parting the hair optode-byoptode. Although this approach may initially result in optodes with poor scalp contact, the software of most fNIRS instruments provide a channel-level qualitative indicator derived from amplitude and noise levels of the photodetected signals and gain settings of signal amplifiers. However, such software generally does not help with localizing which individual optodes need adjustment, particularly in schemes where optodes are shared amongst a multitude of optical channels. Much like looking for the one burned-out Christmas tree light bulb that is causing the entire string to fail, the process of locating the one optode that is not making good contact can be a time-consuming procedure. To our knowledge, none of the commercial fNIRS instruments provide a localization function of this sort. Therefore, establishing new techniques for optimizing the fNIRS set-up time and the quality of the data acquired will substantially enhance the effectiveness of fNIRS in research and clinical studies alike. Herein, we describe a method that: 1) computes an objective measure of the signal-tonoise ratio (SNR) of a given fNIRS channel, akin to electrode conductivity used in electroencephalography (EEG), and 2) determines and displays the coupling status of all individual optodes in real time on a model of a human head. This approach aims to shorten the pre-acquisition preparation time by visually displaying which optodes require further adjustment for optimum scalp coupling, and to maximize the signal-to-noise ratio (SNR) of all optical channels contributing to the functional hemodynamic mapping.

Overview
The SNR measure of an optical channel relies on the accepted notion that the photoplethysmographic signal associated with the cardiac cycle (i.e., the pulsatile optical signal related to changes in blood volume at the catchment site) must be detected clearly in order to successfully perform an fNIRS measurement [4]. Since the cardiac pulsation in an fNIRS signal is mainly attributed to blood circulation in the scalp, its prominence provides strong evidence of the effective coupling to the scalp of each of the two optodes forming the fNIRS channel. The advantage of this approach over electrical measures, such as amplitude of the photodetected signals or gain setting of the signal amplifiers, is that it is derived directly from physiological readings and is non-specific to the fNIRS instrumentation being used.
To determine the coupling status of each individual optode in fNIRS headgear, we represented the topology of the optical layout as a connected graph in which nodes represent the individual optodes and edges represent the optode pairings weighed by their SNR. Graph theory and Boolean algebra were then applied to univocally determine the uncoupled nodes causing low SNR values of their connected edges.
The methodology described in this paper has been implemented in a software tool called PHOEBE (Placing Headgear Optodes Efficiently Before Experimentation). Once an fNIRS geometric layout is loaded into PHOEBE and data acquisition is initiated using the instrument's software, PHOEBE computes the SNR of each optical channel in real time and displays the coupling status of each optode on a head model, thus providing immediate visual feedback to the experimenter. PHOEBE is freely available for use by the fNIRS community and is compatible with some fNIRS imaging instruments (NIRx NIRScout and NIRSport). Compatibility adjustments to permit use with more devices can certainly be added in the future.

Signal-to-noise ratio of fNIRS channels
The signal to noise ratio of an fNIRS optical channel is strongly related to the optical coupling that each of the two optodes (i.e., one light-emitting optode and one light-collecting optode) forming the channel has with the scalp. In our previous work [5], we introduced an SNR measure of an fNIRS channel called scalp coupling index (SCI) that quantified the prominence of the photoplethysmographic cardiac waveform and which is predominantly associated with the pulsatile volume of blood circulating in the scalp. Originally, SCI was implemented to identify optical channels with poor scalp coupling and thus exclude them from further processing. In this paper, we describe a more robust method for SNR estimation that combines the original definition of SCI with additional power features of the photoplethysmographic cardiac signal. Although we validated the SNR measure on signals obtained with a specific continuous-wave fNIRS instrument (NIRSScout, NIRx Medical Technologies, Glen Head, NY), the proposed method is applicable to signals obtained via any commercial or custom-built fNIRS device able to measure photoplethysmographic cardiac signals.
To compute SCI at a certain time point, the pulsatile cardiac waveform must first be separated from the cortical component (i.e., resting or event-related brain hemodynamics) and other systemic components (i.e., respiration, Mayer waves) by band-pass filtering the raw photodetected signals between 0.5 Hz and 2.5 Hz that correspond to a cardiac pulsation between 30 and 150 beats per minute (bpm). A narrower bandwidth could be set depending on the expected heart rate of the individuals being measured. Heart rate normally depends on experimental conditions (e.g., resting vs. physically active subjects) and population features (e.g., age, medical condition, medication intake, etc.). Since the illuminating optode of a given fNIRS channel typically embeds two co-located sources emitting at distinct wavelengths (e.g., 760 nm and 850 nm in the NIRx NIRSScout), the band-pass filter is applied to both photodetected signals x λ1 (t-T:t) and x λ2 (t-T:t), where T represents a time interval over which SCI is calculated, e.g. the most recent 2 seconds of acquired signals. Although most fNIRS instruments have a data sampling frequency f sampling greater than 5 Hz, the upper cut-off frequency of the band-pass filter is limited by the Shannon-Nyquist sampling theorem (f cut-off ≤ 2·f sampling ). The filtered signals are then normalized to their standard deviation (obtaining 1 x λ and 2 x λ ) to reject the difference between the optical power of sources at wavelengths λ 1 and λ 2 and the difference between values of the extinction coefficient for oxyhemoglobin (Hb) and deoxyhemoglobin (HbR) at the two wavelengths. Finally, SCI is computed as the zero-lag cross-correlation between the normalized signals, i.e.
1 SCI x λ = ⊗ 2 x λ (0), which estimates the similarity between the signals 1 x λ and 2 x λ . Critically, SCI is affected by the specific wavelengths used to measure optical absorptions. While several fNIRS instruments use the shorter of the two light wavelengths in the mid-range of the NIRS spectrum [1] (e.g., NIRx NIRScout: 760 nm, OXYMON MK-III: 760 nm, Spectratech OEG-SpO2: 770 nm, Shimatzu FOIRE-3000: 780 nm), other devices use a near-visible wavelength [1] (e.g., Rogue Research Brainsight: 685 nm, Techen CW6: 690 nm, ISS Imagent: 690 nm, Hitachi ETG-4000: 695 nm) at which the molar extinction of HbR is substantially higher [6], thus resulting in a weaker photodetected signal. Since the cardiac component of an fNIRS signal is mostly associated with blood volume changes in the arterial compartment where the fraction of HbR is significantly lower than the fraction of HbO, the cardiac signal measured using near-visible wavelengths (e.g., 685-705 nm) is usually noisier than the cardiac signal measured using longer wavelengths (e.g., 760-780 nm). Previously, we used an SCI threshold of 0.8 to identify channels with acceptable scalp coupling [5,7]. However, when the scalp coupling is ideal, fNIRS instruments often exhibit an SCI that approaches the maximum value of 1. SCI is also affected by signal artifacts caused by movements of the head or the jaw. These artifacts typically introduce spikes or step-like signal changes whose magnitude is larger than the peak-to-peak amplitude of the cardiac pulsation and which are simultaneously and synchronously present in both optical signals x λ1 and x λ2 , thus yielding a high SCI that falsely indicates a clean signal. To improve the robustness of a quantitative scalp coupling measure even in the presence of such movement artifacts, we used the spectral power of the crosscorrelated signal as an additional estimator of the strength of the cardiac signal. Specifically, a clean optical channel can be objectively distinguished from a noisy optical channel using a spectral power threshold. In theory, photodetected cardiac signals can be modeled with two purely sinusoidal waves x λ1 and x λ2 oscillating at a physiological frequency f cardiac (e.g., 1 Hz, or 60 bpm) and having arbitrary amplitude and offset. The resulting normalized crosscorrelation signal 1 x λ ⊗ 2 x λ has unity amplitude, frequency f cardiac and peak power of 0.5. Thus, a threshold could be set at a certain fraction of the ideal peak power. In reality, cardiac photoplethysmographic signals are not purely sinusoidal and they often bear quantization noise that decreases the peak value of power, hence the threshold value that we recommend is set empirically at 0.1, as is shown in the Results section.
Akin to scalp conductivity used in electroencephalography (EEG), a quantitative estimation of the scalp contact of all fNIRS channels displayed in real time represents a critically important tool for optimal fitting of the fNIRS headgear prior to data acquisition. This requires both SCI and spectral power to be computed in real time by processing a finite portion of the most recently collected signals.

Graph-based topology of the optical layout
A selected fNIRS channel with high SNR value is formed by two optodes that unequivocally have good contact with the scalp. In contrast, a channel with low SNR is formed if either of the two optodes, or both, are uncoupled from the scalp, making it impossible to determine which optode needs to be adjusted to restore a sufficient SNR. Despite this, emitting or detecting optodes are often multiplexed across multiple optical channels to maximize the number of source-detector pairings in an fNIRS probe, and knowing the SNR and the topology of a network of optical channels with shared optodes can allow a user to establish the relationship between the SNR of optical channels and the scalp coupling of individual optodes. This section describes a method that, where possible, identifies uncoupled optodes causing a low SNR of the optical channels among which they are shared.
The relationship between the SNR of a single optical channel and the scalp coupling of its two contributing optodes can be modeled mathematically with the Boolean equation O 1 ∧ O 2 = w 1,2 where O 1 ,O 2 represent the Boolean coupling status of the two optodes (i.e., 0 = uncoupled, 1 = coupled) and w 1,2 is a Boolean value indicating whether the SNR of the channel is above the set thresholds (i.e., w 1,2 = 1 if SCI > 0.8 and power > 0.1; otherwise w 1,2 = 0). If the measured SNR is sufficiently high (w 1,2 = 1), the equation is uniquely solved by the pair (O 1 ,O 2 ) = (1,1) denoting that both optodes are in good contact with the scalp. In contrast, w 1,2 = 0 yields three possible solutions (0,0), (0,1) and (1,0) from which the coupling status of the individual optodes O 1 ,O 2 cannot be inferred univocally.
This single-channel Boolean model can be expanded to a generic fNIRS layout with S illuminating optodes and D collecting optodes, so that S + D = N is the total number of optodes. Specifically, it is possible to compile a system of P equations O i ∧ O j = w i,j representing P optical channels, where i-th and j-th optodes may appear in multiple equations because of their multiplexing, as described above. Solving the system for the unknown Ntuple (O 1 ,..,O N ) provides an indication of the coupling status of all optodes. Note that the number of equations P is typically less than the possible number of optode pairings S·D, since only a subset of optical channels is of interest in an fNIRS experiment (for instance, channels in which the inter-distance between optodes is within a certain range). The goal of the proposed algorithm is to iterate a process that measures the terms w i,j from optical signals collected during the placement of the fNIRS headgear and subsequently solves the Boolean system for (O 1 ,..,O N ) in real time in order to continuously inform the user about optodes that have poor scalp coupling (O i = 0) and need adjustment.
To formulate the Boolean system and enable its numerical solution, we propose modeling the optical layout of any particular fNIRS headgear with a connected graph in which the N nodes represent the optodes (regardless of whether they are sources or detectors) and an undirected edge e i,j represents all optical channels of interest formed by the i-th emitting optode and the j-th collecting optode. Using a matrix notation, the graph topology is fully described by the binary adjacency matrix E (size N x N) representing edges e i,j existing between two nodes i and j, whereas the measured SNR of fNIRS channels is described by the binary weight matrix W (size N x N) where w i,j = 1 if SNR is acceptable, otherwise w 1,2 = 0. An example of this graph modeling is shown in Fig. 1, where a 40-optode fNIRS layout used in our previous studies [5,7] is represented schematically (Fig. 1(a)) alongside its corresponding connected graph ( Fig. 1(b)). In our experiments measuring cortical activations in response to speech stimuli, we only considered optical channels e i,j formed by optodes with an inter-distance between 30mm and 45mm.
Depending on the measured values of all the terms w i,j , the system of Boolean equations O i ∧ O j = w i,j may have any number of solutions. Specifically, the system yields one solution (O 1 ,..,O N ) = (1,..,1) only when all entries w i,j = 1 (i.e., all channels have a high SNR). In the opposite case where W = 0 (i.e., all channels have a low SNR), the system has multiple solutions (up to 2 N ) indicating that the coupling status of all optodes cannot be determined. In the most realistic case of a set assortment of clean and noisy channels (for instance, obtained during the initial placement of the fNIRS headgear), the univocal solvability of the Boolean system depends on both the specific topology of the graph E and the value of W being measured. Typically, the Boolean system has multiple solutions wherein a subset of optodes is univocally determined as either coupled or uncoupled, while other optodes with different values for O i across solutions remain undetermined. Although such an initial situation may be far from the goal of having all optodes successfully coupled to the scalp, being able to immediately locate uncoupled optodes on a graph model enables the user to adjust their placement on the scalp. In turn, the subsequent improvement of their coupling (i.e., w i,j terms going from 0 to 1) will further reduce the number of solutions of the Boolean system, thus increasing the number of univocally-determined optodes. Ultimately, this iterative process leads to the satisfactory scalp coupling of all optodes. A flow chart of the algorithm is also depicted in Fig. 2.

Results
To validate the proposed SNR measures, we considered in-vivo fNIRS data sets representing typical situations with good scalp coupling, poor scalp coupling and movement artifacts.
Examples of noiseless and noisy optical signals measured on a volunteer at an interoptode distance of 30 mm prior to filtering, after normalization, and after cross-correlation are shown in Fig. 3. Noiseless signals were obtained from the prefrontal cortex area (PFC) where the optodes were unobstructed by hair, whereas noisy signals were collected from the temporal region without carefully parting the hair underneath the optodes. Besides the presence of a residual hair layer between optodes and scalp, other possible causes of reduced signal amplitude or a degraded pulsatile profile could have been a sub-optimal coupling of the optodes to the scalp (e.g., optical fibers were at less-than-90° angle with the scalp) or an unstable mounting of the optodes' holders in the headgear. In optimal coupling conditions, the normalized cardiac signals at wavelengths λ 1 and λ 2 proved to be essentially identical (Fig. 3(c)), thus yielding an SCI close to 1 (Fig. 3(e)). In contrast, noisy cardiac signals led to a lower SCI value of 0.23 (Fig. 3(f)).
Movements of the head or the jaw introduced signal artifacts in the form of spikes larger than the peak-to-peak amplitude of the cardiac pulsation, as shown in Fig. 4(a). Due to the synchronicity and magnitude of these artifacts in both optical signals x λ1 and x λ2 , the resulting SCI = 1 becomes an inaccurate indicator of scalp coupling (Fig. 4(c)). However, the spectral power of the cross-correlation signal represents an effective complementary measure either for determining the strength of the cardiac component or for identifying the presence of sporadic movement artifacts that temporarily invalidate SCI. In fact, it can be observed that the power spectrum of the cross-correlation of a noiseless channel is characterized by a prominent peak at the cardiac frequency ( Fig. 3(g)), whereas a channel affected by movement artifacts yields a cross-correlation spectrum in which power is spread across a larger bandwidth, thus resulting in a substantially lower peak value (Fig. 4(g)). As anticipated in the Methods section, a threshold value must be set to objectively separate a clean from a noisy optical channel. For example, the clean signals shown in Fig. 3(a) generate a peak power of 0.16 when cross-correlated, as opposed to the noisy and artifactual signals shown in Fig. 3(b) and 4(a), which yield a peak power of only 0.01. In our experience, setting a spectral threshold to 0.10 accurately detects channels with strong cardiac pulsation that are free of motion artifacts. Importantly, both SCI and power thresholding must be performed for evaluating the cleanliness of an fNIRS optical channel. This becomes evident in cases where the cardiac pulsation is clearly detected only at the longer wavelength, as in Fig. 4(b). In this example, the prominently sinusoidal cross-correlation has a peak power of 0.11 (Fig. 4(h)), which is above the suggested power threshold, whereas a correspondingly low value of SCI = 0.4 ( Fig.  4(f)) correctly indicates that the optical channel is likely too weak to measure any cortical activity reliably.
Once the SNR is determined for all optical channels relevant to the experiment, the scalp coupling of each individual optode can be determined by applying the graph-based iterative algorithm described in the Methods section. To demonstrate its validity, we hereby consider a representative graph with 4 sources (circles) and 3 detectors (squares) numbered from 1 to 7 (Fig. 5, top left), in which the corresponding Boolean system of equations converges towards a unique solution as a result of adjustment of one optode. Assuming initially that only one channel had sufficient SNR (w 1,2 = 1, Fig. 5 top left), the resulting system of equations (Fig.  5, center left) is solved by multiple 7-tuple (1,1,0,0,0,any,any), where optodes O 1 ,O 2 ,O 3 ,O 4 ,O 5 have a univocal coupling status-1 for coupled (green nodes) and 0 for uncoupled (red nodes)-and optodes O 6 and O 7 are undetermined (yellow nodes) (Fig. 5, bottom left). Note that both optodes O 6 and O 7 are connected to the uncoupled optode O 4 . When optode O 4 is physically adjusted to achieve better scalp coupling (Fig. 5, top right), the updated SNR configuration (w 2,4 = 1) yields a Boolean system that is solved uniquely by the 7-tuple (1,1,0,1,0,0,0), where the coupling of optodes O 6 and O 7 is no longer undetermined (O 6 = O 7 = 0, Fig. 5, center and bottom right). Finally, a user may proceed in adjusting the remaining uncoupled optodes O 3 ,O 5 ,O 6 ,O 7 . Therefore, the optimum placement strategy starts with adjusting uncoupled optodes that are connected to undetermined optodes, so that the status of the latter can be quickly resolved. Fig. 3. Raw (a,b), normalized (c,d) and cross-correlated signals (e,f) of clean (a) and noisy (b) optical channels. SCI was close to 1 in a clean channel (e), whereas it dropped to 0.23 in a noisy channel (f). Power spectra of cross-correlated signals of clean (g) and noisy channels (h) have substantially different peak values (0.16 vs. 0.01) and spectral profile. Fig. 4. Raw (a,b), normalized (c,d) and cross-correlated signals (e,f) of an optical channel affected by a movement artifact (a) and of a channel where substantial noise was present only at the shorter wavelength (b). Power spectra of cross-correlated signals (g,h). In this case, SCI or peak power alone falsely identified the optical channels as clean, where the combination of both parameters allows to detect the presence of noise or movement artifact.  5. (a) Example of graph representing an optical layout with 4 sources (circles) and 3 detectors (squares) connected by weighted edges with arbitrary value (0 = low SNR, 1 = high SNR), and corresponding system of Boolean equations. After solving the system for (), nodes are colored according to the univocal binary value of each variable (1 = coupled, green, 0 = uncoupled, red) or left undetermined (any = yellow). After adjustment of optode 4, the system is updated and solved univocally by (1,1,0,0,0,0,0).

Software implementation
The iterative method described in the previous section has been implemented in graphical user interface (GUI) software called PHOEBE (Placing Headgear Optodes Efficiently Before Experimentation) that displays the scalp coupling status of all optodes in real time while optical measurements are being collected via an fNIRS instrument. PHOEBE will be made available for download and non-commercial use at the first author's webpage http://polloninilab.com/software/phoebe.htm, where users can also seek technical support and provide suggestions for future improvements.
PHOEBE's GUI displays a set of optode markers overlaid on a head model according to the actual fNIRS geometrical layout (Fig. 6). During data collection and real-time computation of optodes' coupling status, the color of each marker is updated, i.e. green (coupled), red (uncoupled), or yellow (undetermined coupling). To simultaneously show multiple probing areas (e.g., bilateral auditory probes), users can opt to display two identical head models, each of which can be rotated three-dimensionally for a preferred view of the optodes' layout.
The left-hand panel of the GUI contains a set of controls for selecting the fNIRS instrument (i.e., NIRx) and for setting the parameters used in the algorithm (i.e., low-and high-cutoff frequencies of the cardiac band pass filter, thresholds levels for SCI and spectral power). Since the optodes' scalp coupling can be computed only when fNIRS data are being collected and saved locally by the instrument's legacy software, PHOEBE's algorithm must be manually initiated and halted using a toggling START/STOP button located on the lefthand panel.
The flow chart of PHOBE operations between launching and the beginning of iterative monitoring is shown in Fig. 7.  To accurately display all optodes of an fNIRS probe onto the head model, the anatomical location of all optodes must be loaded into the software prior to the execution of the iterative algorithm as a set of three-dimensional coordinates included in a text file (.TXT) or a MATLAB file (.MAT) whose format is compatible with fNIRS analytical software Homer/Homer2 [8] and AtlasViewer [9].
To facilitate creating an optode layout file, PHOEBE embeds a module that guides the user in capturing the spatial coordinates of optodes using a commercial three-dimensional digitizer (Patriot, Polhemus Inc., Colchester, VE, USA). In this case, an affine transformation between the digitizer space and the head model space is automatically computed using five anatomical fiducial markers commonly used in 10-20 EEG systems: nasion (Nz), auricular right (Ar), auricular left (Al), vertex (Cz), and inion (Iz). Alternatively, users without a 3D digitizer can define the approximate location of sources and detectors by mouse clicking on a graphical head model included in PHOEBE. Both GUI modules for defining optode location automatically create coordinates files in both .TXT and .MAT formats to be loaded in future executions of the software.
To form the system of Boolean equations to be solved for the coupling status of all optodes, the adjacency matrix E representing the topology of the headgear (i.e., optodes pairings) must also be known prior to the execution of the iterative algorithm. The list of optode pairings can either be loaded into PHOEBE as a .MAT file (Homer/Homer2 format) or automatically determined by PHOEBE based on a user-specified range of inter-optode distances. For example, source-detector pairs having an inter-distance within a 25-40 mm range correspond to channels whose optical path is deep enough to reach the cerebral cortex, thus excluding channels whose optical signal is undetectable due to excessive distance between optodes. Upon loading the optical channels of interest, the adjacency matrix E is internally constructed, the weight matrix W is determined at every iteration of the loop by measuring the SNR of all optical channels of interest, and the system of Boolean equations O i ∧ O j = w i,j is solved to output the coupling status of all optodes. Although the software has been developed and tested using a specific fNIRS instrument (NIRScout, NIRx, Glen Head, NY), the weight matrix W required to compile the system of Boolean equations can be determined by calculating the SNR of optical signals measured with any fNIRS device.

Discussion
We developed GUI-based software that facilitates the optimum placement of fNIRS headgear by verifying that all sources and detectors have satisfactory contact with the scalp. This work has been inspired by analog software used in electroencephalography (EEG) that allows users to check whether the scalp impedance of each electrode is sufficiently low prior to acquiring EEG data [10]. To our knowledge, our proposed algorithm is the first to determine whether an individual optode-source or detector-is sufficiently coupled to the scalp, as opposed to equipment-specific software that normally shows the quality at optical channel level.
An additional advantage of our software is that it shows the scalp coupling status of each optode on a realistic head model, thus visually assisting the user in localizing optodes that need manual adjustment for optimum placement. Since the iterative algorithm operates in real time and provides immediate feedback regarding the scalp coupling of all optodes, PHOEBE effectively closes the loop between the user in charge of placing the fNIRS headgear and the instrument's acquisition of optical signals. This enables the collection of high-quality signals across channels while keeping the pre-acquisition preparation time relatively short. Thanks to these features, PHOEBE should be particularly useful in time-sensitive settings, such as in research hospitals, and in population-sensitive studies, such as those involving children or the elderly. Since the proposed algorithm is independent of the hardware being used (i.e., fNIRS headgear or instrumentation) and solely relies on an objective measure of physiological signals, PHOEBE should also benefit non-technical users and novice fNIRS researchers, particularly in clinical disciplines.
Moreover, the algorithm at the core of PHOEBE could potentially be used for post-hoc evaluation of data quality. Specifically, an fNIRS data set can be replayed offline through PHOEBE to verify that all optodes maintained contact with the scalp for the duration of the experiment, or to identify optodes and detect timing of movement artifacts (as shown in Fig.  4(a)) that subsequently require data correction or discarding.
Even if both SCI and spectral power derived from the cardiac signal represent objective and easily interpretable measures of scalp coupling, the user arbitrarily chooses the threshold levels applied to formulate the Boolean equation, hence introducing less-than-ideal subjectivity to the acquisition process. In our experience, both SCI and peak spectral power values drop dramatically when an optode loses contact with the scalp (e.g., SCI goes from 0.95 to 0.2) or when hair impedes the light transmission between scalp and optodes, making the determination of the scalp coupling only moderately sensitive to the arbitrary selection of the threshold values. However, novel measures of SNR that do not require thresholding would be useful additions to SCI and peak power to improve accuracy and robustness of the scalp coupling estimation.
Movement artifacts-caused by manual adjustment of optodes or head movementadversely affect the scalp coupling for the entire length of the time window over which SCI and spectral power are computed. For example, a short-duration artifact (as shown in Fig.  2(a)) causes one or both optodes to be displayed as uncoupled until the peak moves outside of the processed window (i.e., several seconds after the artifact presents itself), hence bearing a memory of the adverse event. To reduce this effect without compromising the scalp coupling estimation, the window length must be shortened as much as possible. In turn, the sampling frequency of the fNIRS instrument must also be sufficiently increased to collect enough samples to compute SCI and peak power accurately, which might be a limitation for some fNIRS instruments. Since a single cardiac period is theoretically sufficient to compute SCI and peak spectral power, acquisition of data from a resting adult with a heart rate of 60 bpm (i.e., 1 Hz frequency) would require a sampling frequency of at least 10 Hz per channel to limit the artifact memory to less than one second.
Both increasing the update rate of the coupling status and reducing the memory effect of movement artifacts will also improve the user experience. Since the algorithm that computes the weight matrix W and solves the system of Boolean equations takes only a few tens of milliseconds to execute, the coupling status update depends mostly on the rate at which PHOEBE can read and process newly collected data. Currently, PHOEBE reads data as they are saved on files by the instrument software. In our lab setup, the instrument NIRx NIRScout 16x16 (16 sources, 16 detectors) samples all optical channels at 3.91 Hz and appends a new batch of data approximately every 400 ms. At the time of this writing, we are implementing a new version of PHOEBE that collects data streamed over a TCP port by the NIRx software, which should substantially increase the update rate. We are also making PHOEBE compatible with the ISS Imagent instrument, which encompasses real-time data streaming over TCP. In the future, we are hopeful that more fNIRS manufacturers will make raw data accessible in real time during data collection, so as to allow expansion of PHOEBE's compatibility.

Conclusion
We developed user-friendly software called PHOEBE to determine and display in real time the optical coupling of individual optodes to the subject's scalp in an fNIRS setup, akin to electrode conductivity used in electroencephalography (EEG). This overcomes the existing limitation of evaluating the signal quality of fNIRS measurements only at the optical channel level, which is not indicative of optodes that require improvement of coupling with the scalp.
We defined signal-to-noise measures of fNIRS data based on widely accepted norms and which are strictly related to the coupling between optodes and scalp. We also described and demonstrated a graph-based methodology to represent any fNIRS probe setup and to univocally determine the scalp coupling status of individual optodes.

Funding
National Institutes of Health (R56 DC010164; R01 DC010075); University of Houston Technology Gap Fund.