Algorithms for Automated Calibration of Transcutaneous Spinal Cord Stimulation to Facilitate Clinical Applications

Transcutaneous spinal cord stimulation (tSCS) is a promising intervention that can benefit spasticity control and augment voluntary movement in spinal cord injury (SCI) and multiple sclerosis. Current applications require expert knowledge and rely on the thorough visual analysis of electromyographic (EMG) responses from lower-limb muscles to optimize attainable treatment effects. Here, we devised an automated tSCS setup by combining an electrode array placed over low-thoracic to mid-lumbar vertebrae, synchronized EMG recordings, and a self-operating stimulation protocol to systematically test various stimulation sites and amplitudes. A built-in calibration procedure classifies the evoked responses as reflexes or direct motor responses and identifies stimulation thresholds as recommendations for tSCS therapy. We tested our setup in 15 individuals (five neurologically intact, five SCI, and five Parkinson’s disease) and validated the results against blinded ratings from two clinical experts. Congruent results were obtained in 13 cases for electrode positions and in eight for tSCS amplitudes, with deviations of a maximum of one position and 5 to 10 mA in amplitude in the remaining cases. Despite these minor deviations, the calibration found clinically suitable tSCS settings in 13 individuals. In the remaining two cases, the automatic setup and both experts agreed that no reflex responses could be detected. The presented technological developments may facilitate the dissemination of tSCS into non-academic environments and broaden its use for diagnostic and therapeutic purposes.


Introduction
Epidural electrical stimulation (EES) of the lumbar spinal cord has recently experienced a surge of interest because of its potential to restore voluntary control of locomotion in individuals after severe spinal cord injury (SCI) [1][2][3]. Through the recruitment of large-to-medium diameter proprioceptive and cutaneous afferents within lumbar and upper sacral posterior roots [4,5], EES can facilitate the alleviation of severe lower limb spasticity [6] and the generation or augmentation of rhythmic and locomotor-like lower limb activity in otherwise paralyzed legs in individuals with SCI [1,4,7,8]. Moreover, in other neurological disorders, treatment effects of EES are under active investigation. For example, in advanced Parkinson's disease (PD), EES was shown to ameliorate motor symptoms such as impaired gait function and postural stability [9][10][11][12], yet a recent study could not reproduce these outcomes [13]. A general problem of EES is the lack of clinical or physiological markers for identifying treatment responders in advance [14].
The target neural structures of lumbar EES [4,5] can also be recruited noninvasively by using transcutaneous spinal cord stimulation (tSCS) [15][16][17]. Transcutaneous SCS uses surface electrodes placed on the paravertebral and abdominal skin to generate a current flow through the lower trunk, partially crossing the dural sac [5,17] (see Figure 1). Independent studies have shown the efficacy of tSCS to ameliorate spasticity and augment voluntary motor control, including locomotion in individuals with SCI [18][19][20][21][22][23][24] as well as multiple sclerosis [25,26]. As a clinically accessible and noninvasive approach, tSCS was suggested to hold the potential to develop into a widely used neurorehabilitation technique and to serve as a screening tool to estimate individually attainable therapeutic outcomes of EES [23].
The application of tSCS has so far been restricted to specialized research centers, in part owing to the required expert knowledge and constraints in clinical time management. For example, a necessary prerequisite to induce neuromodulatory effects in the lower limbs by EES or tSCS is the specific placement of the epidural or surface electrodes, respectively, so as to overlie the spinal cord segments innervating lower extremity muscles [6,8,17,20,23,27]. Such placement can be validated via the electromyographic (EMG) recording of evoked responses, i.e., short-latency reflexes initiated within the posterior roots, so-called posterior root-muscle (PRM) reflexes [1,7,8,16,18,22,[28][29][30][31]. These reflexes are generally thought to result from the activation of proprioceptive fibers within the posterior roots that cause synchronized responses of motoneurons in the spinal cord [32,33]. With respect to tSCS specifically, the placement of the paravertebral stimulating electrode typically follows a multi-step procedure. First, after rough palpation of the spinal column, a self-adhesive surface electrode is placed over the spine at a level estimated to correspond to the T11/T12 spinous processes [29]. Single stimulation pulses are then applied at incremental amplitudes with the aim to elicit PRM reflexes in L2-S2 innervated lower limb muscles [16,29]. In order to achieve this aim, the electrode may have to be relocated by several centimeters in either the rostral or caudal direction, and with each new position, the procedure of single stimulation pulse application is repeated. With the electrode placement eventually designated for therapy, double stimuli are applied, normally with interstimulus intervals of 30-100 ms, to test for the presence of post-stimulation attenuation of the evoked responses and, hence, identify them as reflexes [18,29]. In contrast, post-stimulation attenuation is not observed for EMG responses that result from the direct stimulation of efferent motor pathways (M-waves) in the anterior roots or peripheral nerves [18,29]. Finally, reflex response thresholds are determined based on available EMG recordings. In tSCS applications for spasticity control, the stimulation amplitude is then set to approximately 90% of the lowest PRM reflex threshold [18,23,25]. This time-consuming procedure likely imposes an impediment to the wider use of tSCS in real-world clinical practice. Furthermore, stimulation devices normally used in neurorehabilitation do not allow for the application of single and double stimuli, let alone for the synchronous recording of EMG activity from several muscles.
The aim of the present study was to cast this expert knowledge into an automated tSCS setup that identifies appropriate stimulation sites over the lumbosacral spinal cord and determines clinically suitable stimulation amplitudes for the application of tSCS in spasticity control [18,20,23,25]. To this end, we combined an electrode-array configuration, a self-operating stimulation protocol, synchronous recordings of EMG responses from several lower-limb muscles, and online evaluation algorithms. We tested our approach in neurologically intact individuals as well as in individuals with SCI and PD. The accuracies of the automated results were validated by two independent experts. To ease clinical decision making, we propose a graphical user interface that indicates optimal stimulation configurations with an intuitive color code. Our results may aid the dissemination of tSCS technologies into non-academic environments and broaden the use of tSCS for both diagnostic and therapeutic applications in the near future.

Stimulation and Recording Setup
Four separate hydrogel surface electrodes (each 5 × 5 cm; axion, Leonberg, Germany) were placed over the spine in a rostrocaudal arrangement [35], starting with the most caudal electrode that was positioned between the L3/L4 spinous processes (position 1) based on palpation ( Figure 1A(i)). The remaining three electrodes were then placed rostrally along the spine (positions 2-4), with an inter-electrode distance of 1 cm. Such setup ensured coverage of the targeted lumbosacral posterior roots by at least one of the electrodes. In individuals C5, S5, and P5, only three electrodes were used due to their comparatively smaller body heights. Two interconnected hydrogel electrodes (each 7 × 12 cm; axion, Leonberg, Germany) were placed on the lower abdomen symmetrically to the umbilicus [17,18]. Each of the paraspinal electrodes could be separately selected as stimulating electrode, with the abdominal electrodes acting as the common indifferent electrode. Stimulation was applied via a four-channel electrical stimulator (RehaMove3; HASOMED, Magdeburg, Germany) set to deliver charge-balanced, symmetric, and biphasic rectangular pulses of 2 ms width (1 ms per phase) [18]. With respect to the abdominal electrodes, the selected stimulating electrode served as anode for the first phase and the cathode for the second phase of the biphasic pulses.
EMG activity was acquired from the right and left L2-L4 innervated quadriceps muscle groups (RQ and LQ) as well as the L5-S2 innervated triceps surae muscle groups (RTS and LTS) [36] by using pairs of surface electrodes placed centrally over the muscle bellies with a distance of 1-2 cm ( Figure 1A(ii)). For each lower limb, a wireless two-channel EMG sensor was used to sample the EMG activity of Q and TS at 1 kHz (MuscleLab; Ergotest, Porsgrunn, Norway). Common reference electrodes for both EMG channels of a limb were placed bilaterally on the outer edge of the patella. The skin was cleaned prior to EMG electrode placement to minimize signal noise.
All hardware was controlled by a customized program, developed in Matlab/Simulink (MathWorks, Natick, MA, USA), by using a modified Linux ERT target [37] and a specially created stimulation interface (Python, Kivy). Post-processing analysis was performed in MATLAB (R2021a).  , with the most caudal electrode located between the L3 and L4 spinous processes. Two interconnected electrodes on the lower abdomen acted as common indifferent electrode. (ii) Surface electromyographic (EMG) recordings were acquired from right (R) and left (L) quadriceps (Q) and triceps surae (TS) muscle groups by using a two-channel sensor per lower limb. Information on the selected active electrode and the recorded EMG activity was transmitted to a laptop and displayed in a custom user interface. (B) The automated stimulation protocol systematically tested electrode positions 1-4 using three double stimuli per stimulation amplitude, starting with 5 mA. In each iteration of the protocol, the stimulation amplitude was increased by 5 mA up to a maximum of 75 mA or the individually maximally tolerated amplitude. (C) The custom user interface allowed for the visualization of averaged EMG waveforms of muscle responses elicited by the three double stimuli with a given amplitude, here exemplarily shown for RQ and RTS. Peak-to-peak amplitudes of the responses to the respective first and second stimuli were automatically computed (amp 1,RQ , amp 2,RQ , and amp 1,RTS and amp 2,RTS ). By applying the rules of the defined rating light system (Table 2), the responses were automatically classified as being a presumed M-wave or reflex response.

Automated Stimulation Protocol
Stimulation was applied with the participants lying in the supine position. Starting with the most caudal electrode (position 1), each of the four paraspinal electrodes was selected, one by one, as the stimulating electrode ( Figure 1B). From each position, three double stimuli with an inter-pulse-interval of 50 ms were administered with a stimulating amplitude initially set at 5 mA, with 5 s between repetitions. Subsequently, the stimulation amplitude was increased by 5 mA. The same procedure was repeated for stimulation amplitudes up to 75 mA or the individually maximum tolerated amplitude. For each double stimulus, raw EMG activity was recorded from the four muscle groups for time windows of 600 ms starting shortly before the first stimulus (see below).
The automated stimulation protocol could be monitored by the custom user interface, which provided information on the active electrode position at each time as well as a countdown to the application of the next double stimulus. The lower and upper limits of the stimulation amplitude could be manually adjusted to differ from the default values of 5 mA and 75 mA, respectively. The custom user interface additionally provided an online view of the raw EMG data derived from the four muscle groups studied as well as, optionally, the visualization of stimulus-triggered muscle responses and the averaged EMG waveforms derived from the three double stimuli at a given stimulation amplitude (cf. Figure 1C). In addition, a color-coded rating of the EMG responses can be displayed (cf. Section 2.3.3).

EMG Pre-Processing EMG Synchronization
The wirelessly transmitted EMG data, acquired with the two sensors placed on the left and right lower limbs, were first synchronized to the times of double stimulus application. Data from Q and TS of a single limb were acquired by the same sensor and, hence, required no further synchronization. For the synchronization of the EMG data to the double stimuli, stimulation artifacts detected in the raw EMG signals of RQ and LQ were utilized, and time windows from 30 ms before to 300 ms after the first stimulus were extracted. Specifically, the stimulation artifacts were detected by performing non-causal double differentiation of the EMG signals of RQ and LQ by using a discrete approximation of the Laplace's differential operator ∆: where emg i,raw (n, k, j,t)) is the raw EMG of the muscle i ∈ {LQ, RQ} with the corresponding sample indext for the position n ∈ {1, 2, 3, 4} of the active tSCS electrode and applied stimulation amplitude I = 5, 10, . . . ≤ 75 mA. The index j ∈ {1, 2, 3} describes the repetition number of the double stimuli. Samplest were marked as potential stimulation artifacts instancest * , caused by the first stimulus, if they fulfilled the following four conditions.
Here, the signal emg i,raw,mf was obtained by subtracting its median from the raw EMG signal in order to remove any present offset levels. Hence, condition (C4) checks for a sign change in the median-free raw EMG signal. The earliest candidatet * in the interval t ∈ [10,200] was chosen as new time instance (t = 0) of the first stimulus and is used to time-align the EMG recordings of the two sensors. Afterwards, the EMG signals were cropped to the new time range −30 to 300 ms for t.
If the synchronization failed, i.e., if no time instant could be found at which the conditions C1-C4 were fulfilled, then the corresponding measurement data were discarded, except for the data containing only baseline EMG (noise). Such baseline recordings can occur, e.g., in the case of low stimulation amplitudes (normally <20 mA) and for the most rostral electrode position 4, as stimulation artifacts are barely present. In this case, the first 331 EMG samples were extracted for displaying at the user interface and to capture the noise characteristics. The measurement was declared as baseline EMG when condition (C1) was not fulfilled for any single sample.

EMG Pre-Filtering
The median was removed from the cropped and synchronized raw EMG signals for offset correction, and detected stimulation artifacts were blanked (set to 0) for intervals of −2-2 ms and 48-52 ms. A second-order notch filter (Butterworth bandstop filter for the frequency range 43-47 Hz) as well as a first-order low-pass filter (Butterworth filter design with cutoff frequency of 300 Hz) were subsequently non-causally applied to the pre-processed EMG signals. The blanked intervals of the stimulation artifacts were restored in the filtered EMG signals to enable the synchronization and averaging of EMG responses to the three repetitions of double stimuli applied with a given stimulation amplitude and from a given stimulation electrode position.

Muscle-Specific Base Noise Level
For further analysis, the noise level emg i of each muscle i at rest was defined by the standard deviation of all EMG samples emg i (n, I, j, t) for all n, I, j, and 100 ≤ t ≤ 300.

Similarity Check and Averaging
For each muscle studied, the filtered EMG signals recorded during the three repetitions of double stimulus application from a given electrode position and with a given stimulation amplitude were checked for similarity by analyzing the root mean square error (RMSE) between the repetitions in the time interval 5-45 ms plus 55-95 ms. Signals were declared as similar if their RMSE was less than 16 times the muscle-specific base noise level emg i . The threshold parameter was determined empirically. Similar EMG signals were then cropped to a time range of −1 to 200 ms relative to the first of the double stimuli of each repetition and averaged to obtain the mean EMG signal emg i,avg (n, I, t), with n being the electrode position, I being the stimulation amplitude, and t being the sample index. Non-similar repetitions were discarded. If no similarity was found in at least two repetitions, the respective recording was marked as invalid. Such cases could occur, e.g., when stimulating during unintended movements, or when the initial artifact detection yielded incorrect results. The similarity check prevented such data from falsifying the results of the subsequent automatic evaluation.

Automatic Evaluation of EMG Responses
The averaged EMG signals emg i,avg (n, I, t), obtained for a given electrode position n and stimulation amplitude I, were further analyzed by separately calculating the EMG peak-to-peak amplitudes of the responses to the first and the second of the double stimuli, i.e., amp 1,i (n, I) and amp 2,i (n, I), within time intervals of 10-45 ms following the respective stimuli. The suppression level of the second to the first response was then calculated as follows: with i ∈ {LQ, LTS, RQ, RTS}. The level was limited to the range of [0,1]. A value of one would signify complete suppression, while a value of zero would indicate two responses of same size, i.e., the lack of post-stimulation depression and, hence, the presence of M-waves [29]. The averaged EMG signals of a given muscle were then classified into four cases (cf. Table 2): "no response" if amp 1,i (n, I) was ≤ 50 µV or did not differ from the baseline EMG by at least six standard deviations; "reflex response" if amp 1,i (n, I) was > 50 µV and differed from the baseline EMG by at least six standard deviations with a suppression level sup i (n, I) > 60%; "presumed M-wave" if previous conditions on amp 1,i (n, I) were valid but suppression level was ≤ 60%; and "invalid" if no similar EMG signals were obtained for stimulation from a given electrode position and with given stimulation amplitude. The assigned color codes in Table 2 enable a rating light system in which green indicates the desired reflex responses.

Color Code Description Condition
• gray No similar EMG signals obtained for stimulation from a given electrode position and with given stimulation amplitude

Automatic Delineation of Stimulation Position and Amplitude for tSCS Therapy
Two independent approaches were implemented to identify a suitable electrode position and stimulation amplitude for tSCS therapy, the ranking approach considering the color code classification of responses only, and the cost function approach additionally considering the obtained EMG peak-to-peak amplitudes and suppression levels.

Ranking Approach
Based on the color code classification, a ranking of pairs (n-electrode position and I-stimulation amplitude) was performed by utilizing a nested search in the following priority (order):

1.
At least two green labels present (i.e., reflex responses elicited in at least two of the four muscle groups studied; minimal requirement); 2.
Smallest current level difference between stimulation amplitude I and I , at which the first green label was obtained (amplitude threshold); 4.
Lowest stimulation amplitude I.
All electrodes fulfilling the minimal requirement were ranked, with rank "1" indicating best fulfillment of criteria 2-4 within the available search space. For tSCS therapy in spasticity, the best ranked electrode position n and a stimulation amplitude corresponding to 90% of the respective stimulation amplitude threshold I [23] were suggested as therapy parameters.

Cost Function Approach
In addition to the color code classification, the cost function approach considered the attainable peak-to-peak amplitudes of the EMG responses and the precise suppression levels by using the following cost function.
Here, the response amplitudes of each muscle were normalized with respect to their maximal amplitude amp 1,i found in the corresponding muscle and scaled with the observed suppression ratio.
The electrode position with the largest cost function value J was selected for tSCS therapy, favoring electrode positions yielding reflex responses of large peak-to-peak amplitudes. The stimulation amplitude for tSCS for spasticity control was the same as suggested by the ranking approach, i.e., 90% of the amplitude threshold of the selected electrode position.

Graphical Visualization
The color coded results of the automatic evaluation of the EMG responses emg i,avg (n, I) are presented as a rating light matrix ( Figure 2) for all muscles i, electrode positions n, and applied stimulation amplitudes I. After termination of the stimulation protocol, the electrode position and stimulation amplitude pairs with the highest rank (ranking approach) were marked, and the suggested stimulation amplitude for the tSCS intervention was provided. For a more detailed overview, the rating details matrix was additionally developed, including the color codes as well as details obtained with both the ranking and the cost function approaches (see Figure 3 for an example). The rating detail matrix provided information on the five best ranked electrode positions along with the respective cost function values.  Table 2). In favor of a compact overview, results are only displayed for the stimulation amplitude before the first detected response, in this case from 25 mA instead of from 5 mA, until the highest applied intensity.

Validation
In order to validate the proposed algorithms for automatic tSCS calibration, all preprocessed averaged EMG signals emg i,avg (n, I, t) of our data set were presented to two experts in the field of tSCS (U.S.H. and N.W.). For each participant, the experts annotated the electrode position and stimulation amplitude that they would choose for a sub-threshold tSCS therapy setup (e.g., for treating spasticity). The experts were blinded to the participant's condition. The annotations were then compared with the results of the automatic determination by the ranking approach and the cost function approach.  . Rating details matrix derived for a neurologically intact individual, C1. In addition to the color codes, reflex peakto-peak amplitudes are reflected by the size of the colored circles representing the four muscle groups studied. If no response had been elicited, the circle shrank to a dot. Blue numbers are ranks 1-5 as derived from the ranking approach, and red numbers are cost function values J calculated in the cost function approach, with higher values signifying favorable results.

Results
The stimulation and recording setups as well as the algorithms for the calibration of tSCS settings for therapeutic application were successfully and safely applied in all 15 study participants. No adverse events were encountered. Across participants, the complete execution of the stimulation protocol and the determination of stimulation parameters took on average ten min, ranging from 7 to 15 min.
Exemplary pre-processed averaged EMG signals emg i,avg (n, I, t) derived during the automatic execution of the stimulation protocol in one neurologically intact individual and used for expert validation are displayed in Figure 4. The corresponding rating light matrix using color codes for the classification of electrode positions and stimulation amplitudes along with the averaged representation of EMG signals obtained with the best ranked setting (n, I) is shown in Figure 2. In this case, electrode position n = 2 was selected since it was the only electrode position resulting in the elicitation of reflex responses in all four studied muscle groups. Furthermore, a stimulation amplitude of 35 mA was suggested for therapy (90% of I , amplitude threshold, here 40 mA). The rating details matrix ( Figure 3) exhibits that both the ranking approach as well as the cost function approach resulted in the suggestion of the same parameter settings for therapy despite differences in the rankings (stimulation with 45 mA in the case of the ranking approach vs. 55 mA in the case of the cost function approach; see also Table 3).
Across participants, validation revealed a high accuracy of the automatic ranking of stimulation site and amplitude relative to the experts' classification (Table 3). Specifically, the same electrode position was selected by both experts as well as both evaluation approaches in 11 out of 15 participants. In another two participants in whom no EMG responses were detected even at the maximum applied stimulation amplitudes (participants P3 and P4 with PD), no electrode position was suggested, neither by the experts nor the automatic approaches. In one of the remaining participants (S4), expert #1 selected an electrode that was one position more caudal than the one automatically detected as well as chosen by expert #2. In the other remaining participant (S1), the two experts selected different but neighboring electrode positions, n = 2 and n = 1, as did the two automatic approaches, also n = 2 and n = 1. This was the only case in which the ranking approach and the cost function approach did not select the same electrode position. C, neurologically intact control; I , stimulation amplitude threshold; n, number of electrode position (cf. Figure 1A); P, individual with Parkinson's disease; S, individual with SCI; -, no response elicited with stimulation amplitudes up to 75 mA; hence, no electrode and stimulation amplitude were suggested. The stimulation amplitude for tSCS therapy is then set to 90% of the identified thresholds I .  With respect to the stimulation amplitude suggested for therapy, congruent values between experts and algorithms were found in six out of the fifteen participants, with another two participants for whom no stimulation amplitudes were suggested (P3 and P4; see above). In participant S1, expert #1 chose the same stimulation amplitude as the cost function approach (25 mA, n = 2), and expert #2 agreed with the ranking approach (35 mA, n = 1). In four participants (C1, S5, P1, and P5), there was a difference of one increment (i.e., 5 mA) between the four suggested stimulation amplitudes for therapy, and in two participants (S2 and S3), there was a maximum difference of 10 mA. The rating light matrix and the rating details matrix derived for participant S2 are shown in Figure 5, and the corresponding EMG signals are provided in Figure A1 in the Appendix A. Exemplary EMG responses and rating matrices of a PD individual (P1) are shown in Figures A2 and A3. Notably, across participants, only 18 out of 601 evaluated EMG responses were classified as being invalid, corresponding to an error ratio of 3%.  Table 2). In the rating details matrix, the cycle size additionally provides information on the attainable response sizes. If no response had been elicited, the circle shrank to a dot. Blue numbers are ranks 1-5 as derived from the ranking approach, and red numbers are cost function values J calculated in the cost function approach, with higher values signifying favorable results.

Discussion
In this article, we presented a novel method that maps expert knowledge on the application of tSCS as a neurorehabilitative method into an automated evaluation algorithm. The developed combined stimulation and evaluation protocol allows for real-time classification of responses evoked by double-stimuli tSCS in several lower limb muscles bilaterally, identifying them either as direct motor responses (M-waves) or as PRM reflexes initiated within afferent fibers of the lumbosacral posterior roots [16,29]. This information is further processed into individual treatment recommendations for electrode position and stimulation amplitude for the application of tSCS in therapeutic settings, e.g., for the control of spinal spasticity [18,20,23,25]. Blinded validations by two independent experts confirmed the accuracy of the automatically derived recommendations. With respect to the electrode position specifically, congruent results were obtained by both evaluation approaches implemented as well as both experts in 13 out of 15 cases (87%).
Our novel approach with an array of four surface electrodes placed longitudinally over the spine to cover mid-lumbar to low-thoracic vertebral levels allowed us to simultaneously evaluate several stimulation sites, rather than having to relocate a single stimulating electrode as in traditional tSCS setups until the required PRM reflex distribution in the lower limb muscles is obtained [18]. This is of specific relevance when treating individuals with severely limited mobility and further helps minimize the time needed to find individually tailored stimulation settings. Other studies of tSCS for neurorehabilitation have used a pragmatic design, placing a single active electrode over vertebral levels T11/T12 in all participants [20,38]. However, previous studies of EES in lower-limb motor control have pointed at the distinctive importance of the specific placement of active electrodes over lumbar and upper sacral spinal cord segments [1,6,27,28]. Consequently, EES parameter settings are thoroughly tested and individually optimized prior to the full implantation of the system for chronic stimulation [14]. Our automated calibration of tSCS may, hence, present a first step towards facilitating individually tailored stimulation setups and maximizing the attainable therapeutic outcomes.
In the present study, the duration for the execution of the automated protocols was approximately 10 min on average. This duration could likely be further reduced by roughly two min by omitting the lower range of stimulation amplitudes (5 mA and 10 mA) at which no responses were evoked in any of our study participants. Furthermore, using a setup with three instead of four rostrocaudally arranged stimulation electrodes, as in participants C5, S5, and P5, would shorten the protocol by another estimated 2 min, resulting in an overall duration of 6 min for the entire procedure. Notably, the most rostral electrode position was not recommended for therapy for any of the individuals tested with four electrodes, neither by the automated calibration nor the two experts. The repeated use of our tSCS setup in an individual patient could additionally limit the search space, i.e., by using less electrodes and test even fewer stimulation amplitudes.
We implemented two evaluation approaches emphasizing different aspects of the detected EMG responses, i.e., the occurrence of PRM reflexes in the majority of studied muscles or the precise amplitude and suppression characteristics, respectively. Both approaches resulted in the same recommendations of electrode positions and the same detection of response thresholds across all but one participant. Both algorithms further provided information on tSCS configurations in addition to the best ranked results that could be alternatively employed should they be perceived as more comfortable by the individual treated. The patient's perception is a criterion that is not reflected by our automated evaluation approach, but plays a particular role in the tolerance of tSCS therapy, especially in individuals with intact sensory perception in the stimulation area (here, controls and PD patients). By providing the rating light and rating details matrix, we want to enable the user to select other highly ranked tSCS configurations based on individual preferences and criteria, for example, the patient's perception of continuous stimulation (50 Hz).
Although PD patients often had higher baseline muscle activity than controls and SCI patients, mostly due to dyskinesia as a side effect of dopaminergic medication (e.g., in patient P1), the algorithms were able to robustly detect PRM reflexes and gave reliable recommendations on stimulation parameters in three PD participants. The proposed methods take the baseline muscle activity into account in the used threshold parameters. However, in two individuals with PD, no responses were elicited by tSCS applied from either of the four electrode positions with stimulation amplitudes of up to 65 mA and 75 mA, respectively. A previous study has shown a significant increase in Hoffmann-reflex thresholds in individuals with PD compared to age-matched controls [39], and it can be assumed that similar changes would also affect the PRM reflex. Notably, the individuals with PD in the present study were collectively older than the neurologically intact controls and the individuals with SCI, and studies have shown a lower excitability of the Hoffmannreflex in elderly adults [40]. These observations suggest that screening tSCS responses, for example, before EES implantation, could add valuable information for the prospective characterization of patients in future clinical trials.
Our algorithms are currently designed to provide recommendations for the application of tSCS at amplitudes below the threshold for the elicitation of PRM reflexes in the lower limb muscles, as utilized in spasticity treatment [23] or for the augmentation of voluntary locomotor activity in incomplete SCI [19]. Future applications could be extended to the recommendation of parameter settings for locomotion therapy or standing and balance training using higher stimulation amplitudes [14,21,26,41,42]. Furthermore, our present approach was optimized for application of tSCS in the supine position. It is known that the body position influences which neural structures are recruited by lumbar tSCS [43]. An adaptation of our method for other body positions such as the upright position in locomotor training seems useful and well possible in the future. Another improvement in the future could be to allow individual adjustments in the selection criteria, which could facilitate more experienced users to set or fine-tune the rules for specific therapy goals (e.g., prioritizing behavior in specific muscles).
The proposed algorithms can be implemented in interpreted higher programming languages such as Python or MATLAB and applied to EMG data from other clinical recording systems. Artifact detection and signal alignment (synchronization) steps can be omitted if no wireless transmission is involved and the stimulator unit provides a trigger output for synchronization with the measurement system. Both features are usually available in present recording and stimulation systems at clinical research centers. In addition, we are currently developing a tablet-controlled setup with an iOS app that uses Bluetooth low energy to communicate wirelessly with EMG sensors and a stimulator for future broader use in rehabilitation centers and physiotherapy practices. This system will directly exploit the algorithms presented in this article.

Conclusions
In this study, we developed an automated calibration method for tSCS that accurately identified suitable electrode positions and stimulation amplitudes for therapeutic applications. The setup proved to be applicable by non-specialized health professionals, allowing them to individually calibrate tSCS by the use of a comprehensive graphical user interface. Our approach may, hence, provide an easy-to-use and time-effective solution for clinical decision making. These developments may aid the dissemination of tSCS technologies into non-academic environments and broaden the use of tSCS for diagnostic and therapeutic applications. Informed Consent Statement: Informed consent was obtained from all subjects involved in the study.

Data Availability Statement:
The data presented in this study are available upon reasonable request from the corresponding author.

Acknowledgments:
We like to express our appreciation to Christian Dikau for his support in the technical realization of the tSCS setup.

Conflicts of Interest:
TS is co-funder of the SensorStim Neurotechnology GmbH, which is a company developing sensor-based stimulation devices. The other authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript:    Figure A3. Comparison of ranking based on the two automatic response evaluation approaches applied. (A) Rating light matrix and (B) rating details matrix derived for participant P1 with PD. Both approaches resulted in the suggestion of electrode position 2 for therapy and identified 40 mA as the lowest response threshold (suggested stimulation amplitude for therapy: 0.9 × 40 mA = 36 mA). The four color-coded circles represent the results obtained for the four muscle groups studied (green, reflex response; cf. Table 2)). In the rating details matrix, the circle size additionally provided information on the attainable response amplitudes. If no response had been elicited, the circle shrank to a dot. Blue numbers are ranks as derived from the ranking approach; red numbers are cost function values J calculated in the cost function approach, with higher values signifying favorable results.