Using Wavelets for Gait and Arm Swing Analysis

The human walking pattern can be affected by different factors such as accidents, transplants, or diseases, like Parkinson’s disease, which affects motor and mental functions. In motor terms, this disease can generate alterations such as tremors, festi-nation, rigidity, unbalance, slowness, and freezing of gait. Additionally, it is esti-mated that for the year 2040, the number of people with Parkinson’s in the world will be between 12.9 and 14.2 million people. These alarming figures make Parkinson’s disease an important focus of attention. In this chapter, we present contributions that suggest wavelet techniques as a useful tool to perform a gait and arm swing analysis; this represents an important approximation that can contribute to describe and differentiate people with Parkinson’s disease in early stages of the disease.


Introduction
Aging is associated with numerous physiological problems that affect the brain. Some of these problems occur in the context of aging, such as cognitive deterioration and motor involvement, and often have an important impact on the central nervous system [1]. The causes of these deficits can be multifactorial and involve the central nervous system, the sensory receptors, the muscles, and the peripheral nerves [2]. On the other hand, there are comorbidities such as Parkinson's disease that can generate an even more marked deterioration of the motor skills of the affected elderly.
Parkinson's disease (PD) is a neurodegenerative disease that mainly affects people older than 60 years and is characterized by a neuronal loss in several areas and brain nuclei, but particularly in the substantia nigra, which can lead initially to motor alterations and delayed cognitive disorders that condition the patient to present physical dependence toward the caregiver and commitment to their autonomy [3].
Among the alterations mentioned are those associated with walking and arm swing. The march and its spatiotemporal characteristics have been analyzed since the Renaissance, and currently the analysis of this has become a very useful tool in the diagnostic evaluation and the severity of the disease, the response to treatment, as well as the impact of therapeutic interventions which can additionally predict the risk of falls [4]. Quantitative gait studies have usually focused on the characteristics of each participant and on the average of steps ignoring the step-by-step fluctuations between subjects. However, it has been shown for two decades that the magnitude of the step-by-step fluctuations and the changes over time during the march (gait dynamics) can be useful to understand the motor control of gait, in the quantification of the pathological and age-related alterations in the locomotion system and in an increase in objectivity in the measurement of mobility and functional status [5].
Motor alterations are one of the key points in the diagnosis of PD patients even in the early stages of the disease; however, the evaluation of the gait may be inconclusive because the slow and short steps are nonspecific and may be related to age, depressive disorders, and other conditions. On the other hand, we must remember that when patients meet the motor criteria for the diagnosis of PD, approximately 70% of the neurons of the substantia nigra have degenerated and the concentration of striatal dopamine has been reduced by 80% [6]; this shows that the typical motor manifestations of PE appear when there is already advanced neurodegeneration, and it has been determined that there is a "preclinical or prediagnostic phase" of PD [7].
Additionally, it is known that PD in early stages can start asymmetrically, since it can affect extremities of a hemibody predominantly and can even differentially affect the upper and lower limbs [8][9][10]. Thus, the asymmetry in the swing of the arms can be an opportunity for the earlier diagnosis of PE, even in the "prediagnosis stage" [10][11][12][13][14]. The function of swinging the arms during walking is to minimize the angular momentum of the body around the vertical axis [15]; however, there is still controversy as to whether it plays a role in gait stability. The coordination of the lower and upper limbs in the march is a complex phenomenon that has not yet been fully elucidated and involves circuits that we do not yet know. Previously it was thought that the movement of the arms was only passive (like a pendulum due to inertia) and did not imply muscle contraction [16]; however, Braune and Fischer when analyzing the march in a study postulated that this movement should present some muscle activity [17]. Much later, Ballesteros et al. were able to demonstrate with surface electromyography that there is an active muscle component involved which implies some control exerted by superior neural structures [18]. Another study showed that the amplitude of the swing of the arms is partly mediated by muscular activity, since, by reducing it, the amplitude of the swing of the arms decreases markedly by just depending on the passive component [15]. All of the above shows that the arm swing does depend in part on the CNS and can be measured, for example, in PD to observe alterations that correlate with the presence or absence of the disease.
Currently, the main reason for the disability in the world is adjudicated to neurological disorders; one of these is PD, which is the fastest growing, even faster than Alzheimer. In the last 25 years, the prevalence of PD is more than double, which generates double disability and deaths. The Global Burden of Disease study affirms that approximately 6.2 million people have PD. Currently, different subjective tools to assess and diagnose the PD are used in the clinical context; some of these tools are the DGI and UPDRS [19,20].
However, with the rise of recent technologies, it has become possible to develop tools that allow taking objective measures to complement the diagnosis of Parkinson's; these measures focus on quantifying symptoms of the disease such as tremor, the amount and speed of the steps, as well as the amount of movement in the arms and their speed. However, these tools are considered difficult to access, according to their technological requirements, since they usually require up to 10 specialized cameras, a minimum space of 10 m 2 , and must be handled by a clinical expert. Some of the assessment tools used in laboratory settings are motion-capture systems, such as GAITRite, Optitrack, Qualisys, and Vicon. These are used to obtain a quantitative and accurate gait representation, to help the analysis performed by the clinical expert in sport and physical rehabilitation and in gaming industries [20][21][22]. These systems are characterized by their high cost and complexity, since it requires Using Wavelets for Gait and Arm Swing Analysis DOI: http://dx.doi.org/10.5772/intechopen.84962 a minimum technical expertise, enough space to capture test, and a patient preparation and demands a long examination time.
With the technological advance, different motion capture systems of medium complexity have been introduced to the market, able to generate clinically useful variables in medical environments, with a low cost and setup times. Microsoft Kinect was tested for use in the clinical context, as the primary motion-capture device; additionally, it has demonstrated sufficient accuracy for PD assessment through gait analysis [23][24][25][26][27][28][29].
In addition to these devices, recent research has focused on efforts to build systems that support the clinical assessment from different perspectives; some of these are force platforms or pressure sensors, which are a set of sensors interconnected and located on the ground along a march corridor, and instrumented shoes, which include small force sensors placed on the template, which are used to detect the initial phases of the march, moments of festination, and freezing of the march.
Other alternatives to tools based on RGBD cameras are those based on wearable devices such as accelerometers or inertial units. With these devices, solutions have been implemented to evaluate movement in the upper extremities and generate metrics to quantify the alterations. Ref. [30] is presented with a system for monitoring and measuring the swing of arms for patients. With Parkinson's disease, this system is composed of a set of handles with accelerometers, which allow extracting variables from the signals that may be related to the alterations generated by the disease, such as the asymmetry in rolling.

Wavelet in biomedical applications
For decades, signal processing has been applied to multiple sectors such as industrial, military, health, and entertainment, among others. Regarding the health sector, these techniques have been used to facilitate access to technology and support or complement the diagnosis of a wide variety of diseases. As presented by Suk and Kojima, who use signal processing techniques to clean and extract information from speech signals to make speech recognition, with the purpose of generating a tool that allows disabled people to control by multiple voice home appliances and allow voice control of a wheelchair [31].
Conventional processing techniques and methods allow to filter signals in a frequency range, extract relevant characteristics such as maximum and minimum peaks, fill data by interpolation, and transform and decompose signals in other domains such as frequency and time. Among these processing techniques, wavelet has shown to have a broad application panorama; the literature documents wavelet uses in different and varied fields such as detection of anomalies associated with seismic events in ultralow-frequency geomagnetic signals [32]; it is also possible to use wavelet techniques for image compression, as detailed in [33], who decompose into singular values and use a discrete wavelet transform to improve the maximum ratio of signal-to-noise ratio compared to techniques such as JPEG2000.
In biomedical signals, wavelet transforms have also been suggested for signal compression [34], cardiac pattern recognition [35], EMG classification and decodification [34,36], feature detection and extraction for ECGs [35] and PPGs [37], and epilepsy diagnosis [38]. Finally, in this chapter, we detail two potential usage scenarios for wavelet techniques, such as gait analysis and arm swing analysis. These two approaches were designed and tested in Parkinson's disease patients, but we consider are not limited to this population, other potential use cases are gait and arm swing alterations in stroke patients, gait analysis in patients with knee replacement, and gait detection and recognition for surveillance.

Wavelet background
In this chapter, we apply wavelet decomposition using multiple wavelet mothers, like Daubechies. The discrete wavelet transform (DWT) uses a set of basic functions to perform a decomposition over a x (n) signal in two resultant signals: detailed and approximated signals. The first one is the scaling function, called the basic dilation function. The second one is the main wavelet function. This decomposition is defined by the equation used in [39,40] and represented as follows: where (1) j is the scale that represents the dilation index and k represents the index in time. J is the decomposition level and * denotes complex conjugation. The wavelet and scaling functions are defined as In ϕ J,k (n) and ψ J,k (n) , j allows the scaling and the wavelet function the dilation or compression. k controls the translation in time. The functions ϕ J,k (n) and ψ J,k (n) have the essential properties of low-pass and band-pass Fourier transform, respectively.
The approximation obtained with a 2 0 (n) at scale j = 0 is equivalent to the original signal x (n) . The signal a 2 j (n) at lower resolutions represents smoothed a 2 j−1 (k) . The detailed signals d 2 j (n) are given by the difference between approximate signals a 2 j (n) and a 2 j−1 (k) . The approximate signals a 2 j (n) and the detailed signals d 2 j (n) are replaced by the following equations: where h and g represent the coefficients of the discrete low-pass and high-pass filters associated with the scaling function and the wavelet function, respectively. Given that each level of wavelet decomposition generates coefficients of length less than the original signal, it is important to clarify that for the use of the approximation and detail coefficients, it was necessary to perform an interpolation process to adjust the size of the coefficients according to the size of the original signal.

Capture device
Based on criteria provided by clinical experts, the space selected to record the gait signals with the Microsoft Kinect was a corridor of 1.5 m wide by 4 m long. Each volunteer did walk in the selected space three times. Kinect's represent the joints in a basic human shape with 20 points, three of these points were used (the ankle, the wrist, and the spine base) because they are in the same positions as in the standard anthropometric model used in the benchmark data [24,26].
To obtain the distance between the Kinect and the subject, we use our eMotion Capture software, which provides the distances to each joint in meters. In the preliminary review [26], we obtain results that suggest the ankle trajectory accurate for gait tracking. The clinical space settings are shown in Figure 1. The acceptable capture area was restricted to a distance of 1.5-3.5 m from the camera, which was able to record at least one full gait cycle during each walking test.  This software allows us to obtain a representation of the distance between the person and the Kinect, for each articulation of interest, at each instant of time. Figure 2 shows a representation of the movement of the base of the spine, ankle left and right, and wrist left and right, respectively.

Gait analysis with wavelet
In this section, we present the results obtained to apply wavelet in gait signals, obtained with the eMotion Capture system. In this analysis, only the ankle data (left and right) were considered. To generate spatiotemporal variables, we select the best wavelet performance, which was obtained by a comparison between multiple wavelet decomposition and the clinical expert judgment [41].

Methodology and data
For this study 12 volunteers were selected, 6 women and men, with an age range of 53-73. In each gender group, there were three subjects with early stage PD and three healthy with normal walking patterns. Early stage was defined as stage I or II on the Hoehn and Yahr scale. All participants were evaluated under a dopaminergic agonist, i.e., "on" state. All PD subjects were of completely independent mobility and did not require a walking aid.

Signal processing with wavelet
The wavelet families tested were Biorthogonal, Coiflets, Daubechies, and Symlets; a total of 12 wavelet decompositions were tested for each gait signal. This was realized with the aim to obtain the best wavelet performance and to observe different spectral-and time-domain information.
To evaluate the wavelet performance, we assess each transformation with the clinical expert criteria. Matlab was used as programming and processing tool; in this software wavelet is defined using an identifier (id) and decomposition value. For example, in "db8" the "db" indicates Daubechies family, and the 8 refers to the vanishing moments. For the present study, we test four wavelet families (Daubechies, Coiflet, Symlet, and Biorthogonal), each wavelet transform with different vanishing moments (db3, db4, db5, db6, db7, db8, coif1, coif2, sym2, sym3, bior2.2, and bior 2.4).
The wavelet transformation was applied with one level of decomposition to each individual ankle signal (left and right). We assess the algorithm applying 12 wavelet decomposition, to 12 subjects, to every ankle, walking in the corridor 3 times. Finally, the system was tested with a total of 864 ankle signals.
Each j level of decomposition is obtained by generating j approximation and detail coefficients, which can be associated to a noise-free version of the original signal and to a version of the noise extracted, respectively. Figure 3 shows one-level decomposition of a gait signal using wavelet; this process generates two signal, an approximated signal to the original and other with the details extracted.

Gait phases detection
To distinguish the gait phases, we calculated the mean values of each of the 12 wavelet decompositions we applied to the gait signals, using this as a threshold to distinguish the phases. This threshold was defined as the average value of each wavelet decomposition. To extract the support and swing phases from the ankle signals using this threshold, we defined all values above it as the swing phase and all values below it as the support phase. These allow us to obtain a binary signal with true or 1 when on swing phase and false or 0 when on support phase. Figure 4 shows one gait signal, the threshold applied to the detail coefficients, and the binary signal generated for this one gait signal.

Gait phase error detection and correction
From step described in section 5.3 (Figure 3), we obtain binary signals, some of these with small intermediate phases. According to gait signals obtained, we set as a criterion that each gait phase should have at least 10 binary elements; some small gait phases do not meet this minimum number of elements and were considered errors. These small intermediate phases are generated due to wavelet sensitivity to detect small changes in signals.
To correct these errors, we designed an algorithm to detect the start and end of each phase and correct for abnormal phases; this algorithm was designed based on the criterion for the minimum number of values that could represent a real gait phase.

Results
We use Hamming distance [42] as the metric to select the best wavelet transform. This metric was used to compare all the binary gait signals to the ideal reference values. With this we could obtain a quantitative value of the wavelet decomposition accuracies.

One-level wavelet decomposition using db8, (a) approximation coefficients, and (b) details coefficients.
The error before and after correction is given in Table 1. Before correction the minimum value was 13%, obtained for the db3, db4, db5, bior2.2, and sym3 wavelet members. After correction, the average error was reached for the same wavelet members and by db7 and db8, with 7%. This represents that our algorithm to detect gait phases (stance and swing) has 93% of accuracy, compared with the clinical expert.
After the wavelet comparison, we choose the wavelet "db8" as the member to determine spatiotemporal variables for each subject. Initially, was selected arbitrarily, but later, the "db8" wavelet selection was validated by the statistical comparison. The variables obtained are clinically important and provide objective measures that can be used in the evaluation context to measure and diagnose the PD progression.
The variables presented in Table 2 are the results obtained for healthy volunteers and PD volunteers. These results suggest significant differences between both groups and represent an objective metric for disease progression quantification. The variables obtained reflect that patients were slower than controls; this is related to the PD gait alterations.
Finally, since PD is an asymmetric disease, we perform a Mann-Whitney test to identify differences statistically significant in the left and right variables for case and control subjects. As shown in Table 3, all variables considered provide a mechanism to  Table 3.

p-Values obtained from Mann-Whitney tests
differentiate PD and non-PD people. The parameters that can be considered as the most appropriate to discriminate patients are stance time, duration time, and test speed.

Arm swing analysis with wavelet
In gait analysis with wavelet was important to detect the gait phases; in this case, we were interested in obtaining a measure that allows quantifying the minimum and the maximum displacement of each wrist. For this reason, to generate spatiotemporal variables, we use multiple denoising methods that allow us to obtain a signal without big fluctuations; according to this, we use methods like Savitzky-Golay filter and wavelet decomposition [43]. In this chapter, we present the results obtained of applied wavelet decomposition using db8 to wrist signals.

Methodology and data
For this study, 25 patients (aged 45-87 years) and 25 controls (aged 46-88 years) were selected, and like in the gait analysis, PD patients were in an early stage of the disease. All participants with PD were under a dopaminergic agonist and were evaluated while in the "on" state. The absence of dementia and any other related to neurological conditions that affect gait was confirmed by an expert neurologist. All PD subjects were completely independent mobility and did not require a walking aid.

Noise reduction using wavelet
Since the original signals had fluctuations that could affect the analysis and processing, it was necessary to apply wavelet techniques to remove alterations and clean the signal. As showed in Figure 5, we apply three-level wavelet decomposition using Daubechies wavelet with eight vanishing moments. From this step, the approximation coefficients at level 3 were used as clean signal.
As a result of the wavelet decomposition, we obtain a clean signal to determine the relative displacement of the wrist, which allows to observe conditions such as rigidity and asymmetry in upper limbs. For the next step, we use the a 3 signal.

Swing variables
The arm swing variables calculated using the signal provided by eMotion were arm swing magnitude, arm swing time, arm swing speed, and arm swing asymmetry; these variables are defined as follows: • Arm swing magnitude: the average distance traveled by the wrist in the anterior/ posterior plane, normalized accord the hip center joint [10] • Arm swing time: duration that took the displacement of a wrist, during a swing cycle, in the anterior/posterior plane • Arm swing speed: the ratio between the arm swing magnitude and the arm swing time  Table 4 shows a comparison of arm swing variables obtained for each limb with the eMotion. This shows that arm swing magnitude (left p = 0.002, right p = 0.006) and arm swing speed (left p = 0.002, right p = 0.004) were significantly reduced in the PD group for both limbs. The control group shows a lowest arm swing asymmetry than the patient group (p < 0.001). Based on the side, the variables that show significant differences for the left side were arm swing magnitude, speed, and ASA and for the right side were arm swing magnitude, speed, and ASA. Also, the most affected side determined with Kinect and the one with the highest score of the pondered items of the MDS-UPDRS-III were compared. These comparisons suggest that our device is to recognize the most affected side in the 80% of cases. Due to the limited sample size, differences in the symmetrical group were not evaluated.  Table 4. Arm swing differences between PD patients and the healthy subject group.

Limitations
The use of Kinect ® in this clinical context has reported relative and overall reliability regarding spatiotemporal parameters [45][46][47]. Further advances in software and hardware are essential to further enhance Kinect's ® sensitivity for kinematic measurements [48,49]. Nevertheless, since the RGBD cameras, like Kinect, are low-cost and portable devices, this represents an opportunity in the field of telemedicine, allowing easy access to gait assessment in the clinical space and allowing remote diagnose in rural areas, where there are no clinical experts. Finally, it is remarkable how the eMotion Capture system can calculate and automatically obtain the gait cycle variables that are considered relevant for decision-making processes in the clinical context of patients with Parkinson's disease.
Some authors propose that arm swing analysis could help in the differentiation between TD and PIG subtypes, but the small sample in this study limited the subgroup analysis. Because Kinect was discontinued from the market, in future research jobs, alternative RGBD cameras, such as the Intel RealSense D435, needs to be investigated.

Conclusion
From the previous sections, the use of wavelet techniques for gait analysis and arm swing was detailed. Finally, we can conclude that it is possible to use wavelet techniques to automate and quantify spatiotemporal variables related to the gait, to perform an objective analysis of Parkinson's disease. In addition to this, the eMotion system has demonstrated to be a useful tool that can be used in a clinical context to generate spatiotemporal variables like arm swing asymmetry, arm swing speed, swing magnitude, stance time, swing time, step number, duration test, and speed, which are useful for differentiating PD patients from healthy individuals.
© 2019 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.