Development and Validation of Open-Source Activity Intensity Count and Activity Intensity Classification Algorithms from Raw Acceleration Signals of Wearable Sensors

Background: A popular outcome in rehabilitation studies is the activity intensity count, which is typically measured from commercially available accelerometers. However, the algorithms are not openly available, which impairs long-term follow-ups and restricts the potential to adapt the algorithms for pathological populations. The objectives of this research are to design and validate open-source algorithms for activity intensity quantification and classification. Methods: Two versions of a quantification algorithm are proposed (fixed [FB] and modifiable bandwidth [MB]) along with two versions of a classification algorithm (discrete [DM] vs. continuous methods [CM]). The results of these algorithms were compared to those of a commercial activity intensity count solution (ActiLife) with datasets from four activities (n = 24 participants). Results: The FB and MB algorithms gave similar results as ActiLife (r > 0.96). The DM algorithm is similar to a ActiLife (r ≥ 0.99). The CM algorithm differs (r ≥ 0.89) but is more precise. Conclusion: The combination of the FB algorithm with the DM results is a solution close to that of ActiLife. However, the MB version remains valid while being more adaptable, and the CM is more precise. This paper proposes an open-source alternative for rehabilitation that is compatible with several wearable devices and not dependent on manufacturer commercial decisions.


Introduction
The popularity of wearable devices to monitor physical activity (PA) has increased widely during the last decades. Plenty of wearable devices, from step counters to sleep monitors, are now available to provide a broad spectrum of physiological measurements and feedbacks (e.g., step count [1], level of activity [2], upper limb activity count [3], distance traveled [4], heart rate history [5]). These devices have been widely adopted for everyday monitoring of PA, such as personal training (by providing to the user a real-time feedback of their performance [6]), but are yet to be implemented in clinical physical therapy. From a clinical perspective, healthcare services could benefit from wearable monitoring devices. Indeed,

Materials and Methods
In this section, the proposed activity quantification algorithms (fixed and modifiable bandwidths) and the activity intensity classification scale are presented, along with the protocol used to validate them against commercial solutions.

Activity Quantification Algorithm
Two algorithms are proposed: a fixed bandwidth algorithm and a modifiable bandwidth algorithm (which offers more flexibility).
Both algorithms have the same basic structure, which is first detailed here (see eight steps below) and summarized in Figure 1.
(2) Each of the three signals is filtered with a passband filter (specific to each algorithm and described below).
(4) A deadband (minimum threshold) of 0.6664 m/s 2 (i.e., 0.068 g) [10] is applied to each signal. (5) A scaling is then applied to convert the acceleration signal into a metric referred to as activity counts. The scaling is 1 count = 0.001664 g = 0.0163072 m/s 2 [22]. This scaling could be omitted but is applied to match with the "count" definition from ActiGraph which was defined as such for historical reasons [23]. (6) The counts are then multiplied by a factor (0.93 for the fixed bandwidth filter and 0.96 for the modifiable bandwidth filter), as in BrØnd & al. [10], to better match the commercial activity counts results. These values (0.93 and 0.96) were optimized with the least squares method to best match ActiLife results.
Sensors 2020, 20, 6767 4 of 28 (7) Each of the three resulting signals from steps 1 to 5 are converted into 1-s epochs. This consists of the sum of the counts acquired over 1 s divided by the sampling frequency to obtain the mean activity count/sec, defined as s x i , s y i and s z i , where i is the epoch number. (8) For each epoch, the total tri-axial vector magnitude (VM3) count is obtained with a Euclidian norm: Sensors 2020, 20, x FOR PEER REVIEW 4 of 38 1) The 3D linear acceleration signals (ax, ay and az) are first sampled at a fixed frequency (e.g., 30 Hz or 100 Hz).
2) Each of the three signals is filtered with a passband filter (specific to each algorithm and described below).
3) A saturation (maximum threshold) limit of 20.874 m/s 2 (2.13 g with g = 9.81 m/s 2 ) [10] is applied to each signal. 4) A deadband (minimum threshold) of 0.6664 m/s 2 (i.e., 0.068 g) [10] is applied to each signal. 5) A scaling is then applied to convert the acceleration signal into a metric referred to as activity counts. The scaling is 1 count = 0.001664 g = 0.0163072 m/s 2 [22]. This scaling could be omitted but is applied to match with the "count" definition from ActiGraph which was defined as such for historical reasons [23].
6) The counts are then multiplied by a factor (0.93 for the fixed bandwidth filter and 0.96 for the modifiable bandwidth filter), as in BrØnd & al. [10], to better match the commercial activity counts results. These values (0.93 and 0.96) were optimized with the least squares method to best match ActiLife results. 7) Each of the three resulting signals from steps 1 to 5 are converted into 1-s epochs. This consists of the sum of the counts acquired over 1 s divided by the sampling frequency to obtain the mean activity count/sec, defined as , and , where is the epoch number. 8) For each epoch, the total tri-axial vector magnitude (VM3) count is obtained with a Euclidian norm:

Fixed Bandwidth Algorithm
The fixed bandwidth algorithm exactly follows the general sequence presented in the previous section. The focus in this subsection is on the bandpass filter applied at step 2 of the algorithm. In BØnd & al. [10], the commercial bandpass filter characteristics were identified by generating discrete sinewave signals and successively sending them to the software. A discrete bandpass transfer function (at 30 Hz) of order 20 was optimized to represent the commercial activity counts filter. However, being defined only at 30 Hz precludes the algorithm use at other sampling frequencies, which is vital for other applications (e.g., running, requiring sampling rates of 100 Hz to 500 Hz). Furthermore, it was found that the high order of the filter also prevented the conversion of the discrete transfer function to other sampling frequencies due to numerical instability. In the framework of this paper, a continuous 8th-order bandpass transfer function has thus been used to mimic the commercial activity count bandpass frequency response. Using MATLAB, a genetic optimization algorithm was used, starting from random continuous filter parameters, and discretized to a 30 Hz discrete bandpass filter at each optimization step to match the filter from BØnd & al. [10]. As the optimization result is the continuous filter parameter, it is then possible to discretize the filter to any sampling frequency (e.g., 100 Hz). Figure 2A compares the proposed filter to that of BØnd & al. [10]. mimic the commercial activity count bandpass frequency response. Using MATLAB, a genetic optimization algorithm was used, starting from random continuous filter parameters, and discretized to a 30 Hz discrete bandpass filter at each optimization step to match the filter from BØnd & al. [10]. As the optimization result is the continuous filter parameter, it is then possible to discretize the filter to any sampling frequency (e.g., 100 Hz). Figure 2A compares the proposed filter to that of BØnd & al. [10].

Modifiable Bandwidth Algorithm
This section proposes a modifiable bandpass filter version of the fixed bandwidth algorithm. The advantage of the fixed bandwidth algorithm presented in the previous section is that the resulting activity intensity counts are closer to commercial activity count solutions than to the modifiable bandwidth algorithm. This might be an advantage because commercial activity count solutions have been validated in the literature, and the results can be compared to those of previous studies that used commercial solutions. Indeed, the commercial solutions' passband filters were designed for healthy subjects and might not be optimal for other clinical populations. However, because the fixed passband 8th-order filter was obtained through an optimization process to best represent the commercial solution, changing its bandwidth is not an obvious procedure. A simpler 4th-order passband Butterworth filter is thus proposed. It was designed using MATLAB with the "butter" function and then discretized to the required sampling frequency (e.g., 30 Hz or 100 Hz). The default filter parameters (i.e., high and low cutoff frequencies) were obtained to be as close as possible to the BrØnd & al. [10] filter using a least square optimization approach and are 0.305 Hz and 1.615 Hz, respectively. Figure 2B presents the proposed modifiable filter compared to BrØnd & al. [10]. With this filter, the bandwidth can now be easily modified (by changing the high and low cutoff frequencies) to adapt to the needs of different activities/clinical populations. One should note that other algorithm parameters (deadband and threshold) can be adapted as well, as for the fixed bandwidth algorithm. However, in exchange for such modularity, the modifiable bandwidth leads to larger deviations from commercial activity counts as more approximations are required.

Activity Intensity Classification
Based on the activity intensity counts, two activity intensity classification algorithms are proposed. The goal of these algorithms is to determine the proportion of time spent in different categories of activity intensity during an activity such as "light, moderate, vigorous, very vigorous". The number of categories and the threshold for each class (referred to as cutpoints) can vary depending on the activity. Therefore, in order to compare the proposed algorithm to commercial activity intensity count solutions, the Freedson Adult VM3 scale [24] was used. It is divided into four activity intensities (light, moderate, vigorous and very vigorous) corresponding to the different ranges of activity counts per minute that are shown in Table 1. The number of categories and cutpoint levels can easily be changed to any other value as needed. Two versions of the activity intensity classification algorithms are proposed: one referred to as the discrete classification method and the other one as the continuous classification method.

Discrete Classification Method
The discrete classification method consists of summing counts (which, based on the quantification algorithm are in 1-s epochs) into 1-min-epochs. A 3-min test therefore has three epochs: the sum of the activity level counts from 0 to 60 s, from 60 to 120 s and from 120 to 180 s. Then, each epoch is associated with an activity intensity category based on the threshold values presented in Table 1 (e.g., light). Finally, the algorithm outputs the number of 1-min epochs for each category along with the representation percentage in each activity intensity class. This discrete classification method is the one used in commercial solutions such as ActiLife.

Continuous Classification Method
One potential problem with the discrete classification method is that the results may greatly vary depending on how the activity levels fall within the 1-min epochs. Figure 3 presents a fictive example demonstrating this limitation. Figure 3A shows an activity level curve that lasts three minutes. Figure 3B displays the resulting 1-min epoch categories, assuming that the activity started at the same time as data acquisition. Figure 3C shows the resulting 1-min epoch categories assuming that the activity started 30 s after the onset of data acquisition. As seen when comparing Figure 3B,C, the end result is quite different (the percentage in each class is different).
In order to alleviate this drawback, a new continuous classification algorithm is proposed, based on a sliding window approach. Rather than using back-to-back one minute-epochs, continuous one minute-epochs are used: at each second, a one minute-epoch is created by taking the 30 preceding and 30 following seconds. This means that for a 3-min test, 180 overlapping one minute-epochs are used and categorized. The aim of this algorithm is to be more precise in the cutpoint evaluation by alleviating the drawback of the discrete classification method where the one minute-epoch level results depend on when the movement starts with respect to data acquisition onset. Finally, the algorithm outputs the number of epochs for each category together with the representation percentage in each activity intensity class. level curve that lasts three minutes. Figure 3B displays the resulting 1-min epoch categories, assuming that the activity started at the same time as data acquisition. Figure 3C shows the resulting 1-min epoch categories assuming that the activity started 30 s after the onset of data acquisition. As seen when comparing Figure 3B,C, the end result is quite different (the percentage in each class is different). In order to alleviate this drawback, a new continuous classification algorithm is proposed, based on a sliding window approach. Rather than using back-to-back one minute-epochs, continuous one

Experimental Procedure
Data were gathered from four different projects involving accelerometry measures. These projects were: (1) Activity of daily living (24-h data collection); (2) Bilateral manipulation in daily living tasks; (3) Manual wheelchair propulsion; and (4) Real-world working environment-Nordic expedition project on the Amundsen Research Ice breaker. In this section, the participants involved in each experiment and the experimental setup of each project are described.

Participants and Experimental Setup
• Activities of daily living-24-h data collection (project 1): Four participants (25 ± 0.82 years old, two men, four right-handed) wore two watches (one on each wrist, sampling rate = 100 Hz, ±8G, ActiGraph GT9X-BT, ActiGraph, LLC) for 24 h. Activities included but were not limited to running, walking, driving a car, dressing or working at a computer  Table 1 for more details). Participants were instructed to fill in a custom-designed activity logbook reporting the activities they performed each hour, and to remove the device only for activities requiring water immersion (e.g., swimming, taking a shower). See Appendix A Table A1 for a synthesis of the activities reported. Recruitment criteria were (1) being aged 18 years or older, and (2) having no musculoskeletal, neurological disorders or pain. Every participant gave written informed consent prior to participation and the project was approved by the local ethics committee (CIUSSS-CN; project #2018-609).

•
Bilateral manipulation in daily living tasks (project 2): Ten participants (27.9 ± 7 years old, three men, nine right-handed) wore two watches (on each wrist [dominant and non-dominant hand], sampling rate = 100 Hz, ±8G, Actigraph GT9X-BT, ActiGraph, LLC) during eight specific activities of daily living. Activities: (1) washing a table, (2) making coffee, (3) setting the table, (4) serving a glass of water, (5) cutting therapeutic putty, (6) folding towels, (7) putting toothpaste on a toothbrush, (8) walking, performed in a standardized kitchen of a rehabilitation center. Tasks were selected to require the use of both upper limbs. Each task took between 1.5 and 2 min, for a total of approximately 15 min. Recruitment criteria were (1) being 18 years or older, (2) having no musculoskeletal, neurological disorder or pain that could interfere with the task. Participants were recruited using the research center and Laval University's mailing lists. Each participant gave written informed consent prior to participation. The project was approved by the local ethics committee (CIUSSS-CN; project #2018-609).

•
Manual wheelchair propulsion (project 3): Seven manual wheelchair users (45.8 ± 17.2 years old, six women and one man wore a watch (sampling rate = 30 Hz, ±8G, Actigraph, GT3X-BT, ActiGraph, LLC) on their dominant wrist during two days at two different data collection times: before (T1) and after (T2) following a wheelchair training program. Participants had different diagnoses (multiple sclerosis [n = 1], spina bifida [n = 2], spinal cord injury [n = 1], cerebral palsy [n = 1], Friedreich ataxia [n = 1] and post-poliomyelitis syndrome [n = 1]) and they used their manual wheelchair for more than 5 h per day. All participants gave their informed written consent prior to participation and the project was approved by the local ethics committee (CIUSSS-CN; project #2016-493). Subject 2-T2 was excluded due to technical problems with data collection.

•
Real-world working environment-Nordic expedition project on the Amundsen (project 4): Two healthy workers (37 and 40 years old, two women, both right-handed) were recruited from a Nordic expedition project aboard an icebreaker (NGCC Amundsen, Canadian Coast Guard) (total data collection of six weeks). They were instructed to wear two watches (24/7) (sampling rate = 30 Hz, ±8G, Actigraph GT3X-BT, ActiGraph, LLC), one on the middle of the thigh and one fixed in a customized pair of shorts at thigh and L1-L5 levels (trunk and leg). They also filled a task logbook at the end of each workday. Recruitment criteria were (1) being 18 years or older, (2) being assigned to a >=6-week work shift on the icebreaker, (3) having no musculoskeletal, neurological disorders or pain that would limit their work capacity. Each participant gave written informed consent prior to the experiment and the project was approved by the local ethics committee (CIUSSS-CN; project #2017-539).

Activity Quantification Algorithm
Descriptive analyses (sum, mean and standard deviation [SD]) were used to describe the recording sessions (e.g., time and activity count) and participants (e.g., age). Pearson correlation coefficients were calculated between the data processed by ActiLife 6 (ActiGraph, LLC) and by both (fixed and modifiable) bandwidth algorithms. A Bland-Altman plot for each subject, time of measure (when applicable) and algorithm was used to investigate the validity under free living (outcomes: mean difference, number of data outside of 1.96SD, upper and lower limits of agreement). The level of significance for all analyses was set at p < 0.05. A linear regression was used to evaluate any association between error size of the difference between the proposed algorithm compared to the commercial solution and intensity of activity.

Activity Intensity Classification
Descriptive analyses (mean and SD) were used to describe the proportion of time spent at each activity level. Agreement between the classification of the five intensity categories was assessed using a correlation coefficient analysis (considering as very low [0.0 to 0.3], low [0.3 to 0.5], moderate [between 0.5 and 0.7], high [between 0.7 and 0.9] or very high correlation [>0.9] [25]). All statistical analyses and data processing were performed with a customized MATLAB program (R2018b, 64bit). A Spearman correlation coefficient was calculated for both algorithms comparing the commercially available one to the discrete and the continuous methods separately (significance level = p < 0.05). A NparLD analysis was performed to compare the commercial algorithm to the discrete and continuous methods (2 factors; algorithm tested and level of physical activity). NparLD is a robust method that does not require a normal distribution and homoscedasticity while allowing us to assess datasets with repeated measures [26]. Post-hoc analyzes compared commercial to discrete methods and commercial to continuous methods for each level of PA. Statistical significance was set at p < 0.05 for the main and interaction effects and at p < 0.00625 for the post-hoc analyses (Bonferroni correction). Table 2 presents the outcomes of the fixed bandwidth algorithm for each project. For each dataset, the total activity count was averaged to counts per minutes and ranged from 90.2 to 7912.1 counts with a grand average of 54.7 ± 67.4 counts. The relative differences between the commercial activity and fixed bandwidth counts were ≤2.1% for all projects (smallest for project 3 with a mean of 0.3%). The average Pearson correlation coefficient was 0.99 ± 0.001 (all p < 0.001). Figure 4 shows a representative subject for each project at an epoch time of 1 s comparing activity counts for both algorithms showing a high level of similarity between the commercial solutions and the fixed bandwidth algorithms.

Activity Quantification Algorithm-Fixed bandwidth algorithm
The Bland-Altman analysis of the proposed fixed algorithm is presented in Figure 5, per project, for epochs of 1, 10, and 60 s for a representative subject. The absolute number of data points out of the limits of agreement ranged from 21 to 19,170 for epochs of 1 s, from 1 to 5037 for epochs of 10 s and from 0 to 1357 for epochs of 60 s. This represents a relative error of 3.1% ± 0.9% for project 1, 4.4% ± 2.3% for project 2, 1.3% ± 0.8% for project 3 and 2.5% ± 1.3% for project 4, showing smaller error ranges for longer recording times (project 3 and 4) while still presenting high concurrent validity for shorter ones. The relative mean errors were 2.3% ± 1.6% for 1 s, 3.2% ± 1.8% for 30 s and 3.8% ± 3% for 60 s. The mean differences, limits of agreement (±1.96SD) and regression coefficients are presented in Appendix A Tables 2 and A2. The regression coefficients ranged from 0.47 to 0.88, representing a moderate to high relationship between PA and absolute error (highest coefficients for 60 s epochs and longer recording times [project 3 and 4, mobility projects in manual wheelchair users and working context]). Table 2. Synthesis of data collection characteristics and comparison parameters between the fixed bandwidth algorithm and the commercial solution. "Min." stands for minute; "dom" stands for dominant; "non-dom" stands for "non-dominant".      Table 3 presents the outcomes of the modifiable bandwidth algorithm for each project. For each dataset, the total activity count was averaged to counts per minutes and ranged from 88.2 to 8271.7. The absolute difference between this algorithm output and the commercial solution ranged from −5.7 (project 3-subject 7) to 358.5 (project 2-subject 8), with a grand average of 71.7 ± 94.5 counts. The average relative differences between the commercial activity counts and fixed bandwidth counts were ≤4.1% for all projects (smallest for project 3 with a mean of 1.7%). Figure 4 shows a representative subject for each project with an epoch time of 1 s, showing a high level of similarity between the commercial solutions and the proposed algorithm.

Activity Quantification Algorithm-Modifiable Bandwidth Algorithm
The Bland-Altman analysis of the proposed modifiable algorithm is presented in Figure 6, per project, for epochs of 1, 10 and 60 s for a representative subject. The absolute number of data points out of the limits of agreement ranged from 22 to 25,718 for epochs of 1 s, from 3 to 5241 for epochs of 10 s and from 0 to 1333 for epochs of 60 s. This represents a relative error of 3.3% ± 0.9% for project 1, 4.1% ± 2.3% for project 2, 1.3% ± 0.8% for project 3 and 1.5% ± 1.0% for project 4, showing smaller error ranges for longer recording times (project 3 and 4), while still presenting high concurrent validity for shorter ones. The relative mean errors were 2.5% ± 1.6% for 1 s, 3.8% ± 2.4% for 30 s and 2.4% ± 2.1% for 60 s. The mean differences, limits of agreement (±1.96SD) and regression coefficients are presented in Appendix A Tables 3 and A2. The regression coefficients ranged from 0.31 to 0.90, representing a moderate to high relationship between PA and absolute error (highest coefficients of 60 s epochs and longer recording times [project 3 and 4, mobility projects in manual wheelchair users and working context]).

Activity Intensity Classification
An overview of the activity intensity classification algorithm results is presented in Figure 7, Table 4 and in Appendix A Table A3 for the commercial device, the discrete and the continuous methods. The Spearman correlation coefficients were high (r > 0.89, p < 0.05) for both algorithms and was highest for the discrete method (r > 0.99) compared to the continuous method (r > 0.89). NparLD analysis showed two significant main effects for algorithm (p = 3.67 × 10 −15 ) and intensity (p = 1.09 × 10 −10 ), as well as an interaction effect for algorithm × intensity of PA (p = 1.32 × 10 −3 ). The relative effects (shown on Figure 7B) and post-hoc results show that the differences observed were principally for the continuous method at high levels of PA (Vigorous and Very vigorous). The continuous method differs slightly from the commercially available classification method but allows us to quantify the level of activity more precisely (quantification calculated sample-by-sample vs. second-by-second).

Discussion
This study presents two different versions of an open-source algorithm (https://github.com/ ingreadaptulaval/activitycounts) to compute activity counts (i.e., fixed and modifiable bandwidth algorithms) and two different versions of an activity classification algorithm (i.e., discrete and continuous) and compares them to a popular, commercially available, closed-source activity count algorithm (Actilife TM ). The fixed and modifiable bandwidth algorithms have been shown to be valid when compared to commercial algorithms (all r > 0.96, p < 0.0001) for quantifying activity during different tasks (e.g., activities of dailyliving, wheelchair propulsion), for a variety of recording durations (i.e., several minutes to several days), in nondisabled participants and manual wheelchair users. The fixed algorithm results are closer to those of the commercial solution than those of the modifiable algorithm (average relative difference of 1.4% and 2.5%, respectively). However, the modifiable algorithm still shows an excellent performance and presents the advantage of being adaptable to pathological populations (e.g., modifying the filter characteristics to minimize the effects of tremors or spasms). In addition, the number of data points out of the limits of agreement was higher for shorter recording durations (project 2: 5%) compared to longer ones (projects 1 and 4: 3.9%; project 3: 2%). This could be explained by the smaller amount of data for project 2, especially when an epoch of 60 s is selected, giving more weight to each error (i.e., one data point outside for 60 s in project 2 represents 10% of the total dataset, while it only represents 0.01% in project 1). The algorithm proposed in the pioneering work of BrØnd & al. [14] showed a similar behavior: these authors reported an average relative difference of 2.2% ± 1.7% and a Cohen's kappa of 0.945 (meaning an almost perfect level of agreement as stated by [27], but using a more complex algorithm that allowed less adaptability capacity than both algorithms presented in the current study. Indeed, our proposed fixed bandwidth algorithm is simpler (8th-vs. 20th-order filter) than that of BrØnd & al. [10], thereby allowing adaptability to various data sampling rates, and the modifiable bandwidth version allows us to modify the frequency bandwidth to best match the movement profile of clinical populations, environments and tasks.
Adding to these results, the two proposed activity classification methods also showed excellent performance. Indeed, the discrete algorithm reproduced the commercial activity classifier results in an accurate manner, while the continuous method differed from the commercial solution but still reported high concurrent validity (r > 0.89, p < 0.05). In fact, the continuous method should be considered more precise to classify levels of physical activity as it operated sample-by-sample (e.g., 100 computations at each second for a sampling rate of 100 Hz) as opposed to the discrete method, which calculates values second-by-second. As they are both valid methods to classify levels of activity, we suggest that the discrete method should be used when comparing results with other studies using commercial solutions, and the continuous method should be used otherwise.

Clinical Implications
Wearable sensors, including accelerometers, are already used with various clinical populations to measure PA in the rehabilitation setting [28]. However, as is generally the case, commercial activity count algorithms are not publicly available (or open-source) as they are protected by trade secret. The development of an open-source activity intensity count algorithm is important to ensure sustainability of data processing as commercially available devices change over time, and to enable researchers to adapt the algorithm to the clinical population under study. Rehabilitation programs and clinical research will benefit from the proposed open-source algorithms as they are more adaptable to the real-world context and therefore become more precise than commercially available solutions when used to assess physical activity in the presence of movement disorders (e.g., spasticity, tremors, slowness of movement).
The proposed algorithms have been validated with different tasks and on different data collection duration time scales, from minutes to weeks. The modifiable bandwidth algorithm can be used with people living with incapacities. For example, in persons with Parkinson's disease, the band-pass frequency can be adjusted to remove tremors from the signals. For persons having slowness of movements (e.g., stroke survivors), the threshold can be reduced, and on the contrary, in persons living with spasms or hyperkinesia (e.g., cerebral palsy), the threshold can be increased. The continuous method to classify levels of PA is also an interesting tool for clinicians and rehabilitation researchers as it helps to identify the level of PA performed over a given amount of time more precisely. Indeed, people living with disabilities often have to deal with a greater amount of fatigue, which means small periods of time with high levels of intensity. This could lead the commercial algorithm to underestimate their overall physical activity level.

Limitations
First, the proposed algorithms have been tested mainly on healthy subjects; only one population living with a disability (i.e., manual wheelchair users) was evaluated. It will be interesting to test the validity of the different methods proposed on other populations such as stroke survivors and people living with Parkinson's disease or cerebral palsy, to see the effects of spasticity, tremors or slowness of movements on PA level assessment. Second, it would have been interesting to evaluate the validity of the four proposed algorithms with different brands of accelerometers as in [14] (i.e., they used two different brands: ActiGraph and Axivity). Indeed, in this paper, the proposed algorithm activity counts using the Actigraph raw data were compared to the Actigraph Actilife software activity count. This decision was to make sure that the difference between activity counts came from the algorithm design and not from the fact that two or more sensors would not be exactly located at the same location on the arm or that they could move relative to another. As mentioned in [14], the algorithm can be used with other accelerometer sensors or inertial measurement units (IMU) (which comprise accelerometers), as they are based on raw data acceleration, which is typically very similar between devices. Two main accelerometer characteristics that could lead to differences between raw sensor data are the sensor's precision (minimum increment between two values, for instance, 0.001 g) and the accelerometer range (for instance, ±8 g). The precision should not be a major issue since the deadband and the bandpass filter in the algorithm will tend to minimize this difference. The range (ex. ±8 g for Actigraph GT9x used in this study) is more problematic. Indeed, if the range is different between sensors (ex. ±2 g vs. ±8 g), the activity count results could differ since one sensor would saturate. The effect of this should be limited since an accelerometer sensor range is typically minimal at ±2 g and the proposed algorithm saturates the signal either way at 2.13 g. In order to minimize discrepancies with the proposed algorithm, one should aim to set the range to ±8 g. Third, as accelerometers detect linear accelerations, they may detect false levels of activity by considering as valid any "false positive" activity counts such as acceleration when driving a car or going up in an elevator. This should be further investigated. Fourth, as accelerometer signals are highly dependent on the limb on which the accelerometer is placed, clinicians will have to carefully choose the placement of their sensors depending on the type of physical activity mostly performed by their patients (e.g., putting sensors on the leg if the patient mostly does cycling). Otherwise, activities might not be considered in the level of physical activity, which could underestimate the extent of physical activity in some patients. Finally, the open-source algorithms made available with this study (https://github.com/ingreadaptulaval/activitycounts) are adapted for research purposes (available in MATLAB format with a user interface that requires a certain level of knowledge in computer science), but are not yet adapted for use in clinical practice. Indeed, as clinicians must perform their assessment in a limited amount of time, they may need an easier-to-use interface, which would require further development.

Conclusions
This study presents the design and validation of open-source algorithms for activity intensity quantification and classification. They are valid and can be used to assess the PA of manual wheelchair users and healthy participants at different joints (wrist, leg and trunk), during various recording durations (several minutes to days) and for a variety of physical activities. The development of an open-source activity intensity count algorithm is important to ensure sustainability of data processing as wearable devices evolve, and to enable researchers to adapt the data processing algorithm to the needs of various clinical populations. Two versions of the activity intensity quantification are proposed: fixed and modifiable bandwidths. Two versions of the classification algorithm are also proposed: discrete and continuous. The combination of the fixed bandwidth with the discrete method results in a solution close to what is commercially available. On the other hand, the modifiable bandwidth version remains valid while being more adaptable, and the continuous classifying method generates more precise results. Future work will consist of adapting the algorithms to various clinical populations.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results. Table A1. A synthesis of the activities performed by subjects of the 24-h project (project 1).

Number of Reporting Participants/4
Desk work 4 Leisure time 4

Playing guitar 1
Playing with the dog 2

Watching television 2
Brushing teeth 4 Taking the bus 2 Running 1