2.2. Recorded Signals
The signals database [
24] was recorded in a setup that included intramuscular fine-wire EMG electrodes in a differential recording configuration, with volunteers performing a set of hand gestures in a timely fashion and the acquisition of isometric hand forces using a custom-made measurement device.
The iEMG signals were recorded from 9 forearm muscles divided into 2 groups which were associated with the 2 levels of amputation:
The short residual limb (SRL) protocol targeted the following muscles: flexor carpi radialis (FCR), extensor carpi radialis (ECR), pronator teres (PT), flexor digitorum profundus (FDP), extensor digitorum communis (EDC), and abductor pollicis longus (APL);
The long residual limb (LRL) targeted the following muscles: flexor digitorum profundus (FDP), extensor digitorum communis (EDC), abductor pollicis longus (APL), flexor pollicis longus (FPL), extensor pollicis longus (EPL) and extensor indicis proprius (EIP).
The positioning of the fine-wire electrodes was performed by a senior consultant in clinical neurophysiology. The signals picked up by the pairs of fine wires (in differential recording configurations) were amplified and digitalized using the Quattrocento biomedical amplifier system from OT Bioelettronica, Torino, Italia. The amplifier had a common mode rejection ratio (CMMR) higher than 95 dB, an input resistance higher than 10
11 Ω on the entire bandwidth, and a noise level lower than 1 µV
RMS. To reduce the interferences induced in the leads between the fine wires and the amplifier, shielded differential preamplifiers were used in close proximity to the fine-wire skin entry points. In parallel with the iEMG recordings, forces resulting from hand muscles contractions were also recorded using the measurement device which kept the hand stationary during the procedure. In total, 9 force gauges picked up the resulting hand forces: one per finger (D2 (index finger)–D5 (little finger)), two for the thumb, and three for the wrist. The recording protocol was guided by an automated graphical user interface which, in a strictly timed manner, displayed commands and cues to the volunteer. It also provided feedback on the exerted force which was crucial for force matching/tracking tasks. An example of this functionality is the sine wave tracking task which started by instructing the volunteer to perform maximal voluntary flexion and the extension of a finger, thumb or the wrist, the adduction–abduction of the thumb, or the pronation–supination of the wrist. Although the inserted electrodes targeted only a subset of the muscles involved in the abovementioned hand movements, the protocol was consistent for all volunteers and all electrode placements. This way, it was possible to compare muscle synergies and crosstalk between iEMG channels, which is not in the focus of this study, but might be of interest for other studies that use the database. Then, the software generated a low-frequency sine wave with an amplitude equal to 20% of the maximal voluntary flexion/extension and a frequency of 0.1 Hz and displayed it in the same graph with the finger or wrist force that the volunteer produced (see
Figure 1). The idea here was that the volunteer would match the computer-generated sine wave by continuously eliciting an equivalent force.
Although the measurement protocol included various hand gestures, for the scope of this paper, only the sine tracking data were used because the aim of this paper is to produce the direct and proportional control of a multi-joint prosthetic hand.
As the iEMG was recorded at 10 kHz, the force data were up-sampled for easier manipulation. In addition, the commands and cues presented to the volunteers were recorded for the offline segmentation of the measurements into individual finger/wrist movements. The Matlab data container files (*.mat) can be found here: (
https://figshare.com/s/06f113bd74ecf6384729 (accessed on 2 June 2022)).
2.3. Signal Pre-Processing
As the methods presented in this paper are intended for online implementation, the recorded signals were minimally pre-processed. Namely, the powerline noise was superimposed with the iEMG signal, which was relatively weak compared to the sEMG. To remove the powerline base frequency (
f0) and its harmonics (
f0 × i, i = 2, 3, 4…), which also exceeded iEMG signal amplitude, a band-stop comb filter comprising third-order Butterworth notch filters (
f0 = 50 Hz and Δ
f = ± 2 Hz) was applied to the recorded signals [
27]. The next pre-processing step was the segmentation of recorded signals based on the automatic data labeling performed during the recordings. In this stage, force outputs were divided between positive and negative values or phases (flexions–extensions, adductions–abductions, pronations–supinations) so that they could be independently associated with different muscles. Finally, as the last step preceding the algorithm stage, optimal matchings between targeted muscles, elicited movements and the force gauges were established. On top of that, within the selected force channel, a phase (positive or negative) was associated with the actions of specific muscles. In other words, for each iEMG signal (muscle) there was an associated hand movement that specifically activated the muscle where the fine-wire electrode was placed. Furthermore, there was a sensor within the force measurement device that registered the force generated by the muscle contraction of interest. For example, activation in the PT muscle was always associated with the command to pronate the forearm and the elicited force was measured by the sensor designated for the measurement of wrist pronation. Nevertheless, for some muscles, there could be a variety of different matchings for different subjects due to the multi-compartment nature of the muscles in which the fine-wire electrodes were anchored or the individuals’ strategies for producing the commanded contractions. Such examples include the FDP, which could flex any of the D3–D5 fingers depending on the activated compartment, or EDC, which extended the D2–D4 fingers. Furthermore, depending on individuals’ synergies, APL could be more active during the command to push the thumb to the left (right-handed setup) or upwards. An example of the signal pre-processing method is shown in
Figure 2.
The iEMG–movement–force matchings were initially selected based on the signal-to-noise ratio of iEMG within different segments (movements) and refined based on the minimal root mean square error (RMSE) between a normalized force gauge output and the estimated force using the MAV algorithm.
2.4. Testing of Algorithms
The algorithm evaluation procedure was designed with a specific prosthesis-use scenario. The performance of the algorithms was tested in a similar fashion as that shown in
Figure 2 by using the optimal pairings between the iEMG channels, the phases of the force channels, and the movements found during the signal pre-processing stage. It was envisioned that the full setup should be as quick as possible. In line with this principle, only the first two of ten sine tracking periods per tracking task were selected to normalize the outputs of the algorithm for force estimations (similar to the previous study [
28]), while the following tracking periods were used only for evaluating the performances of the algorithms. Such a condition results in fast calibration that requires only two repetitions of slowly increasing and decreasing isometric force elicited by muscles during various hand movements. Although in the case of amputees there is no possibility of tracking muscle forces, the same principle still applies as the only purpose of the initial calibration is to match muscle activity and forces, and to normalize force output. Thus, in the realistic scenario, the amputee will be asked to slowly increase and decrease force while imagining specific hand movements [
29].
The testing of the iEMG algorithms for extracting signal features was also performed in a manner that corresponded to the real-time application. To achieve this requirement, all algorithms were implemented within the moving/sliding windows of different widths where the computed value was adjoined with the last (newest) sample from the window. This scenario corresponds to the direct control of a prosthesis degree of freedom in real-time using a single muscle.
The algorithms selected for evaluation are already well-known from numerous publications in the field of prosthetics [
30,
31,
32]. Due to relatively poor sEMG signal quality, these algorithms are often used only for feature extraction, while some machine learning algorithms are used to extract relevant information regarding muscle activation. The following algorithms were systematically used in conjunction with the recorded iEMG signals and evaluated against measured forces.
- 1.
Mean Absolute Value
Mean absolute value (MAV) is the favored EMG feature in many myoelectric control applications [
33,
34]. It is calculated within a moving average window of the rectified iEMG signal.
- 2.
Variance
Variance (Var) is the mean value of the square of the deviation of the signal [
35]. As the mean of iEMG is close to zero, the equation can be simplified for faster calculations.
- 3.
Slope Sign Change
Slope sign change (SSC) is a time-domain method used to estimate the frequency feature of the iEMG signal [
36]. The calculation of the SSC relies on counting changes between positive and negative slopes among three consecutive samples. To limit SSC calculation only to periods with iEMG activity, the threshold function is imposed in the feature extraction method.
- 4.
Zero Crossing
Zero crossing (ZC) is the function that counts the number of consecutive EMG samples that change signs within the sliding window [
33]. Similarly to the SSC calculation, the threshold function is imposed to remove the calculation of ZC during periods without pronounced EMG activity.
- 5.
Willison Amplitude
Willison amplitude (WA) is a measure related to the superimposed action potentials that make the EMG signal [
37]. The WA is the number of consecutive differences between consecutive samples that exceed the set threshold.
- 6.
Waveform Length
Waveform length (WL) is the cumulative length of the waveform over the time window [
38].
- 7.
Envelope
The signal envelope (ENV) is calculated as the root mean square over the time window.
- 8.
Total signal energy
The total signal energy (Etot) is defined as the sum of spectral amplitudes calculated using fast Fourier transformation.
- 9.
Teager energy in time domain
The Teager energy operator is a non-linear operator that can track the energy and identify the instantaneous frequencies and instantaneous amplitudes of signals at any instant. It strongly correlates with the nature of the iEMG signal which comprises individual action potentials [
39,
40,
41]. Teager energy in the time domain (Ttd) was calculated using the Teager–Kaiser energy operator. The resulting values were then smoothed using a moving average filter defined in the same manner as the sliding windows present in other algorithms.
- 10.
Teager energy in frequency domain
Another implementation of the Teager energy operator is in the frequency domain (Tf) using fast Fourier transformation [
42].
- 11.
Modified Teager energy
The modified Teager energy (Tf_mod) is similar to the Teager energy operator in the frequency domain (Tf) with the only difference being that the frequencies are not squared.
- 12.
Mean of signal frequencies
Mean of signal frequencies (MNF) is calculated from the windowed iEMG power spectrum as the average frequency [
43].
- 13.
Median of signal frequencies
Median of signal frequencies (MDF) is calculated as the frequency at which the power spectrum is divided into two regions with equal power [
43].
- 14.
Firing rate
The calculation for the firing rate (FR) iEMG signal feature is performed by implementing the algorithm presented in [
21]. The algorithm is based on counts of action potentials within the iEMG signal that are larger than the set threshold.
The mathematical formulas used to compute algorithms are given in
Table 1.
To provide greater insight into the iEMG signal properties, the abovementioned computational methods were optimized to provide the lowest discrepancies between measured and estimated forces. The optimization (parameter exploration) was performed in a brute-force manner by testing all combinations of parameters within defined ranges. The rationale behind this method is to provide outputs for the incrementally increasing parameters in order to obtain the gradual evolution of error between measured and estimated force. The main reason for having such data is to identify trade-offs between force estimation error and computational complexity.
The computational complexity of individual algorithms is estimated theoretically and practically. For the theoretical computational complexity, which is completed in big O notation, the algorithms were analyzed down to the basic arithmetic operations. The results for theoretical computational complexity are given in
Table 2. The practical computational complexity of the algorithms was evaluated as the execution time for different window sizes. To ensure that the processing was not biased by the specific processor architecture, the tests were repeated on different platforms:
PC with Intel i7-6700K, 64-bit processor at 4 GHz;
Teensy 4.0 with Cortex-M7, 32-bit processor at 600 MHz;
Teensy 3.6 with Cortex-M4, 32-bit processor at 180 MHz;
BLE-Nano with Cortex-M0 (NRF51822), 32-bit processor at 16 MHz;
Arduino-Nano with ATmega328, 8-bit processor at 16 MHz.
The implementation on the PC platform was performed with Matlab 2018b (The MathWorks, Natick, MA, USA) scripts where the timing was an average of all sliding window computations within the whole signal. It should be noted that the execution time of algorithms on the PC platform was not deterministic nor constant, as the operating system (Windows 10, Microsoft Corporation, Redmond, WA, USA) was not in real time. To minimize the variability of the execution time required for single window processing, the results were based on the averaged values for all signals and all subjects. Thus, the execution times on the PC platform are given only for inter-algorithm comparison. The implementations on other real-time platforms were written and compiled in the Arduino IDE environment using a single-precision floating-point format (float32) which guarantees the same conditions for all three processors. All functions, except for fast Fourier transformation (FFT), were written using basic mathematical operations. The Arduino library (github.com/kosme/arduinoFFT (accessed on 18 February 2022)) was modified for single precision and used as an FFT function in Arduino IDE. The exact duration of individual algorithm executions was measured by pulling a single digital output port during the computations. Furthermore, for the processors based on the Cortex-M4 or M7 architecture, some of the algorithms were implemented using CMSIS-DSP functions that are highly optimized for these types of operations.
The parameter included in all the algorithms that was varied was window size. An additional parameter present in some of the algorithms was the threshold (SSC, ZC, WA, and FR) which was also varied together with the window size. The list of varied parameters is shown in
Table 2.
The range of window sizes tested within this study was 50–1050 ms, which is wider than that of the state of the art [
32,
44,
45,
46]. There are several reasons for extending the range of tested window width. First, we wanted to provide computational/practical evidence of an optimal range of window sizes that should be used in conjunction with iEMG signals. Secondly, a wider window impacts computational time, which in turn results in increased controller delay, which has been identified as one of the obstacles in providing intuitive prosthetic control [
9,
47]. As microprocessor technology is continuously advancing, there is a need to update general knowledge regarding computational time for different EMG feature extraction algorithms, window widths, and processor architectures. Thus, providing both quantitative and qualitative information about algorithm performances, even for wide window sizes, should be beneficial for future studies. The increment of the sliding window width for all algorithms was set to 100 ms to provide 10 equally spaced evaluation points. The thresholds for SSC, ZC, and WA were defined as signal “dead zones” and, as in [
33], were based on the system noise. In this study, we estimated the noise by calculating the MAV of the EMG during the rest period. The MAV (rest) was computed from the first 100 ms of each segmented movement (isometric contraction) which did not contain voluntary iEMG, as the command for initiating muscle contraction was delayed in order to enable the subject to focus on the subsequent hand movement. For the purpose of estimating the optimal dead zone range, thresholds between 0 and Q × MAV were used, where Q was the multiplier of the MAV (rest) value. The parameter Q was varied in the range (0–4) with 0.2 increments during the exploration of the parameters. The threshold for the FR algorithm was calculated as a quantile of the iEMG signal during the first full period of the sine tracking task and it varied between the 85th and 99th quantile with 1 quantile increments.