Decoding of grasping tasks from intraneural recordings in trans-radial amputee

Objective. A major challenge in neuroprosthetics is the restoration of sensory-motor hand functions in upper-limb amputees. Neuroprostheses based on the direct re-connection of the peripheral nerves may be an interesting approach for re-establishing the natural and effective bidirectional control of hand prostheses. Recent results have shown that transverse intrafascicular multi-channel electrodes (TIMEs) can restore natural and sophisticated sensory feedback. However, the potential of using TIME-recorded motor intraneural signals to decode grasping tasks has not as yet been explored. Approach. In this study, we show that several hand-movement intentions can be decoded from intraneural signals recorded using four TIMEs implanted in the median and ulnar nerves of an upper limb amputee. Experimental sessions were performed over a week, from day 16 to day 23 after the surgical operation. Intraneural activity was recorded during several hand motor tasks imagined by the subject and processed offline. Main results. We obtained a very high decoding accuracy considering 11 class states (up to 83%). These results confirm that neural signals recorded by multi-channel intraneural electrodes can be used to decode several movement intentions with high accuracy. Moreover, we were able to use same TIME channels for decoding over one week within the first month, even if the stability has to be confirmed during long-term experiments. Significance. Therefore, TIMEs could be used in the future to achieve a complete bidirectional approach exploiting neural pathways, to make a more natural and intuitive new generation of hand prostheses that have a closer resemblance to a healthy hand.


Introduction
The loss of a hand drastically changes the quality of the patient's life [1]. Simple daily activities suddenly become very complicated to perform. Restoring lost functions in subjects after hand amputation is a major challenge in neuroprosthetic applications [2]. Although important progress has recently been made, current solutions for the bidirectional control of hand prostheses still have important limitations, thus reducing the overall usability of a dexterous hand prosthesis. These prostheses are controlled by processing electromyographic (EMG) signals recorded from the muscles of the subject in the residual limb or elsewhere (see below). Surface EMG acquisition does not require surgery, so it is often used in upper-limb prosthetic control [3] with high degree of accuracy if a biomimetic control system is implemented [4]. However, even though it is easy to set up, surface EMG control has shown limited usability in practice, because the performance, in the case of a large number of degrees of freedom, significantly decreases when external factors are introduced, such as changes in electrode position or in environmental conditions [5]. Improvements can be achieved by using more advanced control strategies [6] or extracting the sources of neural information through EMG deconvolution with advanced multi-channel EMG systems [7,8]. To overcome the limits of the superficial technology and to improve the man-machine interfaces, more invasive approaches have been explored in the last decades [9][10][11]. A valid alternative to surface EMG is the Implantable Myoelectric Sensor (IMES) system [12], implanted in the residual muscles, able to record intramuscular EMG signals from both surface and deep muscles and transmit data wirelessly [13]. The first clinical trial with IMES was successfully conducted in a subject with below-elbow amputation [13].
For higher level amputations, Targeted Muscle Reinnervation (TMR) [14,15] might be a suitable surgery technique to enable prosthesis control using EMG signals. Once the residual nerve is reinnervated to another muscle, it works as a biological amplifier providing appropriate EMG signals for motor commands. Selective nerve transfer obtained with TMR surgery allows to increase the number of EMG sites, thus leading to a prosthetic control more intuitive than in the case of the naturally innervated muscles [16]. However, prosthetic control remains challenging in the case of above-elbow amputation, even after TMR [17]. Therefore, a recent study combined TMR with the use of IMES in patients with aboveelbow amputation [18]. These long-term implants provided promising results in terms of the robotic arms control over period of 2.5 years.
Following a different approach, increasing efforts have been made to develop and use invasive interfaces implanted on peripheral nerves to record signals for motor control. Indeed, neural interfaces showed to provide afferent sensations and provide sensory feedback [10,[19][20][21][22][23][24][25], but also allow electroneurographic (ENG) signals related to hand motor commands to be recorded from the residual nerves of the patients and decoded to control artificial limbs [26][27][28][29][30]. As sensory axons outnumber motor axons by a ratio of at least 9:1 in innervating human arms [31], difficulties in interacting with motor fibers are evident. Intraneural or intrafascicular neural interfaces represent an attractive solution for neuroprosthetic hand in terms of recording capability and selectivity since they could provide a more selective contact with motor fibers than non-invasive approaches. Directly recording from different efferent units and fascicles potentially enables a large set of motor commands to be identified [32], thus improving decoding performance. Among the intrafascicular interfaces used in this field, Utah slanted electrode array (USEA) [33] has been tested in animals and humans, providing very high selectivity and high invasiveness [34]. In subjects with upper limb amputation, USEAs were implanted in the median and ulnar nerves to control the virtual prosthetic hand with up to five independent degrees of freedom [28].
Recently, the same group demonstrated the advantage to combine neural and myographic recordings as inputs for a modified Kalman filter to estimate motor intention in two transradial amputee subjects [35]. The authors provided a real-time portable hand prosthesis working with 6 • of freedom.
A simpler design of interfaces, Longitudinal Intrafascicular electrodes (LIFEs), have been used to directly control grip strength and limb position in human [19]. Later, a slightly modified version called thin-film LIFE (tfLIFE) was developed, using multichannel contacts [36]. Recordings were decoded and successfully classified three hand movements plus rest, reaching an accuracy of around 85% [27,37]. Data were processed with wavelet denoising and spike sorting approaches described in [38].
As with the tfLIFEs, also transversal intrafascicular multi-channel electrodes (TIME) have multiple independent active sites but the implantation is perpendicular to the nerve fibers [39]. Biocompatibility and selectivity were shown to be better than in LIFE [36] and, recently, TIMEs have been shown to be able to provide a rich and useful sensory feedback in case of trans-radial amputation [23,24,40,41]. However, while some studies showed the capabilities of TIME for recording afferent neural signals in animals [42], the potential for efferent recording to decode motor intention have not yet been explored.
So far, recordings from intra-neural interfaces were treated with spike sorting algorithms. In works with USEA, spikes were extracted by applying an adaptive threshold based on the root-mean-square of the signal [28]. Recordings from tf-LIFEs were treated with a wavelet denoising technique to improve data quality before extracting spikes [38], or with a novel approach for spikes identification based on the computation of the energy of the signal with a moving average approach [43].
Here, we investigated the possibility of recording neural signals from TIMEs to decode ten different movement intentions plus rest from the recorded signals in a subject with upper limb amputation. We proposed a procedure to exploit the potentials offered by the large number of contact sites available in a multiple TIMEs implants, using automatic channel selection. We developed a new framework relying on the compound activity of ENG signals to determine the subject's motor intention. Neural motor decoding can provide an intuitive motor control and, if combined with neural sensory feedback, it can open new possibilities in neuroprosthetics leading to a complete and natural control of the artificial hand.

Subject recruitment and surgery
The subject was a 48-year-old female with righthanded transradial amputation (distal third of the left forearm). The amputation occurred 23 years before the enrolment. Four Transverse Intrafascicular Multichannel Electrodes (TIMEs) [39], with 14 active sites each, were implanted, two in the median and two in the ulnar nerve of the subject on June 24th, 2016 (figure 1). TIMEs were explanted on December 17th, 2016. Ethical approval was obtained by the Institutional Ethics Committees of Policlinic A. Gemelli at the Catholic University (Rome), where the surgery was performed. The protocol was also approved by the Italian Ministry of Health. Informed consent was signed. The clinical trial's registration number is NCT02848846.
During general anesthesia, through a 15 cm-long skin incision on the left arm, the median and ulnar nerves were exposed to implant a proximal and a distal TIME in each nerve. All the four TIMEs were implanted above the elbow. Four small skin incisions were placed laterally and medially to the main surgical cut. The cable segments were placed in subcutaneous pockets, externalized and secured with sutures and subcutaneous strain release loops, to be available for the transcutaneous connection with a neural recorder. Each single TIME was implanted transversally within the nerve fascicles. Microsutures secured the nerve implant. This implantation procedure lasted 8 h. After 180 d, the TIMEs were removed in accordance with the protocol and the obtained permissions.

Experimental protocol and hand-related task
The patient was enrolled in a six-month clinical trial (see details in [24]). During the first week, the patient rested to recovery after the implant surgery. The third week after implant, we started the recording experiments over a period of one week (from day 16 to day 23). Experiments (one session per day) were performed for two consecutive days (day 16 and day 17) and then every three days (day 20 and day 23). The last day, two sessions were recorded (one in the morning and one in the afternoon).
The subject was asked to perform finger flexions/grasps with the phantom hand reproducing the movement shown on the screen. The type and the timing of the task (start time, hand speed, rest time and end time) were specified using a real-time custom interface designed in LabView (National Instruments, Inc) positioned in front of the patient. The required movements and a sequence of pictures explaining the tasks are respectively shown in figure 1. The subject was also asked to reproduce the movement simultaneously with the healthy hand (right one) to constantly check the subject's attention. We defined five different grasping movements: Tridigital Pinch (Tr), Thumb opposition (Th), Power grasp (Pw), Ulnar finger movement (Ul), and Finger abduction and adduction (Fab/Fad). Each grip was repeated 10 times. The patient had to move her phantom hand for each trial as required; one trial lasts 2 s and was followed by 3 s of rest (no movement). The total movement consists of 1 s for the movement (Phase 1-flexion) and 1 s for coming back to the rest position (Phase 2extension). Here we reported recordings in 5 sessions, from days 16, 17, 20, 23 after implantation (two sessions on day 23).

Neural recorder and intrafascicular electrodes
The neural recorder was the Grapevine Neural Interface System (Ripple, LLC), which is a commercial device that can be used for the recording of neurophysiological data through up to 512 high-impedance microelectrodes, divided into four ports with 128 channels each. In the configuration adopted in this study, two Grapevine Micro Front-Ends were connected to a single port via a double front-end cable. Each front-end (up to 32 channels) was connected to two TIMEs. Each TIME includes 14 capacitively coupled active recording sites and 2 non-capacitively coupled reference electrodes. Therefore, 4 TIME devices were recorded simultaneously and digitally sampled at 30 kHz.

Electroneurographic recordings analysis
Collected electroneurographic (ENG) data were analysed in MATLAB (R2017a, The MathWorks, Inc.). Raw ENG data from 56 active sites were preprocessed with a band-pass filter between 300 and 3000 Hz (4th order Butterworth filter) and downsampled at 10 kHz. Then, we computed the binned-RMS (root mean square) for each channel as followed. A band pass 2nd order Butterworth filter between 2 and 100 Hz was applied to the square of the signal. The signal was binned into 25 millisecond windows (corresponding to 250 samples) and the root of the mean value was computed. We finally obtained a binned-RMS-ENG sampled at 40 Hz (figure 2(a)). Figure 2(a) shows the recorded electroneurografic signals before and after signal pre-processing for three different channels. In figure S1(a) (stacks.iop.org/JNE/17/026034/mmedia), a representative example of the pre-processed signal and the related binned-RMS-ENG signal from the first session are reported. The mean signalto-noise ratio (SNR) across all active sites was computed for each TIME for all the five sessions on both the pre-processed ENG and the binned-RMS-ENG (figure S1(b)). SNR dB is defined as in equation (1) [44]: where task refers to the movement and baseline is a signal of the same duration in absence of movement one second before the beginning of the task. For comparison purposes we further computed the firing rate of the raw ENG collected with TIMEs as proposed in [28]. After data pre-processing, spikeevents were extracted with a negative threshold equal to 3.5 times the RMS of the whole signal. Then, eventcount was binned at 30 Hz to obtain the firing rate.

Electromyographic signals recordings
During the experiment, four surface electromyographic (EMG) signals were acquired at 2 kHz through Grapevine System (Ripple, LLC) from the residual muscles of the subject's forearm. In particular, two solid hydrogel interfaces (Kendall ARBO, Ag/AgCl) picked up signals from the dorsal (digit extensor extrinsic muscle-EMG1, EMG2) and two from the ventral (digit flexor extrinsic muscle-EMG3, EMG4) side of the forearm. The differential bio-potential recordings were first filtered in hardware through a low-pass filter with a 500 Hz cut-off and then amplified by a factor 5000. Signals were digitally filtered with a 4th order pass-band (15-375 Hz) Butterworth IIR filter, and a notch filter was applied at 50, 100 and 150 Hz to remove the power line interference. The fourth EMG (EMG4) signal was discarded because the acquisition was not synchronous with the others by mistake. Offline, EMG signal was high-pass filtered at 3 Hz (4th order Butterworth), rectified and then a low pass filter at 60 Hz was applied (4th order Butterworth) to obtain the EMG envelope ( figure S2(a)).

Channel selection for dimensionality reduction
We proposed an automated channel selection based on principal component analysis (PCA), which maximizes features separability using signal variance (figure 2(b)), as follows. First, Principal component analysis was performed on the processed neural signals (the binned-RMS-ENGs, 56 recordings). Then, we computed the number of Principal components (PCs) needed to explain at least the 99.75% of the total variance for each session. In figure 2(b), we reported the number of PCs across days, which varies from 4 to 10, increasing across sessions, except for the last one. For this reason, we limited our analysis to the first ten components. To reduce the dimensionality of the inputs, we computed the linear correlation between the binned-RMS-ENGs and each principal component ( figure 2(c)). For each PC, channel were sorted in a descending way based on the correlation coefficient (figure 2(d)).
Finally, the first two channels with the highest correlation coefficient with the first ten principal components were selected and used as input features for the decoding algorithm. The inset in figure 2(d) refers to day 16. Note that the final list is composed of 14 channels instead of 20 as some channels occurred more than once.
Furthermore, we computed an alternative channel selection following what proposed in [28]. Briefly, we computed the correlation between the neural signal and the movement cue position (a semisinusoidal function) and we selected the channels with a correlation at least 0.5 between neural signals and the hand kinematics signals [28].

Neural decoding algorithm
The selected channels were used as input features the decoding algorithm. For all the trials, each bin of the the first 200 milliseconds after the external trigger (corresponding to 8 bins) were individually labelled and associated to a specific movement. A support vector machine (SVM) classification algorithm with a quadratic kernel trained using the one-vs-one strategy to decode movements. A five-fold random cross-validation procedure was carried out to evaluate parameters and to ensure the unbiased correctness of the classification performance. We defined overall classification accuracy as the mean value of the percentage of correct predictions per class, which corresponds to the mean value of the diagonal in the confusion matrix.
Three classification strategies were considered: a support vector machine (SVM), k-nearest neighbors algorithm (KNN-11 neighbors), and linear discriminant analysis (LDA). We computed the performance for different number of channels (sorted as described above) for these three classifiers ( figure S3(a)). By increasing the number of inputs, the performance improved as expected for all the three different classification strategies. Both for SVM and KNN, the classifier reaches a performance saturation point in and does not benefit by increasing the number of inputs. However, SVM can reach higher performance with a lower number of inputs. Thus, SVM was chosen for our purposes instead of the other two proposed. We repeated this analysis for each session, using the first 14 channels selected with PCA-based method (see 2.6). Figure S3(b) shows accuracy across sessions for the three different classifiers after channel selection.

Results
We investigated the possibility of decoding hand motor intentions from peripheral nerve recordings from transverse intraneural interfaces (TIMEs) in a subject with upper limb amputation. Neural recordings were collected simultaneously in multiple experimental sessions over time to evaluate the stability of the neural interface and the decoding procedure proposed.

Possible EMG contamination on the neural signal
Before proceding with neural decoding, we checked any possible contaminations of the muscular activity that could have affected neural signals. Correlation was computed across sessions between the envelope of each electromyiographic signal (EMG1, EMG2, EMG3) and the neural signal after processing, both the binned-RMS-ENG and the Firing rate. Although correlation with EMG was significant (p < 0.05) for most of the channels, the fraction of variance explained was very low (mean R 2 was lower than 0.08, figures S2(b) and (c)). This confirms that the EMG signal had a very low effect on the neural signal.

Neural decoding approach
The computation of the binned-RMS-ENG enabled to improve substantially the quality of the signal (figure S1) as shown by the mean SNR and the standard deviation for each TIME across sessions for the raw and the binned-RMS ENG (figure S1(b)). Figure 3(a) shows the evolution of one representative channel from each implanted TIME (Channel 1 and 2 Median, Channel 1 and 2 Ulnar) over the first second of the trials for the different tasks (phase I of the movement). Figure 3(b) shows the distribution of single values of the binned-RMS-ENG for each trial during different movements extracted from two representative median and ulnar active sites. The results show the importance of using multi-channel recording for decoding. The procedure is illustrated in a qualitative way in figure 3(b). In fact, we showed, as an example, that ulnar finger movements and finger abduction can be discriminated from power grip movements, using the channels shown in the left panel. On the contrary, tripod and thumb movements can be discriminated using the channels shown in the right panel.

PCA channel selection strategies results
After ENG signals were preprocessed, Principal Component Analysis was performed as explained in the Methods section. Following the PCA-based channel selection strategy applied to the binned-RMS-ENG, the final list for the first recording session was composed of 14 channels. Then, we kept the same number of channels for the following sessions to facilitate comparison. As shown in figure 4(a), at least one active site for all the four implanted TIMEs was selected for each experimental session. This shows that each implanted multi-electrode device carries specific movement-related information, even if signals from adjacent active sites could be redundant.
We applied the same strategy to the firing rate signals. Interestingly, in this case we needed a larger number of Principal Components to explain the 99.75% of the total variance ( figure S4(a)). In the case of PCA-base channel selection, we selected a fixed number of channels for the decoding. Hence, we computed the final list of 14 channels for each session. The distribution of these 14 channels per TIME across days is reported in figure S4(b).

Decoding of complex movements from PCA-selected compound ENGs
First, we preliminary tested our decoding procedure across sessions by considering only two motor tasks: power close and open, plus the rest state and different tasks belonging to the same category, i.e. three different closing movements: tri-digital pinch, thumb opposition and ulnar finger movement, which require different activations of the median and the ulnar nerves ( figure S5).
Once the ability to decode tasks for different coarse movements was demonstrated, we tested whether the procedure was sufficiently accurate, we classified all the tasks performed during the experiments: we considered the phase I (flexion/abduction) and phase II (extension/adduction) for each of the five movements and the resting position as separate classes ( figure 4). TIME channels were selected based on PCA (see Methods), and the selection was performed independently for each of the five sessions. We obtained a high performance (above 77%, see dark blue markers in figure 4(b)), which is significantly better than chance (upper-tail one-sided χ 2 test of observed frequency vs chance frequency for f = 10, p = 0.01).
We then investigated to what extent the quality of the performance depended on the fact that PCAbased channels selection was performed independently for each session. Indeed, selecting the channel every day would be very complicated in real-life applications, for which the optimal design would be to select the channels only once during a dedicated post-implant session and use the same set in all the following sessions. To assess the stability of the performance in this case, we evaluated classification performance for every session using the channels selected during the first day (light blue markers in figure 4(b)). We found that overall accuracy was more than 71%. The performance was still high even without the customized channel selection strategy and there was no statistical difference between the two cases (p = 0.0749 one-tailed Wilcoxon signedrank test). This suggests that in a real-life situation channel selection would not need to be performed every day.
Confusion matrix examples are drawn to assess the reliability and the efficiency of the proposed classifier in different cases. Details of the decoding performance demonstrate the low variability across days and the limited number of false positives: figure 4(c) reports the performance from day 16 (first session, accuracy 79%), and figures 4(d) and (e) show results for day 23 (fifth session) with day by day channel selection (accuracy 83%) or using the channel set selected during the first session (accuracy 80%).
These results showed that SVM was able to distinguish and correctly classify fine movements in both flexion and extension phases with high performance. In addition, the accuracy level was high in all the considered cases even if the set of channels was determined during the first session and then used for all remaining sessions, thus making this approach easy to implement in real life applications.

Comparison with alternative decoding approaches
Finally, to assess the goodness of our new approach, we compared the performance of different approaches to classify 11 movements using TIME neural signals. In particular, we compared the accuracy obtained using the binned-RMS-ENG or the firing rate signal as input for the classifier after 14 channels were selected with PCA-based strategy.
For each case, we considered the possibility to keep using the channels selected during the first session. Results across days are reported in figure 5(a). Considering the 14 channels selected day by day, the accuracy using the binned-RMS-ENGs (dark blue markers) was higher than the accuracy obtained with the firing rate (dark red markers) (p ≪ 0.001, onetailed Wilcoxon signed-rank test).
As in figure 4(b), also for the firing rate we considered the possibility to re-use the channels selected during the first session, but this lead to lower performance (p < 0.01, one-tailed Wilcoxon signed-rank test).
The same comparison was performed with correlation-based channel selection ( figure 5(b)). Note that this method is complementary to the PCAbased one: in this case, the threshold for including a single channel is fixed and the total number of channels selected can change. Results showed that there was no substantial difference between using the binned-RMS-ENG and the Firing Rate (dark blue vs dark red markers, p = 0.1716 one-tailed Wilcoxon signed-rank test), nor between selecting the channels day by day and using channels selected on the first session (p = 0.7384 for binned-RMS-ENG and p = 0.2494 for firing rate one-tailed Wilcoxon signedrank test).
This stability in part depends on the fact that, many channels were used (data reported in figure 5(c)). In particular, almost all available channels were selected based on the correlation coefficient: 51.6/56 channels for the binned-RMS-ENG, 31.8/56 channels for the firing rate. This also suggests that the binned-RMS-ENG is more correlated with the cue.

Discussion
We demonstrated the possibility of recording human neural signals using intrafascicular electrodes (TIME) for hand control purposes and we proposed a new approach to select the most informative neural channels and to decode hand grasp intention in a subject with amputation. In previous studies, the biocompatibility and longevity of intrafascicular electrodes was demonstrated in animal models [45] and preliminarily confirmed in human experiments with long-term stimulation for sensory feedback [24]. Here, we recorded neural activities among five sessions over the first month after implantation (from day 16 to day 23), indicating the potential of using TIMEs for chronic neural recording purposes.
The analysis of neural signal consisted of three steps: (1) feature extraction from the down-sampled raw signal by computing a compound activity, the binned-RMS-ENG for each channel (56 active sites); (2) Principal component analysis to reduce the amount of data to elaborate online by selecting the most informative channels; (3) the implementation of the SVM classifier and evaluation performance across days for 11 classes of movements. Overall, we proposed a robust framework to decode hand grasps from intraneural recordings, which provided higher classification performance than other strategies here reported and discussed.
We explored the feasibility of using TIMEs to record neural activity related to hand movements using new decoding algorithms with high stability and reliability. We tested three main hypotheses: (1) the possibility of extracting complex motor information from compound signals; (2) the capabilities of multiple implanted TIMEs to decode motor intentions decoding performance; (3) the stability over a week of the proposed approach.
In previous work, different kinds of neural interfaces implanted in the case of trans-radial amputation have been used, such as tfLIFE (each with eight recording/stimulating channels) [37] and a 100channel Utah slanted electrode array (USEA) [28]. In Rossini et al (2010) [37], four tfLIFEs were implanted but only three actions (power grip; pinch grip; flexion of the little finger) were decoded with a >85% real-time correct classification. As in our work, they used SVM as a classifier, but it was trained on waveforms of identified spikes after wavelet de-noising. In contrast, Wendelken et al [28] decoded the intended finger and wrist positions with a modified Kalman filter in real-time using the neuronal firing patterns as inputs. Interestingly, the Kalman filter allowed to continuously decode a movement based on 5 [28] or 6-DOF [35] (degrees of freedom), where DOF is defined as the motion of a digit or the wrist in a single linear or rotational axis in either direction, in contrast with pattern recognition and classificationbased approaches, able to detect a limited number of classes, based on the implemented training.
Thus, we proposed the root mean square (RMS) as the signal feature for an SVM decoder. RMS represents a compound multiunit activity signal and is an advantageous method because it considers the whole neural activation without computing spike sorting or using advanced techniques, which require a large computational cost. This approach can be compatible with online applications for closed-loop prosthesis control.
We showed that the recordings acquired from a multi-electrode device implanted in the median (M1, M2) and ulnar (U1, U2) nerves (proximal and distal TIMEs for each nerve) can provide distinct information, as shown in figures 3(a) and (b). Here, four representative channels, one for each implanted TIME, showed a task-specific modulation of the RMS during different tasks (figure 3(a)). As RMS patterns are related to the movements, values can be separated if we consider two different active sites, one from the median nerve and the other from the ulnar nerve, during the same tasks, as in figure 3(b). However, only the combination of multiple active sites allows for the control of several dexterous movements, such as thumb flexion and ulnar fingers extension.
As we are working with multi-channel interfaces, the core of the proposed algorithm is the selection of the active sites as inputs for the classifier. While in Rossini et al [37] the ENG channels were selected based on the best signal-to-noise ratio, Wendelken et al [28] proposed an algorithm that automatically selected only those channels with a high correlation between the firing rate and the training movement cue position. Here, we used a different approach, based on the principal component analysis of all the recordings, to reduce dimensionality without losing information. However, we reported more traditional methods [28] for comparison. There are 56 active sites from four different TIMEs, two placed in the median nerve and two in the ulnar nerve of the amputee arm (see Methods). Considering that the ratio between motor and sensory fibers is very low [31], we assumed that some active sites could be useless for our decoding purposes during motor tasks. This hypothesis was corroborated by the fact that during the movements, we needed at most the first ten principal components to explain 99.75% of the total variance of the dataset. Thus, we extracted the first two channels most closely correlated with the first ten principal components. This strategy of selecting channels automatically enables only active sites to be considered, which carry activity related to hand movements, and to discard active sites not relevant for motor decoding purposes.
Interestingly, PCA selected at least one channel from each TIME, which confirms the importance of the use of multiple electrodes from different nerves for motor decoding.
It is important to note that due to narrow movements of the electrodes and other causes related to the change in the environment of the nerve the information carried in each active site is a priori not the same on different days. However, although PCA extracted different channels as inputs for the decoding part, we demonstrated that the active sites chosen on the first day could be also used for the following sessions. This is interesting, as active sites that have been damaged could be easily replaced with other active sites because of their redundancy.
The comparison between the decoding performance of binned-RMS-ENG and firing rate highlighted several differences. First, when the same number of channels is selected, the performance of the former is only slightly above the one of the latter (figures 5(a) and S6). Second, binned-RMS-ENG is more robust to channel selection, as the decrease associated to using the same channel set across sessions was less than the one of firing rate ( figure 5(a)). However, when considering correlation-based channel selection, binned-RMS-ENG displayed strong correlation with behavior in much more channels than firing rate (figure 5(c)) hence leading to an overall higher decoding ( figure 5(b)). Finally, comparing the two channel selection strategies here discussed, accuracy is better in the case of the selection based on correlation, as displayed in figures 5(a) and (b) for both the binned-RMS-ENG and the firing rate. However, it should be noted that this strategy requires at least more than twice the number of channels used in the case of PCA ( figure 5(c)). This would lead to an increased computational cost, harder to implement in online contexts.
Although it provides promising results, this study has limitations that should be addressed in future work. First, we should confirm our results with more trans-radial amputees and during the real-time control of hand prostheses.
Another very important aspect to investigate is the long-term usability and robustness of these results since our recording sessions were performed during the third week after the implantation (as we later focused only on sensory feedback). Therefore, we should perform longer-duration tests to verify whether PNS neural signals can be recorded several months after the implantation and whether the use of channels selected a few weeks after the implantation can be used over months with no significant degradation of the decoding abilities. Until then, the long-term longevity remains an open question that we need to address in the near future.

Conclusions
This work provides interesting insights into the possibility of controlling a robotic hand prosthesis, by decoding neural signals recorded by implanted TIMEs in the median and ulnar nerves. The feasibility of a multi-class decoding was investigated, and we demonstrated the robustness and efficacy of the methods proposed. In addition, the position of the implant (above the elbow, see figure 1) allows us to envisage the application of this prosthesis design for trans-humeral amputation, using the residual nerves function as found for trans-radial cases. In fact, notwithstanding research promising results in cases with trans-humeral amputations [18], their possibility to control several hand functions is still limited even when Targeted Muscle Reinnervation and pattern recognition are exploited for EMG-based control [46].
As anticipated, the approach presented in this manuscript could be used as a decoder part of a closed-loop neuroprosthesis, which could potentially provide both the natural sensory feedback and natural motor control. However, several challenges must be addressed to achieve this goal, such as the development of approaches to also record neural signals during peripheral stimulation (i.e. artefact removal). Finally, new algorithms should be developed to extract force and velocity information from TIMErecorded neural signals [29].
We proposed a framework to decode motor intention in the case of people with upper limb amputation. However, our approach relies on very general assumptions and could thus be effectively applied to decode behavioral variables of interests in a broad range of brain computer interfaces [47].