# Automated Processing of fNIRS Data--A Visual Guide to the Pitfalls and Consequences
## Methods
### Pre-Processing
#### 2.4.4 LF De-Noising Methods  
After motion correction and filtering, we evaluated the effects of the three LF de-noising methods, including short-source detector (SSD*) subtraction, Principal Component Analysis (PCA), and global average (GloAvg). There are several studies showing SSD measurements to be advantageous in removing unwanted systemic physiology, compared to PCA and global average. However the recommended short-source-detector separation is at 8.4 mm for the adult head [42], which can be practically challenging or unfeasible with current systems. Therefore, we chose the greatest \"short-distance\" possible with our hardware, 20 mm, which is still a reasonable approach [52]. Short distance correction was done on the concentration changes of oxy- and deoxyhemoglobin, as is the default in HOMER2. Adaptive filtering (HOMER2 code \"enAdaptiveFilteringSS\", adapted from [53; 54]) was used for scaling. The input for acceptable short distance separation was increased to 20 mm, and the recommended values for mu and M were \(1\times 10^{-4}\) and 1, respectively. Because 20 mm is suboptimal for this analysis, we are using an asterisk (SSD*) to remind the reader of this fact. For PC-based global regression we applied an algorithm on the filtered relative optical density data (all channels, excluding short SD measurements). PCA is used in various studies, sometimes as motion artifact removal and sometimes to extract systemic fluctuations such as respiration and cardiac. However, as described before, especially cardiac signals travel with very different speed through the brain than LF fluctuations do [24]. This makes the usage of PCA for LF oscillations, cardiac and respiration together rather disadvantageous. We filtered out the first principal component (\"pca\" and \"glmfit\" from MATLAB Statistics Toolbox). The first principal component is the component that has the highest correlation with the global average signal [33]. The resulting time courses were then converted into oxy- and deoxyhemoglobin concentration changes (HOMER2 code \"hmrOD2 Conc\"). For the global average we used adaptive filtering with delay adjustment, which has been shown to avoid spurious anti-correlations [34]. In short, the goal of this method is to remove the global average from each individual channel by regressing out the average of all significant correlated channels. The steps are detailed in the following: Channel 1 (channel \(x\)) is cross correlated with all other channels (channel \(y_{1}\),..., \(y_{n}\)). Channels \(y_{1}\),..., \(y_{n}\) are then shifted, based on their optimal delay time in reference to channel 1 (optimal delay time was determined by cross correlation; \"xcorr\" code in MATLAB). The now lag-adjusted channel is accepted as significantly correlated if its correlation value to channel 1 is \(r\)? 0.37 (determined by random correlation simulation) and their optimal delay time is less than \(\pm\)5 s (it takes 6-7 s for the hemodynamic signal to propagate through the entire brain [26]). The lag-adjusted channels, which were accepted as significantly correlated to channel 1, are then averaged into one \"global\" signal, which is regressed out of channel 1 using an adaptive filter (adapted filter from HOMER2 code \"enAdaptiveFilteringSS\"). This process was repeated for all channels. The adaptive filtering was performed on the optical density time-courses, which were then converted into oxy--and deoxyhemoglobin time-courses (homer 2 code \"hmrOD2 Conc\"). To evaluate meaningful differences between each LF de-noising method, Cohen's d [55] and the Contrast to Noise Ratio (CNR) as used in [PERSON] et al. [56] were calculated for the region of interest (ROI) (specifically, channels 4, 5, 10 and 12).