visual3d:tutorials:events:kinematic_event_detection
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:tutorials:events:kinematic_event_detection [2025/05/30 17:06] – wikisysop | visual3d:tutorials:events:kinematic_event_detection [2025/07/16 16:29] (current) – wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Assessing Kinematic Methods of Structuring Gait====== | ====== Assessing Kinematic Methods of Structuring Gait====== | ||
- | ===== Overview | + | ===== Overview ===== |
- | + | ||
- | This tutorial is a comprehensive walkthrough of a research investigation presented at the Ontario Biomechanics Conference (OBC) 2025. | + | |
- | + | ||
- | The study, titled " | + | |
+ | This tutorial is a comprehensive walkthrough of a research investigation presented at the Ontario Biomechanics Conference (OBC) 2025. The study, titled " | ||
**Research Question: Are kinematic event detection methods able to reliably structure biomechanical waveforms in the gait cycle?** | **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, | + | The tutorial has been designed for biomechanics researchers, |
===== Introduction ====== | ===== Introduction ====== | ||
- | In gait analysis, the ability to structure biomechanical waveforms into gait cycles is crucial | + | In gait analysis, the ability to structure biomechanical waveforms into gait cycles is needed |
- | Traditionally, | + | Given these limitations, |
- | + | ||
- | Given these limitations, | + | |
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. | 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 | + | ===== Data ===== |
{{: | {{: | ||
Line 33: | Line 28: | ||
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. | 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 | + | ===== Sample |
- | To facilitate learning and application, | + | To facilitate learning and application, |
* Includes a Visual3D preprocessing pipeline (**Preprocessing_Pipeline**) that performs kinetic event detection and computes the necessary joint kinematics. | * Includes a Visual3D preprocessing pipeline (**Preprocessing_Pipeline**) that performs kinetic event detection and computes the necessary joint kinematics. | ||
* **PREPROCESSED_PARTICIPANTS**: | * **PREPROCESSED_PARTICIPANTS**: | ||
Line 43: | Line 38: | ||
* **AutoFormatted_Gait_Data_Final**: | * **AutoFormatted_Gait_Data_Final**: | ||
- | Copies of the literature for the various kinematic methods used are also included in the ZIP archive: | ||
- | * {{ : | ||
- | * {{ : | ||
- | * {{ : | ||
- | * {{ : | ||
+ | ===== Workflow Outline ====== | ||
+ | ====1. Preprocessing in Visual3D ==== | ||
- | ====== Notes ====== | + | 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. |
- | This tutorial is based on a research project presented at the Ontario Biomechanics Conference | + | 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. |
- | The goal of this tutorial is to help users replicate the research process and understand ho to structure gait cycles without relying on kinetic data (e.g. from force plates or instrumented treadmills). Instead, we will use kinematic data and implement several established event detection algorithms using Visual3D. | + | ==== 2. Understanding |
- | This tutorial is intended for users who either do not have access | + | The next phase involves applying several published and custom kinematic methods |
- | ==== Objectives ==== | + | Each method is built using the Visual3D |
- | * Introduce and implement kinematic-based gait event detection methods from peer-reviewed literature. | + | |
- | * Provide a step-by-step approach to structuring gait cycles in Visual3D. | + | |
- | * Compare the derived cycles | + | |
- | * Use downloadable data, Visual3D pipelines, and batch scripting workflows in order to simulate the process of this investigation. | + | |
- | ==== Background and Rationale ==== | + | On top of the 9 methods |
- | Traditionally, | + | * One based on hip surpassing heel |
+ | * the other on peak knee flexion angle, offering alternative kinematic cues not commonly discussed in literature. | ||
- | Kinematic methods detect HS and TO using joint angles, segment velocities, or spatial relationships between anatomical markers. Although these methods are not perfect, they are crucial for field-based studies, clinical gait analysis, and wearable-only workflows. | ||
- | In our project, we evaluated the following kinematic event detection methods: | + | ==== 3. Apply and Generate Measures to Compare all Methods ==== |
- | * {{ : | + | |
- | * {{ : | + | |
- | * {{ : | + | |
- | * {{ : | + | |
- | * **Max Knee Angle Method** - Local maximum events for knee reaching peak flexion. | + | |
- | * **Hip Surpasses Heel** - event placed when leading hip joint center overtakes opposite foot. | + | |
- | Each method | + | Once individual |
- | | + | |
- | | + | |
- | | + | |
- | ==== Dataset Description ==== | + | These durations are stored under the METRIC:: |
- | This tutorial uses the [[https:// | + | ==== 4. Exporting to Python for Statistical Evaluation ==== |
- | * Journal Article: [[https:// | + | |
- | * **Participants**: | + | |
- | * **Trials**: 5-8 treadmill walking trials per participant, | + | |
- | * Data collected includes marker trajectories and kinetic data fr * om an instrumented treadmill. | + | |
- | **Important Notes:** | + | Finally, the computed cycle durations are exported to an Excel file where each row represents one gait cycle instance. |
- | * Only left-side gait events were analyzed. | + | |
- | * Data was pre-processed to extract joint angles, segment positions and other features required for each algorithm. This will be included in the sample data. | + | |
- | ==== Downloads ==== | + | 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. |
- | The ZIP File for this tutorial can be downloaded here. This provides files for the different steps of the workflow process of the research. | + | This statistical framework allows us to access |
- | === Compute Kinematic Parameters === | ||
- | Before applying the kinematic event methods, compute the joint angles and positions required. This typically includes the **Compute_Joint_Angle** and **Compute_Segment_Position**. | ||
- | The base pipeline with all preprocessing steps. This will be used before applying any method-specific event logic. | + | ---- |
- | === Step 1: Set up your environment === | ||
- | Organize the workspace by participant. Make sure each trial has: | ||
- | * A working biomechanical model. | ||
- | * Joint angle outputs. | ||
- | === Step 2: Apply Kinetic Baseline Events | + | ===== Preprocessing Using Visual3D ===== |
- | Use **Automatic_Gait_Event** command in Visual3D to generate Left Onset (LON) Kinetic events. These will serve as the gold-standard baseline. | + | |
+ | 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, | ||
+ | |||
+ | 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 | ||
+ | |||
+ | 2. Click **Open Pipeline** and browse to select the Preprocessing_Pipeline.v3s file included in the ZIP. | ||
+ | |||
+ | 3. This pipeline | ||
+ | * **Set_Pipeline_Parameter** command: / | ||
+ | * **Set_Subject_Height** and **Set_Subject_Weight** to specific values found on Subject_Info excel sheet from sample data. | ||
+ | |||
+ | For example, for PARTICIPANT #1: | ||
< | < | ||
- | Automatic_Gait_Events | + | Set_Pipeline_Parameter |
- | ! /FRAME_WINDOW=8 | + | / |
- | ! /USE_TPR=TRUE | + | **/ |
- | ! /TPR_EVENT_INSTANCE=1 | + | ! / |
+ | ! / | ||
+ | ! /PARAMETER_VALUE_PREFIX= | ||
+ | ! /PARAMETER_VALUE_APPEND= | ||
+ | ! /MULTI_PASS=FALSE | ||
; | ; | ||
</ | </ | ||
- | These events | + | {{: |
+ | |||
+ | 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. | ||
+ | |||
+ | **LHS/LTO Foot Position (Zeni Method 1) :** Heelstrike and toe off events | ||
+ | |||
+ | **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, | ||
+ | |||
+ | **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 | ||
+ | |||
+ | **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. The table below shows a summary of these methods: | ||
+ | |||
+ | |**Method Name**|**Events Produced**|**Description**| | ||
+ | |Foot Position - Zeni Method 1|LHS, LTO|Uses anterior-posterior position of the foot.| | ||
+ | |Foot Velocity - Zeni Method 2|LHS, LTO|Identifies local minimum in foot's anterior-posterior velocity/ | ||
+ | |Hip Extension - DeAsha Method|LHS| Points of peak hip extension.| | ||
+ | |Toe Acceleration - Hreljac Method|LHS, LTO|Peak in vertical acceleration of toe marker.| | ||
+ | |Heel Velocity - OConnor Method|LHS, LTO|Identifies local minimum in local heel velocity.| | ||
+ | |Hip Surpassing Heel|LHip_Passes_Heel|Identifies moment the leading hip joint center overtakes the opposite foot.| | ||
+ | |Max Knee Angle|LKnee_Angle_Max|Peak knee flexion-extension angle.| | ||
+ | |||
+ | |||
+ | ===== 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' | ||
+ | |||
+ | 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 {{: | ||
+ | |||
+ | 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**. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Once the pipeline has completed running on all the participant CMZs, you may open one on Visual3D | ||
+ | |||
+ | |{{: | ||
+ | |||
+ | |||
+ | ===== Exporting Data for Statistical Analysis ===== | ||
+ | |||
+ | After processing, gait cycle duration data is exported using **Export_Data_To_ASCII**. | ||
+ | |||
+ | < | ||
+ | Export_Data_To_Ascii_File | ||
+ | ! /FILE_NAME= | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | The command extracts the METRIC value of cycle durations for each method, for each of the participants. This is then opened in an excel file, and all participants were combined into one XML included in the sample data. The format of the sheet is the following: | ||
+ | |||
+ | |**SUBJECT NO.**|**TRIAL**|**METHOD**|**CYCLE_INSTANCE**|**CYCLE_DURATION**| | ||
+ | |Sub01 | ||
+ | |||
+ | |||
+ | ===== Statistical Evaluation Using Linear Mixed Models ====== | ||
+ | |||
+ | Once all gait events and cycle durations were processed in Visual3D, the data was ready for statistical analysis. To assess how well the different kinematic methods agreed with the kinetic gold standard, we used a statistical approach called a **Linear Mixed Model (LMM)** in Python (via the statsmodels library). | ||
+ | |||
+ | In this analysis, we looked at the **cycle duration** as the outcome we were measuring. We then compared this outcome across different **event detection methods** (which served as the fixed effect), while accounting for variation across participants and their trials (included as random effects). | ||
+ | |||
+ | This model was chosen because it is especially good at handling repeated measures, meaning it can recognize that the same person may walk differently across trials, and still lets us isolate whether the method itself is making a difference. | ||
+ | |||
+ | To visualize the results, we start with a boxplot that shows the cycle durations for one of the more reliable kinematic methods- **LHS Foot Position** (also known as Zeni Method 1)- compared to the **LON Kinetic Baseline**. You'll notice that the distributions of the two are quite similar, suggesting that this method might be reliably mimicking the gold standard. | ||
+ | |||
+ | However, this figure does not show us the whole story, since it doesn' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | That's where the results plot from the Linear Mixed Model comes in. In this graph, we show how each method' | ||
+ | |||
+ | If a method' | ||
+ | - LHS Foot Position | ||
+ | - LTO Foot Position | ||
+ | - Peak Knee Angle | ||
+ | |||
+ | These results suggest that those methods can structure gait cycles just as consistently as the gold standard kinetic approach. | ||
- | ==== Results Summary ==== | + | On the other hand, several methods have an asterisk beside their points, meaning they were significantly different from the baseline |
- | The project found that: | + | |
- | * Zeni's method 1 (HS foot vertical position), method 2 (TO foot vertical position), and peak knee angle method produced | + | |
- | * Some methods introduced variability as speed increased. | + | |
- | * Kinematic methods are viable alternatives in environments without force plates, provided method-specific biases are considered. | + | |
+ | {{: | ||
+ | ===== 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. | ||
visual3d/tutorials/events/kinematic_event_detection.1748624766.txt.gz · Last modified: 2025/05/30 17:06 by wikisysop