Brain-Computer Interface controlled Functional Electrical Stimulation: Evaluation with healthy subjects and spinal cord injury patients

This work presents the design, implementation, and feasibility evaluation of a Brain-Computer Interface (BCI) based in Motor Imagery (MI) developed to control a Functional Electrical Stimulation (FES) device. The aim of this system is to assist the upper limb motor recovery of patients with spinal cord injury (SCI). With this BCI-controlled FES system, the user performs open and close MI with either the left or right hand, which if detected is used to provide visual feedback and electroestimulation to muscles in the forearm to perform the corresponding grasping movement. The system was evaluated with seven healthy subjects (HS group) and two SCI patients (SC group) in several experimental sessions across different days. Each experimental session consisted of a training routine devoted to collect calibration EEG data to train the BCI machine learning model, and of a validation routine devoted to validate system in online operation. The online system validation showed an accuracy of the recognition of the MI task that ranged between 78% and 81% for HS participants and between 63% and 93% for SCI participants. Additionally, the time taken by the BCI system to trigger the activation of the FES device ranged between 7.05 and 7.29 s for HS participants and between 8.43 s and 13.91 s for SCI participants. Finally, significant negative correlations were observed (r = -0.418, p = 0.024 and r = -0.437, p = 0.018 for left and right hand MI conditions, respectively) between the online BCI performance with a quantitative EEG parameter based on event-related desynchronization/synchronization analysis. The results of this work indicate the feasibility of the proposed BCI coupled to a FES device to be used for SCI patients with a severe level of disability and provides evidence of the functionality of the proposed BCI system in a motor rehabilitation context.

motor rehabilitation therapies have been developed for the treatment of SCI [8], [9]. These therapies aim to promote the process of neural plasticity that restores totally or partially the communication pathways between the nervous system and the muscles [10], [11].
One of the main application of brain-computer interface (BCI) technology is related to its use in the context of rehabilitation for patients suffering from communication and motor disabilities [12], [13] since this technology allows translating patients' intentions modulated as changes in electrophysiological brain activity, into control commands for an external device. To do so, BCI systems can use Motor Imagery (MI) as a paradigm to produce these changes in brain activity. In the MI paradigm, the user mentally rehearses movement without physical activity. This induces power changes in frequency bands of EEG signals obtained mainly from the sensorimotor brain cortex [14], [15]. BCI systems might be an effective tool to provide an alternative non-muscular communication channel to trigger rehabilitation devices for patients with motor impairments [16]- [19]. Furthermore, electroencephalogram (EEG) based BCI have become an noninvasive option to control devices, such as a robotic orthosis and a functional electric stimulation (FES) device, for use in SCI rehabilitation therapies [20]- [24].
Several previous works such as case-reports, proof-ofconcept and reviews have reported BCI coupled to FES systems controlled with MI for SCI patients [25]- [33], showing the great potential of these experimental therapies for increasing the motor function of paralyzed limbs. For example, in [25], the case study demonstrated the potential of a BCI coupled with a combination of orthosis and FES for the restoration of hand, finger, and elbow function of a single limb. This was possible in users with a high level of SCI even if only a moderate BCI performance (70.00% ± 11.91%) is achieved after extensive training. In [28], the potential outcomes of neurological and motor functions of seven SCI patients using a BCI-controlled FES system to perform hand movements were compared with five SCI patients using only the FES system (while EEG signals were collected). Neurological and motor function outcomes were evaluated before and after 20 sessions of the intervention. Both groups presented cortical ERD activity, however, only the BCI group showed restored ERD activity resembling the ERD activity of non-disabled people. In addition, the BCI group showed a greater gain in muscle strength in the hand compared to the FES-only group. According to the authors, these findings showed that BCI-FES should be considered as a therapeutic tool for motor rehabilitation. However, BCI performance results were not reported in this study. In [29], this proof-ofconcept study evaluated a FES system designed to incorporate voluntary movement attempts through the use of BCI. The BCI used power changes from a single EEG signal (compared against a predetermined threshold) as a feature to control FES activation. The experiments were conducted in a single session by five healthy participants and a SCI patient and were performed in a non-therapeutic context. The overall participants classification accuracy obtained was 90.8% while the SCI participant classification accuracy was 87.5%.
Despite these promissory findings, there are still some open issues regarding the development of robust brain-controlled applications. Some of these issues are the capacity of the system to interpret with high accuracy the movement intentions made by the user, the processing time of brain signals, and performance stability in long-term scenarios [30], [34]. In the case of MI-based BCI systems for SCI survivors, a major step towards their development and usage in clinical settings is the evaluation of this technology in rehabilitation scenarios. Addressing these challenges will improve the understanding of the feasibility of using BCI in a therapeutic setting. Therefore, there is still the need to provide spinal cord injury survivors with novel brain-computer interfaces to promote the rehabilitation and recovery of the upper limb functionality.
In this work we present the implementation and validation of a motor imagery (MI) based brain-computer interface (BCI) coupled with a functional electrical stimulation (FES) device, which aims to assist people with SCI to perform grasping movement with either hand in clinical rehabilitation interventions. The system is first calibrated to be able to recognize between left MI, right MI and rest using a machine learning model consisting of filter bank common spatial patterns (FBCSP) for feature extraction and a regularized linear discriminant analysis (RLDA) as classifier. The system can be then used in an online (real-time) experimental paradigm where the user performs the grasping MI with either the left or right hand, and when this is correctly detected, it is used as a command to provide visual feedback and to activate the FES system to perform the corresponding hand grasping movement. Because the purpose of this system is to be used in therapeutic settings to promote motor rehabilitation, the feedback and FES activation are executed only if the BCI correctly identifies the requested MI task to the user. The system was evaluated in clinical settings with seven healthy participants (HS group) and two SCI patients (SC group). Each participant used the system in several experimental sessions across different days. The results showed that all participants used the system successfully with average accuracies of about 80% for both groups and average activation times of the FES system of about 7.2 s and 10.6 s for the HS and the SC group, respectively. In addition, the ERD/ERS showed the existence of significant task-related oscillatory activity along the experimental sessions and that this activity can be used to compute a potential quantitative score to measure the relationship between the power increase or decrease of such oscillatory activity with the BCI accuracy and FES activation times.
The contributions of this work are a novel MI-based BCI controlled FES device for rehabilitation of the hand of patients with motor disabilities, the systematic evaluation of its performance in clinical settings through several experimental sessions with healthy participants and SCI patients, and the proposal and evaluation of a quantitative parameter based on the event-related desynchronization/synchronization that might be used to correlate underlying motor-rhythms with the BCI system performance. The rest of this paper is organized as follows. Section 2 describes the hardware and software components of the BCI-controlled FES system, the experimental setup and the data analysis methodology; section 3 presents the experimental results and section 4 discusses the implications of the results and the conclusions derived from this work.

A. SYSTEM OPERATING PRINCIPLE
The context of use of the proposed BCI-controlled FES system (see figures 1 and 2) is in clinical rehabilitation interventions to promote motor rehabilitation of the hands particularly of people with SCI. The system operation consists of detecting from the ongoing EEG signals whether the user is imagining the grasping movement of left or the right hand and activating the FES to move the corresponding hand. The BCI must be first calibrated (see upper plot of figure 3) to be able to recognize the MI task the user will be performing in rehabilitation interventions. In specific, the system uses a machine model aiming to recognize between three conditions, rest, left MI and right MI from the ongoing EEG signals.
Once the machine learning model has been learned, the system can be used in online in a controlled paradigm (see lower plot of figure 3) where the user performs the grasping MI with either the left or right hand as instructed by the system. When the MI task is correctly detected, the system provides visual feedback and activates the FES to perform the corresponding hand grasping movement. However, if the MI task the user is performing is not detected within a predefined time interval, no visual feedback is provided and the FES is not activated. This operation paradigm was decided because the purpose is to use the system in therapeutic settings where the mental rehearsal of movement and the subsequent visual and sensorimotor feedback is key to to promote motor rehabilitation. Figure 1 shows the experimental setup for the proposed BCIcontrolled FES system, and the users interaction with it. The main components of the BCI-driven FES system are (i) An EEG recording system, (ii) A FES system, (iii) A visual user interface and a real-time processing software.

1) EEG recording system
The EEG recording system (g.LADYbird active wet electrode arrangement and a g.USBamp amplifier from g.tec medical engineering GmbH, Austria) consists of twelve monopolar electrodes, placed according to the 10-10 international system at positions FC3, FCz, FC4, C3, Cz, C4, CP3, CPz, CP4, P3, Pz, and P4. These EEG electrodes were chosen because they are located over the left and the right motor cortex. The ground electrode was located at AFz, and the reference electrode on the right earlobe. The sampling rate for all EEG signals was 256 Hz.

2) Functional electrical stimulation (FES) system
The FES system consits of a the stimulator MOTIONSTIM8 (Medel GmbH1, Hamburg, Germany). This device is a currentcontrolled stimulator designed for motor rehabilitation applications [35], [36]. There is a detailed description of the MO-TIONSTIM8 and its functionality in [37]. To communicate the FES device with the BCI, a serial communication protocol was used with a baud rate at 38400. This communication allowed the transmission of BCI-generated commands to the FES device for the selection and activation of muscular electrostimulation routines that reproduce the grasping movement, independently, for each of the user's hands. The FES routine was executed with 2 bipolar channels applied per forearm in order to inject current (having a pulsed, square waveform) into each forearm extensor and flexor muscles. FES parameters such as current amplitude (ranging between 10 and 25mA), stimulation frequency of 30Hz, and the pulse width of 300 µs, as well as electrode placements were configured at each experimental session in order to elicit the desired handgrasping movement in a comfortable way for the subject. The stimulation train attempted to recreate the grasping movement of the hand. Therefore, the stimulation train consisted of a trapezoidal curve, with 4s-long ascent ramp, 1s-long on the plateau and 1s-long descent ramp applied in the flexor digitorum superficialis followed by another 6-long trapezoidal curve applied in the extensor digitorum communis.

3) Visual user interface and processing software
The visual user interface aims to guide the users through the experiment and to provide them a visual feedback based on their BCI performance. The visual interface was displayed on a computer screen located in front of the user and fully instructed on how to interact with the system. The real-time processing software provided the processing pipeline which was composed of several stages such as the processing of the EEG signals, the feature extraction and the classification model, the synchronization and control of the visual user interface, and the communication with the FES device. This realtime processing software is embedded in a personal computer, and this computer is connected to the EEG acquisition system and to the FES device. The software elements of this system, including the visual user interface and all signal processing steps, were implemented using C++ language. The processing pipeline provided by the software is presented in detail in the next subsection.

C. PROCESSING PIPELINE
To recognize an user's MI task with the BCI it was necessary to execute a processing sequence in order to extract relevant information from the acquired EEG signals. This processing pipeline is displayed in Figure 2. Firstly, in operation the system uses a 1.5s-long EEG data segment (i.e., EEG epoch). On this epoch, the pre-processing stages and feature extraction VOLUME 4, 2016 located under velcro wraps electrodes FIGURE 1: Illustration of the experimental setup of the MI-based BCI-controlled FES system. The system consisted of (i) an EEG recording system (12 active EEG wet channels placed on the central and parietal EEG electrodes according to the 10-20 system), (ii) an FES system (2 bipolar channels placed on each of the user's forearms, 4 FES channels in total), (iii) a visual user interface and a real-time processing software (no seen in the picture).
techniques were applied. After that, a classification model evaluated the extracted features to generate the label that represented the class of the processed epoch (left hand movement imagination, right hand movement imagination or non-movement). An additional class (artifact) was also considered to indicate if an EEG epoch was contaminated by noise or muscle artifacts. Finally, the BCI processed this label to determine which movement task was generated by the user. If a MI task was determined, the BCI sent the respective control signal to the FES device. A time step of 0.2 s was used for the generation of a new EEG epoch and its processing. The processing pipeline was based on the classification approach described in [38].

1) EEG pre-processing
After EEG acquisition, EEG epochs were filtered using FIR filters with cut-off frequencies between 4 − 40 Hz which encompasses the motor-related frequency bands of the oscillatory EEG activity The result of this filtering step were signals X 4−40 = [x 4−40 ch (t)] ∈ R n ch ×nt , where ch represents the channel EEG position ch = 1, 2, 3, 4, .., n ch , n ch is the number of EEG channels, t is the time index t = 1, 2, 3, 4, .., n t , and n t is the number of samples (384 samples per EEG epoch). Afterwards, the artifact rejection stage was applied as suggested and applied in [34], [38]. This stage allowed to verify if the EEG epoch was not contaminated by muscle, SQUID jump artifacts and other noise sources. To do this, the BCI system used two criteria to determine if epochs were rejected: (i) the peak-to-peak voltage v pp ch : and (ii) the standard deviation σ ch : where, The thresholds for the rejection criteria were v pp ch ≥ 200µV and σ ch ≥ 50µV . The BCI system labeled as "artifact" and discarded for feature extraction any epoch with at least one channel with higher values in any threshold criteria. Those EEG epochs that approved rejection criteria were used in the next processing stages.
2) Feature extraction  FIGURE 2: Schematic of the BCI-FES system architecture and processing pipeline. The operation of this system involves the execution of five consecutive steps before to sent a control signal to the FES device and display a visual response to the user: (i) EEG acquisition, (ii) the EEG preprocessing stage performs, EEG temporal segmentation, noise reduction and artifact suppression functions, (iii) the feature extraction stage obtains discriminative information from the preprocessed signals using a FBCSP algorithm , (iv) The classification stage used a RLDA classifier to discriminate the MI state, and (v) the control interface transforms the obtained labels and indices into control messages that are sent which are sent to the FES system. This component also updates the graphical user interface providing direct feedback to the user.
MI and right MI. FBCSP allows to compute optimal spatial filters to extract features for classification of EEG signals and is highly used for the decoding of different motor-related tasks [39], [40]. FBCSP is an approach for feature extraction based on the common spatial pattern (CSP) algorithm. The feature extraction procedure implemented in the proposed BCI comprises three sequential stages: (i) filter bank for multiple frequency band selection, (ii) spatial filtering in each frequency band using CSP, and (iii) feature selection. This feature extraction procedure was applied independently to the binary conditions rest versus left MI, rest versus right MI, and left MI versus right MI.
The filter bank separates each pre-processed 1.5s-long EEG epoch (i.e., 384 samples) into multiple frequency bands. In total, 27 band-pass FIR filters of size 128 samples are applied to each EEG channel, with each filter having a central frequency between 4 and 30 Hz to encompass the motorrelated frequency bands of the oscillatory EEG activity. To avoid edge effect contamination due to the filtering process, the first and last 64 samples of the filtered EEG signals were removed. Therefore, the signals provided by the filter bank are of 256 samples or 1s-long.
The CSP algorithm is then applied to the EEG signals of each frequency band in each pair of conditions in an one versus one strategy (i.e., CSP is applied separately to rest versus left MI, rest versus right MI, and left MI versus right MI). With the CSP algorithm, linear projections were computed from filtered EEG signals which increased the separability of binary conditions or classes in the new projected signals [41], [42]. Therefore, the CSP technique maximized the variance of the projected signals for one condition meanwhile minimized the variance for the other condition. Afterwards, The log-variance of the filtered signals was computed for all spatial filtered epochs. We used three spatial filters in the CSP algorithm in accordance to prior studies [43]. This resulted in 6 logvariance values per each of the 27 frequency bands, that is, the total number of features is 162.
Finally, to reduce the number of features we applied the filter approach for feature selection. Here, each feature was ranked based on the Fisher score and then we selected the 50 highest-score features. This filter-based feature selection procedure is applied separately to the set of features obtained from conditions rest versus left MI, rest versus right MI, and left MI versus right MI. VOLUME 4, 2016 The classification model aimed to recognize between rest, left MI and MI (i.e., three classes) based on features computed from EEG epochs. This classification stage was applied only to EEG epochs that approved the artifact rejection process, that is, since contaminated EEG epochs were labeled as 'artifacts' in the pre-processing, therefore they were not used by the processing pipeline to recognize the MI task. The classification model relied on a Regularized lineal discriminant analysis (RLDA) algorithm [44], [45] as this classifier is commonly employed in MI-based BCI applications [46]- [48]. Since RLDA is a binary-class model and because our BCI system distinguished between three classes (i.e., rest, left MI and MI), the RLDA model was employed in a multiclass model version using a one versus one voting scheme. For this scheme, the classification stage was trained using K(K −1)/2 binary classifiers to solve a K-way multiclass problem [49]. In this work we used the RLDA with automatically regularized covariance and therefore no hyper-parameter tuning is required [50], [51].

4) Interface controller
The resulted label or category by the RLDA model could be used to trigger the FES routine and/or the visual feedback to the user. However, there was a chance of a mis-classification due to the fact that the classification accuracy is unlikely to reach 100% resulting in a high risk of executing an unintended action for the user. Therefore, to avoid a possible classification error, the system computed a successive history of labels to establish if there was enough evidence to assert that the user was performing a determined MI task.
This process was executed by the interface controller stage which received the labels generated by the RLDA model and determined if the FES device had to be activated. In addition, after determining which user's motor task were produced, the interface controller generated the commands to trigger the respective FES routine. When the trained RLDA model generated a label, the interface controller computed the number of times each possible option had been classified. Only if the last five labels generated by the classification model belonged to the same class, the interface controller selected the option associated to that class, triggered the corresponding FES routine and provided the visual feedback. Finally, after the FES routine was executed the system was restarted for processing another selection. If the same five consecutive labels were not reached, the interface controller expected a new generated label and dismissed the oldest label.

5) Training system routine
The operation of the BCI required a set of processing steps (EEG preprocessing, feature extraction, classification model and interface controller) in order to determine when the mental task is done. To perform these processing steps, the system provided a training routine in which the user generated the MI task while the BCI recorded the user's EEG signals. This routine replicated the operational conditions of the BCI without activating the FES stimulator.
In the training routine, users were guided (see upper plot of figure 3) by three visual cues presented on the screen and a visual feedback (tracking ball). Firstly, the user watched for 5 seconds a fixation cross that indicated a relaxation period. Participants were asked to avoid movement or effort and to keep relaxed while looking at the cross. Secondly, a cue was displayed showing an arrow pointing either to the left or the right instructing the user to imagine the movement of the corresponding hand during fifteen seconds (movement imagination phase). The arrow was presented in a random fashion but the number of times for left and right MI was kept balanced. In addition, a beep sound was generated as a complementary auditory cue. During this time, the visual feedback (blue tracking ball) moved according to the arrow direction and indicated which MI task had to be performed (without a relationship with the classification output of the system).
Finally, the last cue was an image with the text "rest" and indicated users to rest, move voluntarily or blink, and this rest period had a random duration that ranged from 4 to 6 s to prevent habituation. In total, in an experimental session, one run with 30 trials was recorded for all participants, with 15 trials for each condition (left or right grasping hand motor imagery). Note that the data collected during this training routine is used to train the machine learning model (FBCSP and RLDA) that will be used in the online operation of the system, but also to estimate the accuracy of such model using a cross-validation procedure.

D. SYSTEM VALIDATION 1) Experiment description
Experiments in clinical settings with several users were conducted to evaluate the performance and usability of the BCI-controlled FES system. The experiments were carried out in a sound-attenuated room at the National Institute of Rehabilitation "LGII". Healthy subjects seated in front of a computer screen, with a table in front for resting their arms. Patients' wheelchairs were accommodated in front of the table, and the computer screen was placed in front of them. Participants (healthy subjects and patients) softly grasped a therapeutic ball in each hand. Before starting the experiments, participants were instructed how they should perform different tasks and were asked to avoid unnecessary movements when they had to pay attention to the interface. Flexibility exercises were provided to patients' hands by the same physical therapist before the BCI session started.
The experimental task consisted of imagining the gripping action of the left or right hand and was guided by visual cues presented on the screen. To do this, an experimental session was splitted in two stages: (i) training system routine (see description above and in the upper panel of figure 3) and (ii) Online system validation (described below). Note that an experimental session is an experiment carried out in a single day where the user employs the BCI system to control the FES apparatus. In this session, the training of the BCI system is first carried out which is followed by the online validation. Users were asked to follow a series of indications to carry out the MI task indicated by the BCI system. There is no activation of the FES system during training, while during validation routine the FES system is activated as long as the MI task performed by the user is correctly detected as the one indicated by the BCI system.

2) Online BCI Validation
To evaluate the BCI-driven FES system in online, participants performed a validation routine in which the FES activation was generated only if the BCI system recognized the requested MI task. The lower plot in figure 3 shows the timeline of the online BCI validation. In this case, the participants performed similar tasks as the ones carried out in the training routine. Again, the visual interface presented a fixation cross during five seconds to indicate the starting of a validation trial, followed by the presentation of the target option (with the arrow and beep sound). Then, the participant performed the requested MI task and the BCI system attempted to detect this task. Meanwhile, the visual feedback (tracking ball) started moving according to the output of the classification model. If the requested MI task was detected by the BCI in less than 30 seconds, the FES routine was activated in the targeted forearm and the tracking ball was colored in blue and located to the correct side of the MI task. On the other hand, if the BCI system did not recognized the correct MI task, the FES routine was not activated and the tracking ball returned at the center of the screen. Finally, the third cue that corresponded to the rest time was presented to participants during a random interval between 4 to 6 s before starting another trial. In an experimental session, three runs with 20 trials were recorded for all participants, yielding a total of 30 trials for each MI condition (see in the lower plot of Figure 3 the timeline of one of these trials). Hence, the total maximum time for the online BCI experiments is about 30 minutes, however, this may be considerably lower if the MI task is detected faster.

3) Participants
Seven healthy subjects (HS group) and 2 spinal cord injury patients (SC group) were recruited to participate in this study. The HS group was comprised by 3 females and 4 males aged between 20 and 25 years old (22, 20, 22, 21, 23, 22 and 25 years for HS1 to HS7, respectively), while the SC group was comprised by 2 males (patient SC1, 23 years old, 8 months since SCI event, right-handed, C5 lesion and ASIA A score, and patient SC2, 41 years old, 7 months since SCI event, righthanded, C6 lesion and ASIA A score). All participants were right-handed, with normal or corrected vision, and did not had any previous experience with EEG recordings or BCI-related experiments. These two groups of participants (HS and SC) were used to carry out a systematic validation to ascertain how they operate and control the system and to study how the performance of each individual patient compares with the group of healthy subjects (note that we did not aim to carry out comparisons between groups).
Participants, were recruited as part of an ongoing research protocol at the National Institute of Rehabilitation "LGII" in Mexico City, Mexico. The selected SCI patients approved the protocol's inclusion criteria (more than 6 months since the onset of the SCI and any score of the ASIA Impairment Scale) [52]. Participants signed an informed consent approved by the VOLUME 4, 2016 Research and Ethical Committees of the National Institute of Rehabilitation "LGII" in accordance with the Declaration of Helsinki (protocol number 08/19). The healthy subject group made two experimental sessions and the SC group made 11 experimental sessions distributed in 3 sessions per week for a total of 4 weeks. All healthy subjects (HS1 to HS7) completed the two sessions required for the experiment. Patient SC1 completed the first 4 sessions and dropped out of the study by choice (The participant freely decided to withdraw from the experimental sessions due to personal reasons and not due to any situation related to the BCI-controlled FES system or the experimental protocol). Patient SC2 completed all eleven scheduled sessions.

1) Classification model evaluation
In this work, we applied a five-fold cross-validation on the training data to evaluate the classification accuracy of the machine learning model trained by the BCI for each participant and session [53]. This cross-validation procedure with the training data allows to estimate the accuracy of the machine learning model, which is important to ascertain whether the user will be able to operate the system in online. In this procedure the set of trials was randomly partitioned into five subsets and they were used to build mutually exclusive training and test sets. Four subsets were used to train the FBCSP and the RLDA while the remaining set was used to compute classification accuracy. This process was repeated until the five cross-validations of train and test sets were exhausted. For each cross-validation, the accuracy of Left MI, Right MI and Rest were computed as the percentage of correct classifications for each of them. For this study, due to the multiclass approach, the accuracy was reported for each classifier trained in the one-versus-one strategy and the mean of these accuracies was the overall classification accuracy.

2) Online BCI performance
The performance of the BCI system in the online validation routine was measured in terms of percentage of successful detections of the requested MI task. Therefore, the accuracy in online (acc online ) was computed as follows: where n att is the total MI attempts (i.e., the total number of times the user is requested to carry out a MI task or the total number of test trials) and n sel is the total number of successful detections. This metric was computed separately for left MI, right MI trials. In addition, we also measured the time elapsed from the presentation of the visual cue indicating the start of the MI task execution to the instant when the FES system is activated (F ESonset). Also, F ESonset was computed also separately for left MI, right MI trials.

3) Event-related desynchronization/synchronization (ERD/ERS)
To examine the task-related oscillatory EEG signals the event related desynchronization/synchronization (ERD/ERS) was computed following [54], [55]. This analysis shows for each frequency the temporal evolution of signal power. This analysis is relevant for the case of MI tasks because oscillations in the alpha and beta bands can provide insights of motor execution and planning processes [56]. The ERD/ERS analysis was carried out as follows. First, in each electrode and in each trial time-frequency representation T F R(t, f ) were computed within the frequency band of [4 − 30] Hz with a 1 Hz resolution using Morlet wavelets [55], [57]. Subsequently, for each electrode individually, the ERDS/ERS relative to the reference interval [2, 4) s (which corresponds to the nonmovement interval) was calculated as follows: where T F R(t, f ) is the time-frequency representation averaged across-all-trials and T F R ref (f ) is the average of T F R(t, f ) in the reference interval for frequency f . Finally, significant ERD/ERS was computed with a bootstrap analysis at the significance level of α = 0.05 using as baseline the reference interval. As a result, significant event-related desynchronization (ERD) is represented as negative percentage values (i.e., power decrease relative to the reference interval) while significant event-related synchronization (ERS) is represented as positive percentage values.

4) A quantitative EEG parameter for motor rehabilitation
SCI patients may often exhibit changes in brain oscillatory activity associated with the clinical progression of the patients [58]- [61], causing alterations of the ERD/ERS patterns during the execution of the MI task coupled to the BCI system and, consequently, affecting the performance of the BCI system compared to healthy subjects [62], [63]. Additionally, one of the potential advantages regarding the use of BCI systems in physiotherapy involves the promotion of changes in the oscillatory activity of the brain associated with an increase in motor function. This is usually associated with a reorganization of oscillatory activity that compensates for the alteration caused by the spinal cord injury [63]. However, determining the correlation between alterations in brain oscillatory activity patterns observed in ERD/ERS analysis results, SCI patient's clinical state and the performance of BCI systems reliably might be challenging [64]- [66]. Therefore, a quantitative measurement based on the results obtained from ERD-ERD analysis could help to understand the impact of BCI systems in rehabilitation therapy.
As an exploratory approach, we hypothesized that a quantitative measurement of changes in ERD/ERS patterns generated during BCI system use may serve as a biomarker correlated with BCI system performance. Therefore, quantitative EEG parameters based on the analysis of ERD/ERS were explored along with its relationship with BCI accuracies and detection times. These parameters were explored as a quantitative tool for assisting the visual interpretation of temporal and frequency domain EEG analysis. Based on the analysis of ERD/ERS values that was performed during execution of the different MI tasks, the rate of change between the absolute sum of significant ERD/ERS at a particular brain rhythm and the absolute sum of the overall significant ERD/ERS values ([4 − 30] Hz) was calculated as: Where ch is the EEG channel, t is related with the time interval where ERD/ERS values was extracted and r is the selected brain rhythm. rERDS rate was calculated for the different brain rhythms associated with movement neurological processes, in the following frequencies:  Table 1 shows the training accuracies estimated with a 5fold cross-validation for each participant and session. For healthy subjects, the mean accuracy for the Left MI was 64%, for the Right MI was 61%, for Rest was 59% and the overall classification accuracy was 61%. Only two participants showed accuracies below of 50% in all the sessions they conducted (HS1 and HS2). Whereas, the remaining participants exhibited accuracies above 60% in at least one of the sessions. In addition, for all of these participants the second session accuracies were higher than the first one. The maximum classifier performance was 90% (HS5 session 2), and the minimum was 38% (HS1 session 2). For SC1, the mean accuracies were 48%, 48%, 42% and 46% for Left MI, Right MI, Rest and overall classification accuracy, respectively. And the accuracy was above 50% only for session 4. For SC2, the mean accuracy for the Left MI was 60%, for the Right MI was 59%, for the Rest was 55% and the mean accuracy for all tasks was 58%. The accuracies were above 50% for all the sessions except for session 3. The maximum classifier performance for SC2 was 68% (session 9), and the minimum accuracy was 47% (session 3).

A. CLASSIFICATION MODEL EVALUATION
A Wilcoxon signed-rank test was performed to test for significant differences between overall classification accuracies with the theoretical chance level (33%). These analyses were carried out separately for each participant from the HS group and from the SC group. Significant differences were observed in all healthy subjects and and in patient SC2 (p < 0.001). In addition, a Wilcoxon rank-sum test was performed to test differences in the overall classification accuracies between the HS group and each patient in the SC group. The results showed no significant differences between the HS group with the SC1 and SC2 participants (p = 0.1065 and p = 0.3957, respectively). Table 2 summarizes the results obtained in the online tests of the proposed BCI. For the healthy subjects, in the Left MI trials, 6 of 7 subjects reached online accuracies above 85% (HS2-7) in at least one session, only the participant HS1 showed rates below 20%. The mean accuracy was 78% with a standard deviation of 30%. For Right MI trials, the same 6 healthy subjects achieved a online accuracy of 100% in at least one session (with tendency to reach this online accuracy in the second session). The mean online accuracy was 81% with a standard deviation of 24%. SC1 reached online accuracies between 27% to 87% for Left MI trials with a mean rate of 63% and a standard deviation of 23%. For Right MI trials, SC1 achieved values above 70% for all the sessions with a mean of 77% and standard deviation of 17%. In the SC2 case, online accuracy values were above 80% for all MI conditions, with mean values of 91% and 93% and standard deviation of 8% and 11% for Left and Right MI conditions, respectively.

B. ONLINE BCI PERFORMANCE
Regarding the averaged FES activation time per session, healthy subjects showed a mean for Left MI of 7.29 seconds after the presentation of the second visual cue that indicated the beginning of the MI task execution (minimum time of 5.24s for HS4 and maximum time of 14.30s for HS2). For Right MI trials, the mean FES activation time was 7.05s (the lowest time of 4.05s was obtained by HS4 and the highest value of 14.48s by HS1). For SC1, the mean FES activation time was 11.26s for Left MI and 13.91s for Right MI trials. The minimum FES onset time was found in the session 2 with values of 9.25s and 10.93s for Left and Right MI trials, respectively. The maximum values were 12.12s (session 3) for Left MI and 17.59s (session 1) for Right MI. For SC2, the mean of FES activation times were 9.05s and 8.43s, for Left and Right MI trials, respectively. The minimum times were 6.83s (session 3) and 4.29s (session 5), and the maximum values were 14.14s (session 5) and 13.13s for Left and Right MI trials, respectively.
Finally, a Wilcoxon rank-sum test was performed to compare the healthy subjects with SC1 and with SC2 in order to establish significant differences of classification accuracy and detection times (this analysis was not carried out for the case of classification accuracy between the HS group and the participant SC1 due the low number of samples in SC1). There were not significant differences in any of these metrics for SC1 and SC2 with the healthy group. For the mean online accuracies, Wilcoxon rank-sum test results were p = 0.1346 and p = 0.9804 for Left MI trials and p = 0.5545 VOLUME 4, 2016

C. ERD/ERS ANALYSIS 1) Healthy group
The event-related desynchronization/synchronization (ERD/ERS) analysis was performed independently for each participant, session, and MI task (i.e., left and right). Figure 4 displays these ERD/ERS results for one of the participants in the healthy subjects group (HS5) in session 2, in the training and online stages and in the left and right MI tasks. For the left MI condition during the training stage (Figure 4a), significant ERD (p < 0.05) was mainly observed in electrodes located in the contralateral right hemisphere of the brain. The ERD activity was observed after the presentation of the second visual cue indicating the participant to execute the motor imagery task, and in the frequency range of [7 − 16]Hz which encompasses the alpha and part of the beta motor-related frequency bands. For the right MI condition during the training session (Figure 4b), significant ERD activity was observed in electrodes located in the contralateral left brain hemisphere. Persistent ERD activity localized in the [5 − 7] Hz frequency range was elicited in all electrodes. The time interval and the frequency range where these significant ERD occurred were similar to those found in the Left MI trials. For the case of the online validation stage, for the left MI condition (figure 4c), significant ERD was observed in the frequency range of [7 − 14] Hz in electrodes located in the right hemisphere. Significant ERD values were elicited around the trial's 5s which coincided with the beginning of the motor task instruction and ended before the FES routine activation, at around 10s (FES activation is shown as a synchronization in the whole frequency range [1 − 30]Hz.) For the right MI during the online validation stage (Figure 4d), significant ERD values were again found in electrodes located in the right hemisphere and sagittal regions of the brain. This ERD activity was observed in the frequency range of [7−14]Hz and in the time interval of the execution of the MI task, after that, ERS activity was elicited during the FES routine activation. This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication.   2) Spinal cord injury participants Figure 5 shows the ERD/ERS activity for SC2 in session 11 for the training and online stages and the related MI tasks trials. For the Left MI during the training stage (Figure 5a), significant ERD activity (p < 0.05) was mainly observed in electrodes located in the right hemisphere and the sagittal regions of the brain. In addition, there was a mild ERD activity elicited in the left hemisphere (see electrode C3). This ERD activity was found during the time interval corresponding to the execution of the MI task and in the frequency range of [10−20]Hz. Therefore, significant ERD activity was observed in the motor-related alpha and beta frequency bands. For right MI, during the training session (Figure 5b), significant ERD were observed in all of the recorded electrodes located in the left hemisphere and the sagittal regions of the brain. The time interval where ERD activity and frequency range were located showed similar values with the ERD activity in the Left MI trials. However, ERD activity was mildly higher in the left hemisphere electrodes compared to the right hemisphere ones. For the left MI during the online validation stage (Figure  5c), significant ERD activity was observed in all the electrodes with the highest activity in the C4 electrode. This ERD was mainly observed in the frequency range of [10 − 20]Hz with some ERD values above 20Hz (i.,e. C4 electrode). Significant ERD values onset were around 5s of the trial, which coincided with the beginning of the motor task instruction and ended before the FES routine activation around 12s. For right MI trials of the online validation stage (figure 5d), significant ERD values were mostly found electrodes in left hemisphere. This ERD activity was observed in the frequency range of [10 − 30]Hz, in the time interval of [5 − 12]s, after that, ERS activity was observed due to the FES routine activation. In summary, ERD activity of SC2 was found in a wide range of frequencies [10 − 30]Hz with the activity distributed on all the electrodes. However, there was a mild tendency towards more pronounced activations in the contralateral side to the MI condition.    Figure 6b corresponds to αERDS rate correlations between channel C4 and FES activation time in Right MI trials. Also, a negative significant correlation was obtained VOLUME 4, 2016 (p = 0.024, r = −0.418) in this case. In general terms, these results show that higher scores of αERDS rate (near to 1) were related to shorter activation times of the FES routines.

IV. DISCUSSION
In this study, we presented the development and performance evaluation of a motor imagery-based BCI controlled FES device for the upper limb. This BCI system is designed to be used in the context of neurorehabilitation therapy for patients with motor disabilities. With this system, healthy and spinal cord injured patients could perform hand grasping movements of their upper limbs. Because the BCI allows to trigger the FES routines with the user's intention employing a MI paradigm, this system could provide an interesting sensorimotor neurofeedback to support the neurorehabilitation proccess of SCI patients. To activate the system, we considered the hand grasping movement imagination for each of the upper limbs (Left and Right MI). Therefore, its operation in online situations considers an experimental paradigm where the visual feedback and FES activation are triggered solely when the MI task assigned to the user is correctly detected by the BCI.
In the experiments conducted with healthy and SCI participants, all of them showed an acceptable degree of control of the BCI. Several BCI studies have established that for a twoclass classification paradigm comprising a BCI rehabilitation system, an acceptable performance is within the range of 60%-70%. [67]- [70]. Although the trained classification models achieved accuracies below the range estimated for a two-class classification model, it should be noted that the classifiers employed in the proposed BCI system use a three-class classification paradigm, which provides a task with more complexity compared to a two-class classification. Also, the classification accuracies calculated with cross-validation were above chance level for all subjects, for both overall accuracies and independent class accuracy results. This suggests that the three-class classification paradigm used for training, was able to discriminate between different proposed MI conditions.
We consider that implementing a multi-class classification paradigm that includes a class related to non-movement state is important since two-class models employed in BCI systems are generally trained to discriminate between two highly related and mutually exclusive conditions (stopno stop or antagonistic tasks) [68], [70], [71]. In the case of BCI systems which discriminate intentions of different limb movements, these motor imagery conditions are not mutually exclusive. In addition, the two-class classification paradigm for BCI systems requires that users are highly engaged in completing the required BCI task, since if the user performs another cognitive task (non movement-related state) it could be associated with one of the MI conditions. These situations can negatively affect the performance of twoclass classification models by increasing false positives rate [68], since the classifier is forced to discriminate between one of the two classes without considering the chance that the BCI user is not performing either of the two requested MI tasks.
For these reasons the classifiers were trained with information from the resting state, a neutral condition, in order to facilitate the classifier's recognition of distinctive characteristics of the related MI task.
In the online tests, both HS and SCI participants were able to trigger the FES activation routine for both MI tasks. Overall, 88.9% of participants achieved a 100% accuracy rate in at least one of the online sessions, while only two subjects showed accuracy rates below 50% in any of their online sessions. These finding is remarkable in two ways. Firstly,for BCIs developed for motor rehabilitation in stroke and SCI patients, it has been asserted that any performance rates above chance level can be potentially beneficial to patients' rehabilitation process [68]. Secondly, it is important that the system is able to minimize the false negative rate in order to avoid the frustration of patients when they are not able to control the MI tasks [68], [70], [72], [73]. The BCI addressed this issue by including the decision rule that triggers the FES routines during the control interface stage.
Additionally, the averaged FES activation times reported during the online test showed that SCI participants required between 1.24 to 1.97 times longer than healthy patients to trigger the FES routine. This could be related to the compromised corticospinal tract of the patients, and it could be an interesting output measurement that the system can provide when used in clinical rehabilitation protocols. Despite the fact that the trials of the Right MI condition presented slightly shorter times with respect to the Left MI condition (at least for SC2 and HS participants) the results do not showed a significant difference. This suggests that the proposed BCI system can be used for users suffering from mobility impairment in one or both upper extremities. On the other hand, BCI studies have reported the Information Transfer Rate (ITR) as the standard method for measuring the performance of communication and control BCI systems. ITR is related to the amount of information transferred per unit time [74], [75]. However, in addition to this metric frequently used in BCI systems, we consider that it is also meaningful that during motor rehabilitation interventions the BCI executes the movement only if it is correctly detected. Within this context, the analysis of performance during online experiments considered both the success and the speed of FES activation. In summary, the proposed BCI system´s classifiers outcomes indicate that the BCI can discriminate successfully between the different MI conditions and a resting period. This is consistent with results of studies published within the field [25], [29], [30], [32], [70], [72], [76]. Therefore, we can expect that most healthy people and SCI patients with mild to moderate disability levels could be potential users of this technology.
The ERD/ERS analysis revealed significant power changes (p < 0.05) during MI tasks in all selected EEG channels located on or surrounding the motor cortex of all the participants. These power changes were mostly located in the sensorimotor related frequency band α [8 − 13]Hz and they were observed in all the participants. Power changes in beta rhythm [13 − 30]Hz occurred in a reduced number of EEG   channels compared to the other analyzed frequency bands. Finally, significant changes in power were found in the contralateral EEG channels to the MI condition. Although these results were found in all participants, SCI patients showed lower ERD/ERS activity than healthy participants. This reduced EEG activity was expected since it has been described before [77], and could be explained by the neuroplasticity and cortical reorganization motor processes produced by motor and cortical deafferentation in chronic SCI. These significant power changes could indicate the existence of neural correlates associated with the MI task during BCI operation, which can be used as features to recognize MI and to measure neural changes produced by the BCI-based motor therapy.
The rERDS rate rate was proposed as a measure to deter-mine changes in user EEG activity during BCI operation. This provides a quantitative score associated with the ability of BCI users to modulate brain rhythms during motor-related mental tasks and, to explore whether differences between the EEG activity of healthy and SCI patients during the BCI experiment allow explaining the difference in BCI performance. The αERDS rate results showed significant correlation for EEG channels contralateral to MI condition and BCI performance during online validation. Specifically, there were negative correlations for the αERDS and FES activation time showing that during the operation of the BCI system the user generated greater changes in alpha power compared to other motor brain rhythms, and facilitated the BCI system to discriminate the MI condition and trigger the corresponding FES routine in a shorter time. These results suggest that αERDS outcomes contribute to the understanding of the relationship between the evolution of the brain activity in SCI patients, and changes in BCI performances in the context of a motor rehabilitation therapy. This would be interesting, for example, as a new metric to complement clinical evaluations of the neurological status of SCI patients or to monitor the degree of recovery that these patients achieve by performing motor rehabilitation therapy. This work faced typical limitations encountered in BCI research involving a SCI population. Firstly, the study is constrained by the limited number of SCI participants. Therefore, this study must be considered as a proof of concept for the proposed BCI-FES system and aimed to evaluate the feasibility to operate the BCI system by healthy users and SCI patients. Therefore, a larger SCI population and longer interventions are needed to confirm the clinical effects of an experimental intervention with the BCI. Here it will be then possible to carry out performance comparisons between the two groups with balanced data Secondly, regarding the BCIdriven FES system, a concern is that FES routines recreate just a single movement for each hand. Usually, in conventional motor rehabilitation therapies, several movements are attempted in order to maximize patient's motor skills. Increasing the number of movements to discriminate with a BCI, increases the complexity of its operation and can negatively affect the classifier stage´s performance [68]- [70]. However, it is necessary to find a balance between therapy needs and the BCI operation. For future work, an option to be explored is to discriminate two movements per hand. For example, the ability to discriminate between antagonistic movements as extension and flexion of the wrist. Thirdly, the BCI system was designed to be operated under a clinical environment. For this reason it is necessary that a BCI operator sets the system and helps the user during BCI operation. As more evidence of BCI therapy effects for SCI treatment is collected, these type of systems can be gradually introduced to physical rehabilitation locations, and be less operator-dependent. Lastly, despite that ERD/ERS and rERDS rate outcomes and correlations with BCI performance suggest that BCI users can modulate their EEG activity in order to operate the BCI system and increase control performance across sessions, it remains unclear if the BCI experiment contributes to restore the SCI patients' motor skills.
In summary, the results presented in this work show the feasibility of the proposed BCI-controlled FES system to be used for SCI patients with a moderate level of disability. In addition to providing evidence of the feasibility of the proposed BCI system in a motor therapy, this work serves as a case study for the exploration of BCI-derived physiological biomarkers, such as the time required to trigger MI-related stimulation.