====== Assessing Kinematic Methods of Structuring Gait====== ===== Overview - Abstract ===== This tutorial is a comprehensive walkthrough of a research investigation presented at the Ontario Biomechanics Conference (OBC) 2025. The study, titled "Assessing Different Kinematic Methods of Structuring Gait", explores how gait events can reliably detected using only kinematic data, without access to lab-based kinetic systems such as force plates or instrumented treadmills. **Research Question: Are kinematic event detection methods able to reliably structure biomechanical waveforms in the gait cycle?** The tutorial has been designed for biomechanics researchers, students, and clinicians interested in alternative gait cycle structuring approaches, especially in field-based or markerless motion capture settings. ===== Introduction ====== In gait analysis, the ability to structure biomechanical waveforms into gait cycles is crucial for analyzing joint angles, segment kinematics, and for computing various gait measures like step length and phase durations. Traditionally, gait cycles are structured using kinetic event detection methods based on ground reaction forces (GRFs), which provide an objective and reliable signal for detecting HS and TO. However, kinetic data acquisition requires expensive equipment and comes with many other downfalls. Given these limitations, researchers have developed a range of kinematic event detection algorithms that rely on marker trajectories or derived joint kinematics to infer gait events. While these methods are promising, their accuracy and robustness - especially under varying walking speeds and among diverse populations- need validation. The aim of this tutorial is to present a step-by-step guide for using HAS-Motion software tools, specifically Visual3D, to process gait data and compare several kinematic-based methods against the kinetic-based gold standard. ===== Dataset Description ===== {{:visual3d:tutorials:events:fukuchi_dataset_article_image.png?600|}} [[https://pubmed.ncbi.nlm.nih.gov/29707431/|Link to Article]] This investigation uses the publicly available dataset from [[https://figshare.com/articles/dataset/A_comprehensive_public_data_set_of_running_biomechanics_and_the_effects_of_running_speed_on_lower_extremity_kinematics_and_kinetics/4543435m|Fukuchi et al. (2018)]], which provides overground and treadmill walking data for 42 healthy adults. The dataset consists of 24 younger participants (mean age ~27.6 years) and 18 older particpants (mean age ~62.7 years). Each subject completed both treadmill and overground walking trials across a range of speeds. For each trial, 3D kinematic data was captured using a 26-marker lower-body configuration at a sampling rate of 150 Hz, and ground reaction forces were recorded from an instrumented treadmill at 300 Hz. Metadata for each participant includes height, weight, segment length, sex, leg dominance, and treadmill speed. This tutorial focuses exclusively on **treadmill trials** and analyzes only **left-side events** (LHS and LTO). This simplifies gait cycle definitions to the interval between two identical events on the same foot, which is essential for consistent waveform normalization. ===== Sample Data Download and Contents ====== To facilitate learning and application, we provide a premade ZIP archive containing all required files. * Includes a Visual3D preprocessing pipeline (**Preprocessing_Pipeline**) that performs kinetic event detection and computes the necessary joint kinematics. * **PREPROCESSED_PARTICIPANTS**: Preprocessed CMZ files for all 42 participants with the preprocessing pipelines applied. * **FULL_PROCESSED_PARTICIPANTS**: Fully processed CMZ files for all 42 subjects where all methods and events have already been applied to the data. * **METHOD PIPELINES + MASTER**: Folder containing individual Visual3D pipeline scripts for each kinematic method (e.g., Zeni Method 1+2, DeAsha, Hreljac, etc.) and a master pipeline script that applies all methods and computes the metric of cycle duration. * **WBDSmodel.mdh**: Original model file that defines the lower limb segments using the 26 anatomical markers. * **AutoFormatted_Gait_Data_Final**: Excel sheet containing resultant exported data from processing - listing method, trial and cycle instance+duration. This format is used for more accessible manipulation during analysis in Python. Copies of the literature for the various kinematic methods used are also included in the ZIP archive: * {{ :visual3d:tutorials:events:copy_of_zeni_richards_and_higginson_-_2008_-_two_simple_methods_for_determining_gait_events_during_treadmill_and_overground_walking_using_kinematic_data.pdf |Zeni et al. (2018) Method 1 and 2}} * {{ :visual3d:tutorials:events:copy_of_de_asha_robinson_and_barton_-_2012_-_a_marker_based_kinematic_method_of_identifying_initial_contact_during_gait_suitable_for_use_in_real-time_visual_feedback_applications.pdf |DeAsha et al. (2012)}} * {{ :visual3d:tutorials:events:copy_of_hreljac_and_marshall_-_2000_-_algorithms_to_determine_event_timing_during_normal_walking_using_kinematic_data.pdf |Hreljac & Marshall (2000)}} * {{ :visual3d:tutorials:events:copy_of_o_connor_et_al_-_2007_-_automatic_detection_of_gait_events_using_kinematic_data_1_.pdf |OConnor et al. (2007)}} ===== Workflow Outline ====== 1. **Preprocessing in Visual3D** The first stage involves preprocessing all participant data using the **Preprocessing_Pipeline.v3s** script. This step takes treadmill-only trials for each participant and puts them into a single CMZ file and computes joint kinematic data. During this stage, ground reaction force (GRF) data is used to automatically detect kinetic gait events, establishing a **baseline** for later comparison. Subject-specific anthropometric data (height and weight) are manually input from the provided spreadsheet. 2. **Understanding and Applying Kinematic Method Pipelines** The next phase involves applying several published and custom kinematic methods to detect gait events without relying on kinetic data. Each method is built using the Visual3D pipeline script to extract features such as foot position, velocity, hip extension, and marker accelerations. On top of the 9 methods (where HS and TO events are evaluated in their own methods, respectively), 2 additional methods were devised for this investigation: * One based on hip surpassing heel * the other on peak knee flexion angle, offering alternative kinematic cues not commonly discussed in literature. 3. **Apply and Generate Measures to Compare all Methods** Once individual method pipelines were validated, they were consolidated into a master script (**FinalPipeline_ALL_METHODS_SEQUENCES.v3s**). This pipeline computes all gait event across all methods simultaneously and then defines gait cycles based on those events. These durations are stored under the METRIC::PROCESSED:: folder in the application. 4. **Exporting to Python for Statistical Evaluation** Finally, the computed cycle durations are exported to an Excel file where each row represents one gait cycle instance. The structured data is then analyzed in Python using a Linear Mixed Model (LMM). In this model, the event detection method is treated as the fixed effect, while participant ID and trial number are modeled as nested random effects. This statistical framework allows us to access the consistency and reliability of each method in reproducing gait cycle structure comparable to kinetic-based baselines. ---- ===== Preprocessing Using Visual3D ===== The first part of the analysis involves applying the preprocessing pipeline (Preprocessing_Pipeline.v3s). This script automates the loading of treadmill trials from each participant, builds a subject-specific CMZ file by combining trials, and applies a model to compute segment lengths, joint angles, and kinetic-based gait events. The following shows the steps to complete the preprocessing. If you prefer to start with the already preprocessed folder, you may skip to the **NEXT SECTION**. 1. Open an empty workspace on the Visual3D application, and navigate to the pipeline workshop dialog. 2. Click **Open Pipeline** and browse to select the Preprocessing_Pipeline.v3s file included in the ZIP. 3. This pipeline will be run once for each participant. The following changes must be applied prior to executing the pipeline each time: * **Set_Pipeline_Parameter** command: /PARAMETER_VALUE= [PARTICIPANT NO.] * **Set_Subject_Height** and **Set_Subject_Weight** to specific values found on Subject_Info excel sheet from sample data. For example, for PARTICIPANT #1: Set_Pipeline_Parameter /PARAMETER_NAME=USERIDX **/PARAMETER_VALUE=01** ! /PARAMETER_VALUE_SEARCH_FOR= ! /PARAMETER_VALUE_REPLACE_WITH= ! /PARAMETER_VALUE_PREFIX= ! /PARAMETER_VALUE_APPEND= ! /MULTI_PASS=FALSE ; {{:visual3d:tutorials:events:preprocessing_dlg_changes_b4execution.png?500|}} 4. Now click **Execute Pipeline**, this will prompt the user to select the folder in which the raw c3d files are saved, browse for the **WBDSc3dWithGaitEvents** folder included within the original dataset. 5. Next, you will be prompted to select a model file - **WBDSmodel.mdh**. 6. Once the pipeline is executed, you will be prompted to save the participant CMZ to a location on your computer. Make sure they are placed within the same folder. ===== Understanding and Applying Kinematic Methods ===== Each kinematic method was implemented based on the procedures outlined in their original literature references. These methods rely on features like joint angles, foot velocities, and segment positions. Below are summaries of each method and how they were adapted into pipeline commands: **LHS/LTO Foot Position (Zeni Method 1) :** Heelstrike and toe off events are detected by identifying the peak forward and backward positions of the foot (specifically heel and toe markers) relative to the pelvis. The relative positions are calculated using **Compute_Model_Based_Data**, and event detection is done via **Event_Maximum** and **Event_Minimum** commands. **LHS/LTO Foot Velocity (Zeni Method 2):** Method looks for zero-crossings in the foot velocity signal relative to the pelvis. HS is the point when the foot velocity changes from forward to backward; TO is the reverse. This is implemented by calculating the first derivation of the position signal, followed by the **Event_Threshold** detection. **LHS Hip Extension (DeAsha Method):** Initial Contact (heelstrike) is inferred from the contralateral hip reaching its maximum extension. The hip flexion-extension angle is computed using the pelvis and thigh segments, and the event is marked using **Event_Minimum** commands on the sagittal plane angle. **LHS/LTO Toe Acceleration (Hreljac Method):** This method uses peaks in heel and toe marker acceleration, confirmed by corresponding zero-crossings in jerk (derivative of acceleration). **LHS/LTO Heel Velocity (OConnor Method):** Foot velocity is derived from filtered heel and toe marker trajectories. Events are identified by checking for local minima combined with constraints such as the vertical position of the heel being below 35% of its range. **Hip Surpassing Heel Method:** An event is detected when the leading hip joint center passes the position of the opposite foot, signaling a change in support limb. **Knee Angle Max Method**: A simpler method that structures cycles based on successive local maxima of the knee flexion signal, using **Event_Maximum** Each of these pipeline scripts define events AND compute the cycle duration using this events by placing them in sequences. ===== Generating and Comparing Gait Cycles Across Methods ===== Once each individual pipeline was validated, a master script called **FinalPipeline_ALL_METHODS_SEQUENCES.v3s** was constructed. This script applies all methods in sequence to each participant's CMZ file and computes gait cycle durations for each method, the values for the durations will be stored under the METRIC::PROCESSED::FOLDER within each Visual3D workspace. In order to apply this pipeline to all participant CMZs at once, **Sift** was used for it's batch processing capabilities while still allowing me to run a Visual3D pipeline script through the engine. The following steps were taken: 1. Open the Sift application to an empty workspace, select the {{:sift_library_load.png?20}} **Load Library** and set **Library Path** to the folder where your .cmz files are located. Ensure you are using the files from the preprocessing step taken previously (or **PREPROCESSED_PARTICIPANTS** premade folder). 2. Select the **Run V3D Engine (Gear Icon)** button on the taskbar and select **Add Script**. Use the previously mentioned master pipeline here -> click **Run Script**. {{:visual3d:tutorials:events:sift_masterpipeline.png?800|}} Once the pipeline has completed running on all the participant CMZ, you may open one on Visual3D to identify what was created. |{{:visual3d:tutorials:events:events_created.png?200|}}|{{:visual3d:tutorials:events:metrics_created.png?250|}}| ===== Exporting Data for Statistical Analysis ===== After processing, gait cycle duration data is exported using **Export_Data_To_ASCIII**. The command extracts mean cycle duration values for each trial and method combination, formatting them into a standardized table like so: |**SUBJECT NO.**|**TRIAL**|**METHOD**|**CYCLE_INSTANCE**|**CYCLE_DURATION**| |Sub01 |walkT01 |Zeni Foot Position| 1| 1.233| ===== Statistical Evaluation Using Linear Mixed Models ====== To evaluate the agreement between kinematic methods and the kinetic baseline, a Linear Mixed Model (LMM) was applied in Python using **statsmodels**. The dependent variable was cycle duration. The fixed effect was the detection method, while nested random effects were defined for participant and trial. LMM was chosen because it can model variability within and between participants and handle repeated measures across conditions. The results were visualized as coefficient plots showing deviations from the kinetic baseline, with confidence intervals indicating statistical significance. ===== Conclusions ===== This tutorial demonstrates that while kinetic event detection remains the gold standard, kinematic methods—especially those based on relative foot position or knee angles—can offer reliable alternatives for structuring gait waveforms. These findings are especially relevant for field-based settings and markerless applications. By providing sample data, executable pipelines, and analysis scripts, this tutorial equips users with a practical workflow for comparing gait cycle structuring methods and generating reproducible results.