@@ -17,11 +17,11 @@ Gaitalytics
17
17
:target: https://python-gaitalytics.readthedocs.io/
18
18
:alt: Documentation Status
19
19
20
- .. |github-actions | image :: https://github.com/DART-Lab-LLUI/python-gaitalytics/actions/workflows/github-actions.yml /badge.svg
20
+ .. |github-actions | image :: https://github.com/DART-Lab-LLUI/python-gaitalytics/actions/workflows/on_push_test.yaml /badge.svg
21
21
:alt: GitHub Actions Build Status
22
- :target: https://github.com/DART-Lab-LLUI/python-gaitalytics/actions
22
+ :target: https://github.com/DART-Lab-LLUI/python-gaitalytics/actions/
23
23
24
- .. |commits-since | image :: https://img.shields.io/github/commits-since/DART-Lab-LLUI/python-gaitalytics/v0.1.2 .svg
24
+ .. |commits-since | image :: https://img.shields.io/github/commits-since/DART-Lab-LLUI/python-gaitalytics/latest .svg
25
25
:alt: Commits since latest release
26
26
:target: https://github.com/DART-Lab-LLUI/python-gaitalytics/compare/
27
27
@@ -46,14 +46,25 @@ offering high configurability.
46
46
Functionalities
47
47
---------------
48
48
49
+ Input
50
+ ^^^^^
51
+ Currently only c3d files are supported.
52
+ The library provides a function to load a c3d file into a trial object for usage in the library.
53
+
54
+ .. note ::
55
+ future efforts will be made to support other file formats such as trc, mot, sto and mox files.
56
+
49
57
Event Detection
50
58
^^^^^^^^^^^^^^^
51
59
52
- +------------+--------------+----------------------------------------------------------------------------+
53
- | Method | Description | options |
54
- +============+==============+============================================================================+
55
- | Marker | Zenis 2006 | |
56
- +------------+--------------+----------------------------------------------------------------------------+
60
+ +------------+--------------------------+----------------------------------------------------------------------------+
61
+ | Method | Description | options |
62
+ +============+==========================+============================================================================+
63
+ | Marker | based on Zenis 2006 | - height: The height of peaks for events. |
64
+ | | | - threshold: The threshold for detecting events. |
65
+ | | | - distance: The min distance in frames between events. |
66
+ | | | - rel_height: The relative height of peak for events. |
67
+ +------------+--------------------------+----------------------------------------------------------------------------+
57
68
58
69
59
70
Event Detection Check
@@ -62,36 +73,81 @@ Event Detection Check
62
73
+------------+--------------------------------------------------+-------------------------+
63
74
| Method | Description | options |
64
75
+============+==================================================+=========================+
65
- | context | Checks gait event sequences | |
66
- | | HS->TO-HS-TO | |
76
+ | sequence | Checks gait event sequences | |
77
+ | | - Heel Strike - Toe off - Heel Strike - Toe off | |
78
+ | | - Left - Right - Left - Right | |
79
+ +------------+--------------------------------------------------+-------------------------+
80
+
81
+ Event Writing
82
+ ^^^^^^^^^^^^^
83
+
84
+ Currently only c3d files are supported.
85
+ The main usage for this feature is the correction of detected events.
86
+
87
+ Segmentation
88
+ ^^^^^^^^^^^^
89
+
90
+ Currently only the segmentation based on gait-events is supported.
91
+
92
+ +------------+--------------------------------------------------+-------------------------+
93
+ | Method | Description | options |
94
+ +============+==================================================+=========================+
95
+ | HS | Segment based on heel strike | |
96
+ +------------+--------------------------------------------------+-------------------------+
97
+ | TO | Segment based on toe off | |
98
+ +------------+--------------------------------------------------+-------------------------+
99
+
100
+ Time Normalization
101
+ ^^^^^^^^^^^^^^^^^^
102
+ Currently only linear time normalization is supported.
103
+
104
+ .. note ::
105
+ future efforts will be made to support other time normalization
106
+ methods such as dynamic time warping.
107
+
67
108
+------------+--------------------------------------------------+-------------------------+
68
- | spacing | Checks Frames between same event on same context | |
109
+ | Method | Description | options |
110
+ +============+==================================================+=========================+
111
+ | linear | Linear time-normalisation | |
69
112
+------------+--------------------------------------------------+-------------------------+
70
113
71
114
72
- Analysis
73
- ^^^^^^^^
74
-
75
- +-----------------+------------------------------------------------------------+---------------------------------------+
76
- | Method | Description | options |
77
- +=================+============================================================+=======================================+
78
- | angels | - min | |
79
- | forces | - max | |
80
- | moments | - mean | |
81
- | power | - sd | |
82
- | | - median | |
83
- | | - amplitude | |
84
- +-----------------+------------------------------------------------------------+---------------------------------------+
85
- | Spatio-temporal | - step_length [1] | |
86
- | | - stride_length [1] | |
87
- | | - cycle_duration | |
88
- | | - swing_duration_perc | |
89
- | | - stance_duration_perc | |
90
- | | - step_width [1] | |
91
- | | - cadence [1] | |
92
- | | - single_support_duration_percent [2] | |
93
- | | - double_support_duration_percent [2] | |
94
- +-----------------+------------------------------------------------------------+---------------------------------------+
115
+ Feature calculation
116
+ ^^^^^^^^^^^^^^^^^^^
117
+
118
+ +-------------------------+-------------------------------------------------------+---------------------------------------+
119
+ | Method | Description | options |
120
+ +=========================+=======================================================+=======================================+
121
+ | TimeSeriesFeatures | - min | |
122
+ | | - max | |
123
+ | | - mean | |
124
+ | | - sd | |
125
+ | | - median | |
126
+ | | - amplitude | |
127
+ +-------------------------+-------------------------------------------------------+---------------------------------------+
128
+ | PhaseTimeSeriesFeatures | - stand_min | |
129
+ | | - stand_max | |
130
+ | | - stand_mean | |
131
+ | | - stand_sd | |
132
+ | | - stand_median | |
133
+ | | - stand_amplitude | |
134
+ | | - swing_max | |
135
+ | | - swing_mean | |
136
+ | | - swing_sd | |
137
+ | | - swing_median | |
138
+ | | - swing_amplitude | |
139
+ +-------------------------+-------------------------------------------------------+---------------------------------------+
140
+ | SpatialFeatures | - step_length [1] | |
141
+ | | - stride_length [1] | |
142
+ +-------------------------+-------------------------------------------------------+---------------------------------------+
143
+ | TemporalFeatures | - cycle_duration | |
144
+ | | - swing_duration_perc | |
145
+ | | - stance_duration_perc | |
146
+ | | - step_width [1] | |
147
+ | | - cadence [1] | |
148
+ | | - single_support_duration_percent [2] | |
149
+ | | - double_support_duration_percent [2] | |
150
+ +-------------------------+-------------------------------------------------------+---------------------------------------+
95
151
96
152
References
97
153
""""""""""
@@ -115,65 +171,95 @@ Fast install with anaconda:
115
171
116
172
.. code :: shell
117
173
118
- conda install gaitalytics
119
- ..
120
-
121
-
122
- You can also install the in-development version with:
123
-
124
- .. code :: shell
125
-
126
- todo
174
+ conda install gaitalytics -c DartLab-LLUI
127
175
..
128
176
129
177
Configuration
130
178
^^^^^^^^^^^^^
131
179
132
180
Gaitalytics can be used with any marker set, which at least includes
133
- four hip markers (left front/back, right front/back) and four foot
134
- markers (left heel/toe, right heel/toe) and four ankle makers (left
135
- medial/lateral, right medial lateral).
181
+ three or for hip markers (front left/right, back left/right or sacrum) and four foot
182
+ markers (left heel/toe, right heel/toe).
183
+
184
+ Additionally markers can be defined on which standard time-series features such as min max mean etc.
185
+ will be calculated.
136
186
137
187
All functionalities in the libraries only take points into account which
138
- are configured in as specific yaml file. Working example file can be
139
- found
140
- ` here < https://github.com/DART-Lab-LLUI/python-gaitalytics/blob/defc453f95940db55f6875ae7568949daa1b67d4/settings/hbm_pig.yaml >`__
188
+ are configured in as specific yaml file.
189
+
190
+
141
191
142
192
Minimal requirements would look like this:
143
193
144
194
.. code :: yaml
145
195
146
- marker_set_mapping :
147
- left_back_hip : LASIS
148
- right_back_hip : RASIS
149
- left_front_hip : LPSIS
150
- right_front_hip : RPSIS
196
+ # Markers to analyse
197
+ analysis :
198
+ markers : # Markers to analyse
199
+ # Left side
200
+ - " LHipAngles"
201
+ - " LKneeAngles"
202
+ - " LAnkleAngles"
203
+ - " LPelvisAngles"
204
+ - " LThoraxAngles"
205
+ mapping :
206
+ markers :
207
+ # Foot
208
+ l_heel : " LHEE"
209
+ r_heel : " RHEE"
210
+ l_toe : " LTOE"
211
+ r_toe : " RTOE"
212
+
213
+ # Hip
214
+ l_ant_hip : " LASI"
215
+ r_ant_hip : " RASI"
216
+ l_post_hip : " LPSI"
217
+ r_post_hip : " RPSI"
218
+ sacrum : " SACR"
219
+ ..
151
220
152
- left_lat_malleoli : LLM
153
- right_lat_malleoli : RLM
154
- left_med_malleoli : LMM
155
- right_med_malleoli : RMM
156
221
157
- right_heel : RHEE
158
- left_heel : LHEE
159
- right_meta_2 : RMT2
160
- left_meta_2 : LMT2
161
222
162
- com : COM
163
- left_cmos : cmos_left
164
- right_cmos : cmos_right
223
+ Simple Pipeline
224
+ ^^^^^^^^^^^^^^^^
165
225
166
- model_mapping :
167
- ..
226
+ .. code :: python
227
+
228
+ from gaitalytics import api
229
+
230
+ # Load configuration (yaml file from above)
231
+ config = api.load_config(" ./pig_config.yaml" )
232
+
233
+ # Load trial from c3d file
234
+ trial = api.load_c3d_trial(" ./test_small.c3d" , config)
235
+
236
+ # Detect events
237
+ events = api.detect_events(trial, config)
238
+ try :
239
+ # detect events (marker based)
240
+ events = api.check_events(events, config)
241
+
242
+ # check events
243
+ api.check_events(events, config)
244
+
245
+ # write events to c3d in the same file
246
+ api.write_events_to_c3d(trial, events)
247
+
248
+ # segment trial to gait cycles. (Events are already existing in the c3d file)
249
+ trial_segmented = api.segment_trial(trial)
250
+
251
+ # calculate features
252
+ features = api.calculate_features(trial_segmented, config)
168
253
169
- **Warning ** Do not rename keys of the minimal setting
254
+ # save features
255
+ faetures.to_netcdf(" features.nc" )
170
256
171
- Pipeline
172
- ^^^^^^^^
257
+ # export segmented trial to netcdf
258
+ api.export_trial(trial_segmented, config, " output.nc " )
173
259
174
- Please take the resources in the ` example
175
- folder <https://github.com/DART-Lab-LLUI/python-gaitalytics/tree/defc453f95940db55f6875ae7568949daa1b67d4/examples> `__
176
- for advice.
260
+ api.export_trial(trial_segmented, config, " output.c3d " )
261
+ except ValueError as e:
262
+ print (e)
177
263
178
264
Documentation
179
265
-------------
0 commit comments