Keywords

1 Introduction

Harmonics are present anywhere in the world, especially when we are now living in digitized environments; hence, it was hard to avoid them completely. So, the only choice is to deal with them. Brillinger listed interesting physical examples that led to harmonics [1], which even appeared before digital system was introduced to our world. The important thing to deal with harmonics is identifying the fundamental frequency. Once this frequency is identified, a simple notch filter can be applied accordingly to attenuate the harmonics.

Functional near-infrared spectroscopy (fNIRS) has been greatly improved and widely used in many applications, including health. Having cleaned signals without any artefacts is an ultimate hope for any signal analysis to provide reliable results. fNIRS, however, is not free from these artefacts either and different researchers may have different opinions about artefacts. For example, for those who are interested in hemodynamic response, cardiac beat is considered an artefact that must be removed prior to further analysis, but others may use the cardiac pulsation to extract features from fNIRS signals.

The trend in digital health motivates fNIRS miniaturization as a wearable device to enable location-free measurement in any situation, e.g., sleep, exercise, working, etc. With the advancement of secured wireless connections, it enables patient home monitoring. However, it is difficult to avoid interferences that may induce artefacts in these uncontrollable environments. A common example is power line interference in ECG and EEG signals [2, 3]. Hence, we need to make sure that the signals are usable with minimum artefacts if we cannot remove them completely.

We developed a wearable device able to measure hemodynamic and electrical activities of the neurons from the brain, specifically from the forehead area. It consists of light source and detectors for fNIRS to read hemodynamic response, EEG electrodes, and accelerometers.

From signals measured in our sleep study, we found a special artefact in raw fNIRS signal. This artefact appeared as harmonic frequencies clearly visible in the frequency domain, while signal shape in the time domain looked normal. In this case, no one can identify the presence of this artefact until the signals were viewed in the frequency domain. Since the artefact was found as harmonics in frequency domain, we call it harmonic artefact (HA).

Interestingly, the artefact was neither device- nor subject-dependent because we did not get HA in other measurements from different studies using the same device. Since the source of HA is still unknown, a similar scenario might occur somewhere else, especially when the wearable system is worn outside uncontrollable environments. Figure 1 showed examples of the signals from the same device measured on different days in our sleep study.

Baratta et al. addressed a similar phenomenon appeared in EMG signals [4]. They used baseline signals to estimate the background noise in frequency domain and subtracted it from the spectrum of the measured signals. The signals were reconstructed by applying inverse Fourier transformations. Although this method looked promising, it was not applicable to our problem because we cannot isolate the signals without any pulsation as the baseline. Hence, another approach is needed.

The fundamental frequency was around either 0.5 Hz or 1 Hz, which was within our band of interest in fNIRS signal analysis. If we compare them to fundamental frequency from power line interference, they are relatively low. In some cases, it is easy to identify power line interference in time-domain because the fundamental frequency sometimes can be visible. However, it is difficult to spot such a low fundamental frequency as in our case.

Having fundamental frequency around either 0.5 Hz or 1 Hz poses two challenges, i.e., firstly, we need an algorithm to detect the exact location of the fundamental frequency, and secondly, attenuating these harmonics should give minimum impact on the signal characteristic because the interested physiological pulsations are within this range. These two challenges were addressed in this present study.

Fig. 1.
figure 1

Raw signals in frequency-domain from different subjects and measurement days using the same device.

2 Materials and Methods

2.1 Data Collection

The data collection followed the Declaration of Helsinki and the whole measurements were conducted at the Clinical Skills Centre Knoppi, Oulu University Hospital which is a collaboration environment between hospital and faculty of Medicine, University of Oulu. We recruited adult subjects for this study, and a consent letter was signed after the explanation of the measurement. Subjects might leave the measurement anytime during data collection.

Within the sleep study, the objective is to discern alterations in brain pulsations in sleep apnea patients when compared to a control population. To facilitate this investigation, we employed functional near Infrared Spectroscopy (fNIRS) and standard clinical night polygraphy equipment (NOX T3s) that will measure breathing movements, oxygen saturation, pulse, and respiratory flow. This approach allows for the correlation of fNIRS signals with precisely timed pauses in breathing, such as hypopneas or apneas, which are used to calculate Apnea-hypopnea index (AHI). AHI is considered normal if the index is under 5. Additionally, in collaboration with Tampere University Hospital, signals were captured using the Emfit sleep sensor placed under the mattress, a modality that they are in TAYS region routinely utilize in clinical sleep apnea diagnostics. Furthermore, equipment with three different devices from Polar Electro Oy was used to measure physiological signals, allowing for comprehensive comparisons with signals obtained from other modalities. One device was placed on wrist and was comparable to commercial version of Polar Vantage, additionally two other devices, the light sensor to upper arm and impedance cardiography around chest wall, were used. Figure 2 shows the equipment used in this study. This methodology ensures accurate insights into the physiological pulsations of the brain, as well as the overall physiology of the body and the functioning of the nervous system in individuals with sleep apnea during the night.

Fig. 2.
figure 2

We put several devices on the subject and the one on the forehead was our fNIRS device (left). Measurement environment at Clinical Skills Centre Knoppi and some sensors (right)

The study included 47 measurements of which 41 measurements had valid NOX signals. The inclusion criteria for study subjects were following; Age between 18–68 years old, no neurological diseases, no smoking. Underlying diseases that were medicated and therefore in control e.g. hypertension or diabetes, were allowed. After classification 25 controls (AHI < 5, 6 females, age: 39.0 ± 8.5 years, height: 175.6 ± 8.0 cm, weight: 80.3 ± 10.8 kg) and 16 sleep apnea patients (AHI 20.5 ± 16.6 events/h, 1 female, age: 48.3 ± 12.4 years, height: 177.3 ± 6.0 cm, weight: 93.6 ± 17.1 kg) were included to further analysis. Subjects were recruited from the outpatient clinic at Oulu University Hospital or with email.

2.2 Wearable Device

The wearable device is a battery powered NIRS device, which is made of two different units: head and main units. They are connected to each other using a cable. Head unit is placed at forehead and consists of a 4-in-1 LED (980 nm, 830 nm, 810 nm, and 690 nm) and 2 photodiode sensors. The photodiodes are symmetrically placed at both sides of LED by a separation of 3 cm to measure left and right hemisphere hemodynamic. At the main unit, the rest of the circuits are embedded: demodulator front ends, analog filters, LED modulators and drivers, ADC, and microcontroller. The data can be transferred to PC via USB cable or be saved in SD card.

One of the major challenges in design of this device was head unit. People have different shape of the forehead, and it forced us to use flexible circuits for head unit. Another challenge is sensors attachment on the skin. Applying more pressure on the forehead guarantees better illumination of the brain tissue. At the same time, the photodiodes can capture more lights. However, it can be painful for the subjects and can even produce allergies reactions. On the other hand, with a looser head unit placement, LEDs need more current to produce more light, resulting in battery depletion as well as increasing light reflection noises. Moreover, the photon may propagate on the skin and arrive at the photodetector, inducing noise the hemodynamic signals. So, there is a tricky trade-off in head unit design for sleeping purposes that demand lots of trial and error to find the best pressure level and perfect sensor angling. We have designed and tested several head unit designs to realize our goal.

2.3 HA Attenuation Algorithm

We only knew that the fundamental frequency was around either 0.5 Hz or 1 Hz. For this reason, the search area can be defined easily by defining the fundamental frequency as its center and the width. Hence, the signals must be transformed to frequency domain prior to this detection.

The fundamental frequency is identified as a sharp spike at certain frequency. However, choosing a frequency with the highest power within the search area is not the answer. For signal without HA, we can always find such a frequency with the highest power, see Fig. 1(bottom). Thus, a metric should be used to identify if a frequency with the highest power is a fundamental frequency or not.

The simplest method was comparing the maximum to average power within the search area. Unfortunately, the ratio could not be generalized to get a certain threshold for all subjects to identify it as a fundamental frequency or not. Moreover, introducing new subjects may change the threshold, making the algorithm not adaptable to most of the scenarios. The main challenge was on the power around the fundamental frequency. Specific for fundamental frequency around 1 Hz, it overlaps with the common heartbeat at rest for adults. When the heartbeat changes from time to time, the average power within the search area can be quite high and it may fail to give an appropriate metric when the power of the fundamental frequency is not that high.

We studied the distribution of power within the search area and found that the presence of the fundamental frequency increases the skewness of the power distribution. Without the fundamental frequency in the search area, the skewness of the distribution is less than one. So, skewness value can be used as an indicator to identify the presence of the fundamental frequency.

Based on the detected fundamental frequency, we applied a 2nd-order IIR-notch filter to attenuate HA. From our preliminary experiments, we found that using high Q values to get a narrow bandwidth was crucial. Fundamental frequency around 0.5 Hz also introduces a spike around 1 Hz, which will be found within the search area. For this reason, we need to set the algorithm to avoid double attenuation when the fundamental frequency is found around 0.5 Hz. The algorithm to detect and attenuate HA can be read from Fig. 3. Later, this algorithm is called skewness-based Harmonic Filter (sbHF).

Fig. 3.
figure 3

Pseudocode of the skewness-based Harmonic Filter (sbHF)

The algorithm starts with copying input signal to the cleaned version (line 2). A very narrow search area is defined based on the span variable. Since it works in the frequency domain, FFT is employed (line 5). We isolate power from two bands of interest around 0.5 Hz and 1 Hz with the bandwidth of 2*span (line 7–8). Next, sbHF evaluates skewness of the isolated power and compares it with the threshold value to get fundamental frequency (line 9–12). The exact fundamental frequency and its harmonics were not at precise locations. So, we need to refine it to get the real fundamental and harmonic frequencies (line 16–17). The harmonic frequencies were removed by applying IIR-notch filter (line 18–19).

Attenuating certain frequencies in the signal changes the signal characteristics. We must evaluate if our proposed algorithm did not change them. Since the attenuation involves oscillations at certain frequencies, we used spectral entropy value to evaluate before and after applying the algorithm. Spectral entropy measures the flatness of the spectrum by ignoring the order of oscillation found in the signal [5]. So, changes in signal characteristic can be detected using this method.

The spectral entropy was applied to every 10-min segment of raw signals across the whole measurement. In this way, we collected spectral entropy scores from both original and cleaned signals. A Wilcoxon-test at 0.05 significant level was used to evaluate whether the algorithm changes the signal characteristic or not. Hence, for each subject we had eight p-value scores: two channels and four wavelengths from each channel. We only evaluated signal characteristic changes when sbHF was applied.

3 Results

Using original raw signals without HA, we corrupted them by adding artificial HA using fundamental frequencies of 0.5 Hz and 1 Hz. It was a series of sinusoidal signals with decaying amplitudes as the frequencies increase. We used these signals to test our proposed algorithm to detect and attenuate HA. For this experiment, we used Q factor of 500 for IIR-notch filter.

Figure 4 presents the performance of our algorithm using signal with artificial HA. The upper row shows the original raw signals in frequency domain, which have no HA. In the middle and bottom rows, sbHF detected (marked with blue dots) and attenuated artificial HA respectively. We use root mean square error (RMSE) to compare the cleaned signal to the original one (without HA), i.e., 1e−3 and 9e−4 for 0.5 Hz and 1 Hz fundamental frequencies respectively.

Fig. 4.
figure 4

The location of the fundamental frequency of 0.5 Hz (left column) and 1 Hz (right column) can be detected based on the skewness score of the distribution (middle row) and then removed (bottom row).

Figure 5 compares the spectrum before and after applying sbHF from three possible cases using real raw signals, i.e., no HA, HA with fundamental frequency around 0.5 Hz, and HA with fundamental frequency around 1 Hz in the raw signals. When sbHF found no harmonic artefact, the algorithm did not apply anything to the raw signals (Fig. 5 left column). In Fig. 5 middle and left, sbHF successfully detected and attenuated HA in the other cases.

Fig. 5.
figure 5

sbHF performance in three different cases. On the left column, sbHF did not detect any fundamental frequency, hence sbHF was not applied to this signal. For middle and right columns, sbHF identified fundamental frequency at around 0.5 Hz and 1 Hz, respectively, and attenuate the harmonics, see results at the bottom row.

Figure 6 presents how signal changes in time-domain after applying sbHF. The shape of the individual pulse slightly changed as the harmonics were attenuated, see left (before) and right (after) of the top panel.

Our sleep data also contained motion artefacts, which cannot be avoided as subjects were free to move during sleeping. Among various proposed algorithms to reduce this artefact, we found kurtosis-based Wavelet Filtering (kbWF) [6] provided the optimum results. Then, the interesting question is about how to combine these two algorithms to process our sleep data until we get chromophore concentrations for further analysis.

To answer this question, we employed six scenarios based on the order of operation among kbWT, sbHF, and chromophore calculations. In each scenario, we processed raw signals until we got the chromophore concentration in different orders and see results from each scenario. Figure 7 shows result from each scenario (case 2–7) and the references (case 1), while Fig. 8 presents signals before and after the manipulation using case 7.

Fig. 6.
figure 6

Signal in time-domain before and after applying sbHF. It removed fundamental frequency around 1 Hz but kept the cardiac beat peak under 1 Hz. Signal shape in time domain was generally unaltered.

Fig. 7.
figure 7

Processing raw signals with different order produced different results.

Fig. 8.
figure 8

Processing HbO using case 7.

4 Discussions and Conclusions

We proposed an algorithm to attenuate HA in fNIRS signal. Firstly, the algorithm detects the presence of the fundamental frequency based on the skewness value of the isolated power within a certain narrow band of interest. Then, 2nd order IIR-notch filter is applied repetitively up to 11 Hz to attenuate HA. Applying sbHF to raw signals successfully attenuated HA, while signals without HA were left as they were.

We evaluated sbHF using original signals corrupted with artificial HA, see Fig. 4. Based on the RMSE score, sbHF looked promising for our purpose as it could identify if input signals contain HA and attenuate it. Using the original signals, sbHF can detect the presence of the real HA and then attenuate it. Hence, the skewness of the distribution provides good information about the presence of the fundamental frequency.

Attenuating HA means reducing the amplitude of some frequencies. Consequently, it also changes signals in the time-domain as some of the components are attenuated, see Fig. 6. For this reason, we need to evaluate if sbHF changes the signal characteristics. If signal characteristic changes, then sbHF is useless. So, we compared SE scores before and after applying sbHF and found that 10% (13 out of 127) of the signals with HA had different SE scores mostly from cardiac band. The IIR-notch filter attenuated frequency components within its narrow bandwidth. Perhaps, we need narrower bandwidth to preserve most of the signal characteristics. When we doubled the Q value, 10% of the processed signals still had different SE scores.

We experimented with a high-order IIR-notch filter. The filter order was increased from 2 to 10 and 50 to get extremely different filter order. Unfortunately, no significant improvement was made in both scenarios. It looked filter order has no impact on the performance of sbHF.

We had been using the same Q for all harmonic frequencies. Consequently, the larger the frequency, the wider the bandwidth and it may affect the performance of sbHF. In this case, the larger harmonic frequency would have more frequencies being attenuated. So, we attempted to change the Q value accordingly such that all harmonics frequencies had the same bandwidth. Table 1 displays experiments by varying initial Q factor using 2nd-order IIR-notch filter.

Table 1. Performance of sbHF using the same bandwidth for all harmonics frequencies and 2nd-order IIR-notch filter

Although the initial Q values in Table 1 were quite sparse, we could see here that by varying Q factor to get the same bandwidth for each harmonic frequency helped improving the performance. Perhaps the performance gradually improved until at a certain point it gave just an almost flat response with a little improvement.

Next, we investigated whether the filter order may change the performance under varying Q factor conditions. Unfortunately, changing the filter order did not improve the performance. High filter order has steeper transition than the low one. As the bandwidth around the harmonic frequencies was small enough, the transition slope was already steep and changing filter order did not give significant transition changes.

Apparently, Q factor affects the computational time, but it is not an important issue when sbHF is applied offline. The limit of this parameter is the computational power of the computer. Of course, it is important to optimize it, but it is beyond the scope of this present study. It will be considered as a future work.

Up to this point, we were still working on the raw signals without any chromophore calculation. Moreover, fNIRS signals from sleep study were not free from motion artefacts. So, it is important to evaluate how to combine sbHF with motion artefacts reduction and chromophore calculation. The examples of the experiments were shown in Fig. 7 for different cases.

Although signals in frequency domain looked fine, see the right column, the representation in time-domain, see left column, could be completely different in case 2, 3, and 4. These results indicated clearly that concentration calculation must be done before applying kbWF, see case 5, 6, and 7. In case 5, not all HA was attenuated, see the visible spikes at 1 Hz and 2 Hz. Case 6 and 7 looked similar, but case 7 presents better signal representation as it keeps the respiratory peak around 0.5 Hz; this respiratory peak is also visible in case 1.

Figure 8 displays the results after applying case 7 to all possible concentrations from our wearable fNIRS. The whole measurement, see left column, clearly shows that the motion artefact was reduced by kbWF. Cardiac pulsation, which is one of our interests, can be conserved well after applying sbHF, see right column.

The proposed algorithm defined the fundamental frequency at 0.5 Hz or 1 Hz. It can be extended to seek out fundamental frequency within specific range. Hence, it is more flexible for more general applications.

We can extend this method to deal with harmonic artefacts in photoplethysmography (PPG) and pulse oximetry signals. Both signals are harvested using the same principle as in fNIRS. Even more interesting, PPG signals from the wrist are commonly available in wearable devices, where the user are in uncontrollable environments.

The main part that needs improvement is the attenuation filter. IIR-notch filter attenuates the central frequency up to the minimum level. It means certain frequencies are reduced significantly. This phenomenon changes some of the signal characteristics, including the ones within our interest, e.g., respiratory band in 0.1–0.6 Hz. If we can adjust the attenuation gain such that the center frequencies are attenuated up to the level of their neighboring, perhaps we can preserve more information in the signal. This will be our future work in addition to optimizing the initial Q factor.