fNIRS-based Neurorobotic Interface for gait rehabilitation

Background In this paper, a novel functional near-infrared spectroscopy (fNIRS)-based brain-computer interface (BCI) framework for control of prosthetic legs and rehabilitation of patients suffering from locomotive disorders is presented. Methods fNIRS signals are used to initiate and stop the gait cycle, while a nonlinear proportional derivative computed torque controller (PD-CTC) with gravity compensation is used to control the torques of hip and knee joints for minimization of position error. In the present study, the brain signals of walking intention and rest tasks were acquired from the left hemisphere’s primary motor cortex for nine subjects. Thereafter, for removal of motion artifacts and physiological noises, the performances of six different filters (i.e. Kalman, Wiener, Gaussian, hemodynamic response filter (hrf), Band-pass, finite impulse response) were evaluated. Then, six different features were extracted from oxygenated hemoglobin signals, and their different combinations were used for classification. Also, the classification performances of five different classifiers (i.e. k-Nearest Neighbour, quadratic discriminant analysis, linear discriminant analysis (LDA), Naïve Bayes, support vector machine (SVM)) were tested. Results The classification accuracies obtained from SVM using the hrf were significantly higher (p < 0.01) than those of the other classifier/ filter combinations. Those accuracies were 77.5, 72.5, 68.3, 74.2, 73.3, 80.8, 65, 76.7, and 86.7% for the nine subjects, respectively. Conclusion The control commands generated using the classifiers initiated and stopped the gait cycle of the prosthetic leg, the knee and hip torques of which were controlled using the PD-CTC to minimize the position error. The proposed scheme can be effectively used for neurofeedback training and rehabilitation of lower-limb amputees and paralyzed patients.


Background
Neurological disability due specifically to stroke or spinal cord injury can profoundly affect the social life of paralyzed patients [1][2][3]. The resultant gait impairment is a large contributor to ambulatory dysfunction [4]. In order to regain complete functional independence, physical rehabilitation remains the mainstay option, owing to the significant expense of health care and the redundancy of therapy sessions. Such devices are developed as alternatives to traditional, expensive and time-consuming exercises in busy daily life. In the past, similar training sessions on treadmills performed using robotic mechanisms have shown better functional outcomes [1,2,[5][6][7]. However, these devices have limitations particular to given research and clinical settings. Therefore, wearable upper-and lower-limb robotic devices have been developed [7,8], which are used to assist users by actuating joints to partial or complete movement using brain intentions, according to individualpatient needs.
To date, various noninvasive modalities including functional magnetic resonance imaging (fMRI), electroencephalography (EEG) and functional near-infrared spectroscopy (fNIRS) have been used to acquire brain signals. fNIRS is a relatively new modality that detects brain intention with reference to changes in hemodynamic response. Its fewer artifacts, better spatial resolution and acceptable temporal resolution make it the choice for comprehensive and promising results in, for example, rehabilitation and mental task applications [9][10][11][12][13][14][15][16][17][18][19][20]. The main brain-computer interface (BCI) challenge in this regard is to extract useful information from raw brain signals for control-command generation [21][22][23]. Acquired signals are processed in the following four stages: preprocessing, feature extraction, classification, and command generation. In preprocessing, physiological and instrumental artifacts and noises are removed [24,25]. After this filtration stage, feature extraction proceeds in order to gather useful information. Then, the extracted features are classified using different classifiers. Finally, the trained classifier is used to generate control commands based on a trained model [23]. Figure 1 shows a schematic of a BCI.
Previous studies on signal-acquisition techniques have shown promising outcomes, but rehabilitation applications require the best possible results [3,4,26]. In Eliana et al. [27], a treadmill was used to acquire EEG-based walking brain signals for sensorimotor applications with 87% accuracy. In Andreea et al. [28], EEG-based walking-intention signals were detected for stroke patients with an accuracy of 82%. Their data indicated that patients highly motivated for rehabilitationrelated tasks tended to have higher success rates. In Naseer et al. [29], two-class motor imagery movements were analyzed using an LDA classifier. With their employed modality, fNIRS, the best features were found to be signal mean (SM) and signal slope (SS). By reducing the task period to between 2 and 7 s, the accuracies were improved to 77.56 and 87.28%, respectively. In Rea et al. [30], lower-limb movement for gait rehabilitation was detected based on fNIRS signals. They were able to acquire fNIRS signals in their chronic stroke patients during preparation for hip movement with 67.77 ± 11.35% accuracy. In Zhao et al. [31], a prosthetic controller was proposed for a bipedal robot. A walking gait pattern was found for the robot mechanism while an online optimized trans-femoral prosthesis control method (i.e. control Lyapunov function (CLF)based quadratic programs (QPs) with variable impedance control) was tested on the knee and ankle joints of the prosthetic device. Azimi et al. [32] proposed stable robust adaptive impedance control for a prosthetic limb. A regressor-based nonlinear robust model was designed with reference to an adaptive impedance controller. In Richter et al. [33], dynamic modeling and simulation-based control of a prosthesis were performed, focusing on two-degree-of-freedom robot modeling, parametric estimation and feedback control for mimicking of hip motions. Perrey [34] explored neural gait control using fNIRS, specifically looking at the relevant cortical areas. In Venkatakrishnan [35], meanwhile, examined and discussed a rehabilitation-based brain machine interface (BMI) application for stoke patients.
The previous literature on the subject of rehabilitation shows that classification accuracy in the online setting is compromised by, among other problems, false triggering. Therefore, we also present a method to ensure that a correct command is always sent to a prosthetic leg (details are given in Section 3.1.1).
In this study, we acquired fNIRS walking signals of healthy subjects. Raw signals might contain noises and artifacts that can be removed using adaptive or bandpass filtering [25,36]. In order to avoid such noises, the following six filters were compared for signal processing: Kalman, Wiener, finite impulse response (FIR), hemodynamic response (hrf), Band-pass, and Gaussian. Five classifiers, namely quadratic discriminant analysis (QDA), linear discriminant analysis (LDA), support vector machine (SVM), k-Nearest Neighbour (KNN), and Naïve Bayes (NB), were analyzed for acquisition of maximum classification accuracies. For offline BCI, SVM showed greater statistical significance (p < 0.01) as compared with the other classifiers; however, in consideration of execution delay and minimum computation cost, for online BCI, we used LDA with combinations of six features: SS, SM, signal peak (SP), signal kurtosis (KR), signal skewness (SK), and signal variance (SV). Walking intention was then used to initiate and stop the gait cycle of the proposed prosthetic leg model. For minimization of discomfort, a nonlinear computed torque controller (CTC) with gravity compensation was applied to two active joints in the hip and knee and one passive joint in the ankle for position control and reduction of error in waking patterns [37][38][39]. Given its effective simulation of classical limb-type and mobile robotics, the Peter Corke® robotics tool box was used to minimize position error [40]. The proposed system is applicable not only to paralyzed patients but also, and with little modification, to amputees and elderly people.

Experimental protocol
In this study we used dynamic near-infrared optical tomography (DYNOT; NIRx Medical Technologies, NY, USA). DYNOT operates on two wavelengths, 760 and 830 nm. The machine sampling frequency used for signal acquisition was 1.81 Hz. Prior to the experimentation, verbal consent was obtained from all of the subjects. Nine healthy male members having normal or corrected-to-normal vision were recruited for the study. All were right-handed and of 30 ± 3 median age. As discussed in the literature, the best region in which to acquire fNIRS-based BCI signals for self-paced walking is the primary motor cortex (M1); thus, signals were acquired from the M1 in the left hemisphere [34,[41][42][43]. The participants had no history of motor disability or any visual, neurological disorder. All of the experiments were performed in accordance with latest Declaration of Helsinki.

Experimental paradigm
In accordance with the literature [22,41], the subjects were asked to take a rest for 30s in a quiet room before the start of each experiment. The experimental paradigm consisted of 10s walking on a treadmill followed by 20s rest while standing on the treadmill. All of the subjects started their walk with the right leg. For each subject, 10 trials were performed, and a 30s rest was given at the end of each experiment for baseline correction of the signals. Excluding the initial and final rest, the total length of each experiment was 300 s for each subject. Self-paced walking, which is to say, according to each subject's comfort level, was performed. Figure 2 shows the experimental paradigm.

Experimental configuration
To acquire fNIRS-based walking brain signals, 9 optodes were placed on the left hemisphere of the M1, among which 4 were Near Infrared (NI) light detectors and 5 were sources. Twelve (12) channels were formed as per the defined configuration, and a 3 cm distance was maintained between a source and a detector. The source/detector configuration with channels is shown in Fig. 3.
Where l is the source and detector distance, d is the curved path length factor, A(t, λ 1 ), A(t, λ 2 ) is the absorption at two different instants, α HbR (λ), α HbO (λ) are the extinction coefficient of HbO and HbR in [μM −1 cm −1 ], and Δc HbR (t), Δc HbO (t) are the concentration changes of HbR and HbO in [μM].

Signal processing
The brain signals acquired were filtered using different filters to attain maximum accuracy. To eliminate high-and low-frequency physiological or instrumental noises such as heartbeat (1-1.5 Hz), respiration (~0.5 Hz), artifacts, blood pressure (Mayer waves), and others, signals were filtered with a low-pass filter having cut-off frequency of 0.5 Hz and a high-pass filter having cut-off frequency of  [23]. The employed filters were Butterworth, Finite Impulse Response (FIR), Kalman, Wiener, hemodynamic response (hrf) and Gaussian. Butterworth and FIR filters were 4th order. Kalman filter with a discrete model was implemented [45], whereas time-varying Wiener filter, based on short-time Fourier series was implemented as in [46]. Gaussian and hrf filters were applied using NIRS-SPM toolbox developed by [17]. These filters consider Gaussian kernel and canonical hemodynamic response function, respectively, for smoothing of the time-series signal. Figure 4 shows the filtered HbO signals of channel 1 for subject 1 using all six filters.

Feature extraction
In this study, six different features were extracted using spatial average of all 12 measured channel [47]. Six statistical properties (SM, SK, KR, SS, SP, SV) of the averaged signal were calculated for the entire task and rest sessions. For SM, the calculation was as follows: where N is the total number of observations and Z i represents the Δc HbO (t) across each observation. SK was calculated according to the asymmetry of the signal values around the mean relative to a normal distribution: where σ is the standard deviation of Z and E is expected value of Z. KR was calculated as: SS was calculated by using the polyfit function in MATLAB®, which fits a line to all data points. To calculate SP, the max function in MATLAB® was used. The features are rescaled between 0 and 1 using the equation where x′ is the rescaled feature, x ∈ R n denotes the original feature values, min x is the smallest value, and max x is the largest value. Figure 5 provides the scatter plot of subject 1 for all features.
Classification SVM SVM is used for offline BCI classification. Due to its non-linear nature moreover, it is widely employed to achieve high classification performance [48][49][50][51]. Thus, by using SVM, high-dimensional data can be scaled and errors can be explicitly controlled. In order to attain the maximum classification accuracy, SVM creates hyperplanes to maximize the margins between the classes. The vectors known as hyperplanes are named support vectors [23,[48][49][50][51][52].
The optimal solution r* is obtained by minimizing the following cost function between a hyperplane and the nearest training data points. Minimize Subject to where w T , x i ϵ R 2 and b ϵ R 1 , ‖w‖ 2 = w T w, C is the tradeoff parameter between the margin and the error, ξ i is the measured training data, and y i is the class label for the i th sample. We used a third-degree polynomial kernel function with C = 0.5. 10-fold cross-validation was then applied for estimation of classification accuracies.

LDA
LDA is the most common classifier used for pattern recognition in BCI offline and online systems, due to its low computational cost and high-speed performance. To separate classes from each other, LDA finds the projection to a line so that the two classes are well separated [47,53]. LDA's main objective is to perform dimensionality reduction, for which it minimizes the variance within each projected class and maximizes the distance between the means of projected classes. This is done by maximizing the Fisher's criterion given below: where S b and S w are the between-class and within-class scatter matrices defined as where m 1 and m 2 represent the group means of classes C 1 and C 2 , respectively, and x n denotes the samples. A vector v that satisfies (9) can be reformulated, as a generalized eigenvalue problem, as.
The optimal v is the eigenvector corresponding to the largest eigenvalue of S −1 w S b , or it can be written as.
provided that S w is non-singular. The 10-fold crossvalidation was applied for estimation of classification performance.

KNN
KNN predicts the test sample's category in accordance with the k training samples that are nearest neighbors to test sample and classifies it based upon largest category probability [54]. Assume there are j training categories as (C 1 , C 2 , …, C j ), class Y is the feature vector of all training samples, E i is one of the neighbor in the training set, indicate whether E i belongs to class C j , and Sim(Y, E i ) is the similarity function for feature data Y and E i , then the probability density function P(Y, C j ) for Y and C j is given as [54]: where, Sim(Y, E i ) was calculated using the Euclidean distance methods. For closest training data of class, the parameter k was considered 1 while 10-fold cross-validation was performed for estimation of accuracies.
QDA QDA maximizes and minimizes ratio of between-class and within-class variance, provided observations are normally distributed for each class i, the ratio test can be performed by [54]: for some threshold t. Where, X is the feature vector, μ i , μ j are the normally distributed mean and ∑ i , ∑ j are the covariance matrix of class i, j. After rearrangement the separating quadratic surface between classes can be obtained.

NB
NB is considered among commonly used classifiers for classification that is based on probabilistic approach. The model used for NB is as follows [55]: where P(k| y) is the class feature probability for a specified feature, P(y| k) is the given class probability of feature, P(y) is the feature prior probability and P(k) is the class prior probability.

Kinematic model of prosthetic leg
A human leg includes hip, knee and ankle joints. The most efficient joint is the knee, which has to bear the entire body's weight [56]. The knee and hip joints are the key joints used in locomotion; therefore, the proposed model is kept simple by considering only the hip and knee joints for articulation and the ankle joint as fixed. Therefore, only 2 degrees of freedom (DOF) were considered: 1 DOF for the hip joint and 1 for the knee [39,[57][58][59][60][61][62]. Moreover, the base was assumed fixed, making it two serial-link manipulators in which one manipulator is moved 180°out of phase with the other one [61][62][63][64]. The average thigh clearance given in the literature for a man is 0.78 in, and for women, 0.90 in [65,66]. The end-effector position and orientation were derived from the Denavit-Hartenberg (D-H) notation [57,59,67,68]. The front view of the proposed model is shown in Fig. 6, and the leg parameters are listed in Table 1.

Prosthetic leg parameters
The length parameters of the prosthetic leg are provided in Table 2.

Dynamic model of prosthetic leg
The dynamics of an n-link robotic leg can be expressed by the following set of n equations [68] M€ where q is an n-dimensional vector describing the joint positions of the robot, τ is the vector of input torques, g is the gravitational torque, b represents the Coriolis and centripetal forces caused by the motion of the link, and M is the nxn inertia matrix of the robot. The coordinates for the hip and knee joints become [69] x 1 ¼ x a þ r 1 sinθ 1 ð16Þ Considering the kinetic and potential energy of the entire system, the Langrangian becomes [69] Substituting the joint coordinates and solving the Jacobian matrix, which is the differential relationship between the joint displacements and the end-effecter position, we obtain the hip and knee joint torques [69,70] as Human gait analysis The performance parameters of a prosthetic leg can be judged on the basis of how well it mimics the normal human leg. For that purpose, robotic-leg gait patterns can be compared with those of humans taken as a reference. In other words, rehabilitation effectiveness can be measured based on how precisely the amputee can reproduce the kinematics of a healthy person. For modeling purposes, kinematic parameters obtained through gait analysis are necessary. Uniformity in hip, knee and ankle joint angles has been noted in further analyses of gait cycles at selected walking paces [71,72]. Fig. 7 represents the mean joint angles for one complete stride. As there is no major variation from person to person, the mean values can be used as a standard for the input joint-angle trajectory [72,73].

Control strategy
The selected joints torque requires effective control in order to synchronize it with the natural joint-angle trajectory [62,[74][75][76][77]. To mimic the natural leg, prosthetic-leg position-error minimization by the proportional derivative computed torque controller (PD-CTC) with gravity compensation has been proposed [40,78]. This is also known as inverse dynamic control, in which the system is cascaded with its inverse to take the overall system gain to unity. Usually, the inverse is incorporated with errors, and so a feedback loop is added for compensation [40,59,79]. Table 1 Prosthetic-leg D-H notations [68] Link no. The computed torque controller (CTC) is given by where K v and K p are damping matrices or velocity and position gains, and D(.) is the inverse dynamics function. The inverse dynamics are evaluated at each servo interval. However, the coefficients matrices M, b and g can be evaluated at a lower rate, as the manipulator configuration changes relatively slowly. Assuming ideal parameterization, the error dynamics of the system are modeled as where e = q * − q. The joint errors are uncoupled; therefore, their dynamics are independent of manipulator configuration.
In the present study, prosthetic leg simulations were performed with different stride lengths given by the National Center for Health Statistics [65,66]. Figure 8 shows a simulation plot of the biped robot at different instants.
The complete processing pipeline of entire methodology from signal acquisition to control scheme for minimization of position error is given in Fig. 9. After signal acquisition signals are preprocessed using six filters. Then six statistical features are spatially extracted across 12 channels. Later this data is classified using five different classifiers for comparative analysis of accuracies. Afterwards control  commands based on brain intention were generated to move biped robot according to desired gait patterns with minimization of position error.

Results
As discussed earlier, in order to achieve optimal accuracy, we compared six filters and five classifiers. The classification accuracies were obtained for two-, three-and sixextracted-feature combinations using Δc HbO (t) against all filters and classifiers for the nine subjects. The classification accuracies for the two-and three-feature combinations are shown in Tables 3 and 4, while the six-featurecombination classification accuracies for 6 filters are shown in Table 5. After analyzing Table 5, it was observed that using FIR, Gaussian, Kalman, Wiener and Butterworth processed signals accuracies were below acceptable benchmark for BCI [21]. Moreover, consistent best accuracies were 77.5, 72.5, 68.3, 74.2, 73.3, 80.8, 65, 76.7, and 86.7% for the nine subjects, respectively, as obtained using the SVM classifier with hrf processed signals. The statistically significant p-values of the classifiers for the HbO signals shown in Table 6 verify the greater statistical significance of the SVM over all of the other above-noted classifiers. The confidence interval was adjusted to 0.01 after applying Bonferroni correction of multiple comparisons. The results also demonstrate the significant effect of selection of filtering technique on classification accuracies. The below acceptable benchmark accuracies obtained using FIR, Butterworth, Kalman, Gaussian and Wiener filters, for this specific task, does not imply their futility for BCI studies. These filters have been shown to work well for several other tasks, for example, motor imagery, mental arithmetic etc. in previous studies [20,23,29,47,55,[80][81][82][83][84].

Online BCI
In online BCI, we require minimum computation so as to reduce execution delay for control-command generation. Most of the previous fNIRS-BCI studies have used LDA for online classification, because it provides a balance between time of execution and classification accuracy [23]. Thus, in our study, we used LDA with six-feature combinations. For real-time BCI, we divided the total of 10 trials into two sections: one section of 9 training trials and the other of 1 testing trial. The classifier was first trained offline using 9 trials having 10 runs with ten-fold cross-validation. The onetime-trained classifier was then used to classify the one unknown testing trial in online BCI. To avoid a false trigger of a control command, the testing trial was randomly divided into 10 indices having observations approximately equal to 10 disjoint subsets. Each subset was then classified to make a binary decision. Based on  the ten-fold classified data, an average threshold of "90% true" was set for accurate triggering.

Error plots
The trigger command generated based on brain intention is used to generate gait cycles of a prosthetic leg through given human joint-angle trajectories, while the PD-CTC controller minimizes joint angle and position error. Joint-angle and position-error plots for reference input trajectories of the left and right leg are provided in Figs. 10 and 11, respectively. Figure 12 provides a brain intention versus joint-angle plot. When the rest intention is transmitted, the prosthetic leg retains its previous joint angles while updating the next input joint angles for the walk intention.

Discussion
In past studies, researchers have endeavored to improve classification accuracies by using different feature combinations or by making changes to machinelearning algorithms. The frequently used features are signal mean (SM) [20,29,48,83,[85][86][87][88], signal slope (SS) [20,29,52,83,89], signal variance (SV) [52,86], slope kurtosis (KR) [86], signal peak (SP) [52,86,90] and signal skewness (SK) [52,86]. To avoid false triggers in rehabilitation, the consistently best accuracies achieved using six-dimensional feature combinations have been considered compulsory, as reported in [55]; however, in the present study, for the 2-feature combination SM/SS, the best average accuracy, 67%, was achieved, while for the three-feature combination SM/ SP/SS, an optimal average accuracy of 71% was obtained. Similar 2-feature combinations have been reported for two-class imagery movement by Naseer et al. [29], who, using time windows of SS and SM for right-and left-wrist motor imageries, increased accuracies from 83 to 87.28%. Due to individual-participant differences, these classification accuracies varied. The differences might have been due to scalp-cortex distance and head shape, both of which can cause major variation, as reported in [29]. The low classification accuracies might have been due to the fact that the hemodynamic responses of people with motor impairment due to tetraplegia or multiple sclerosis differ as compared with healthy persons, as discussed in [91]. Moreover, an optimal classifier also plays a vital role in enhancing performance accuracies, as reported in [55], where five classifiers were compared to obtain the maximum accuracy. For the present study, the proposed classifiers were LDA and SVM, as also reported in [23,48,49,53,55,92].
For an online interface, we proposed a novel methodology in which the testing trial is divided into 10 indices and each subsection is separately classified. The triggering command was generated based on a 90% average true benchmark of classified subsections. A similar realtime interface was reported in [23], but it used a separate framework for binary decoding. Furthermore, for a normal walk task reported in [22] based on the use of an online interface, a separate methodology also was used, in that case to synchronize the triggers of fNIRS signals and the gait system.
In the second part of this study a proposed nonlinear position control for a prosthetic leg was studied for gait-rehabilitation purposes. An independent, selfsufficient mechanism was developed that can mimic the normal human gait pattern based on PD-CTC. It is evident from Fig. 9 that the controller minimized the position error in less than 2.5 s. The same strategy was seen in [33], which minimized joint error using a sliding-mode control, but a steady-state error was observed. Similarly, when adaptive control was applied in a previous study [32], a constant error was seen across hip movement in the reported results. Moreover, consistent error was observed across knee and ankle angles in [77], which reported that error increases with increaing torque bounds.
fNIRS is an indirect optical measurement technique that measures hemodynamic changes instead of neural activity. Accordingly, there is always a delay between an activity performed and a detected response; thus, in such decoding tasks, classification accuracy is compromised. With advanced filtering techniques [11,93,94], different feature combinations [81] and various classification techniques [55,80], accuracies can be increased. One additional limitation of this study is that it generates the control command based on the walk intention whereas during the rest intention it holds the lower limb to its    last updated position. In order to return the lower limb to its initial state with the rest intention, a methodology that incurs shorter computation and execution time needs to be developed.

Conclusion
The aims of this study were to use an optimal filter and classifier to obtain the maximum accuracy for given data and to implement a gait control scheme for a lower limb. To those ends, fNIRS signals were acquired from the primary motor cortex (M1) in the left hemisphere of the brain. For removal of physiological and instrumental noises, six filters (i.e. Kalman, Wiener, Gaussian, hemodynamic response (hrf ), Band-pass, finite impulse response (FIR)) were used with the five classifiers QDA, LDA, SVM, KNN and NB. Brain intention was used to generate trigger commands, while the computed torque controller (CTC) was used to reduce position error. For brain-signal classification, six-feature (i.e. SS, SP, SM, KR, SV, SK) combinations were used. An average accuracy of 75% was obtained using the SVM offline classifier with hrf. For rehabilitation purposes, online classification was performed using LDA. To avoid false triggering, the testing trial was divided into 10 further subsections, and each subsection was separately classified. The triggering command was generated based on a 90% average accuracy benchmark for classified sections. In the second part of this study, a proposed prosthetic leg model was derived that is non-linear in nature; thus, it was determined that the nonlinear characteristics of the system could not be ignored. Therefore, instead of applying linearization to solve this problem approximately, we utilized the PD-CTC with guaranteed global asymptotic stability. The proposed prosthetic leg model was more deeply explored using the Euler Lagrange approach. A  simple PD-CTC independent joint controller was utilized for the hip and knee joints so that the manipulator retained its nonlinear characteristics. The simulation results confirmed that the asymptotic stability of the system can be reached in a finite time, as the determined position accuracy was satisfactory. Possible extension of this work would entail increasing the number of BCI classes for exploration of the gait patterns of persons of different age groups. Another interesting aspect could be exploring the relevance of individual channels with the task. Using features from more relevant channels for classification might also increase the classification accuracy.