User Tools

Site Tools


visual3d:tutorials:events:kinematic_event_detection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
visual3d:tutorials:events:kinematic_event_detection [2025/05/30 17:06] wikisysopvisual3d:tutorials:events:kinematic_event_detection [2025/05/30 20:00] (current) wikisysop
Line 49: Line 49:
   * {{ :visual3d:tutorials:events:copy_of_o_connor_et_al_-_2007_-_automatic_detection_of_gait_events_using_kinematic_data_1_.pdf |OConnor et al. (2007)}}   * {{ :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.
  
-====== Notes ======+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.
  
-This tutorial is based on a research project presented at the Ontario Biomechanics Conference (OBC) 2025 titled "**Assessing Different Kinematic Methods of Structuring Gait**".+2. **Understanding and Applying Kinematic Method Pipelines**
  
-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.+The next phase involves applying several published and custom kinematic methods to detect gait events without relying on kinetic data. 
  
-This tutorial is intended for users who either do not have access to lab-grade kinetic instrumentation, or see this equipment as unideal for their environment- in the case of a field-based or markerless system+Each method is built using the Visual3D pipeline script to extract features such as foot position, velocity, hip extension, and marker accelerations.
  
-==== Objectives ==== +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: 
-  * Introduce and implement kinematic-based gait event detection methods from peer-reviewed literature. +  * One based on hip surpassing heel  
-  * Provide a step-by-step approach to structuring gait cycles in Visual3D. +  * the other on peak knee flexion angleoffering alternative kinematic cues not commonly discussed in literature.
-  * Compare the derived cycles to kinetic-based baseline cycle. +
-  * Use downloadable dataVisual3D pipelines, and batch scripting workflows in order to simulate the process of this investigation.+
  
-==== Background and Rationale ==== 
-Traditionally, gait cycle events such as Heel Strike (HS) and Toe Off (TO) are defined using force thresholds derived from ground reaction force (GRF) data. This method is reliable but dependent on lab based equipment. 
  
-Kinematic methods detect HS and TO using joint angles, segment velocities, or spatial relationships between anatomical markersAlthough these methods are not perfect, they are crucial for field-based studies, clinical gait analysis, and wearable-only workflows.+3**Apply and Generate Measures to Compare all Methods**
  
-In our projectwe evaluated the following kinematic event detection methods: +Once individual method pipelines were validatedthey 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.
-  * {{ :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.pdf |O'Connor et al. (2007)}} +
-  * **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 identifies gait events based on unique kinematic patterns, such as: +These durations are stored under the METRIC::PROCESSED:: folder in the application.
-  * Local minima/maxima in foot marker trajectories. +
-  * Peak knee flexion or extension. +
-  * Spatial relationship between foot and hip joint centers.+
  
-==== Dataset Description ====+4. **Exporting to Python for Statistical Evaluation**
  
-This tutorial uses the [[https://figshare.com/articles/dataset/A_public_data_set_of_overground_and_treadmill_walking_kinematics_and_kinetics_of_healthy_individuals/5722711/2|Fukuchi et al. (2018)]] walking dataset. +Finally, the computed cycle durations are exported to an Excel file where each row represents one gait cycle instance.
-  * Journal Article: [[https://pubmed.ncbi.nlm.nih.gov/29707431/|A public dataset of overground and treadmill walking kinematics and kinetics in healthy individuals.]] +
-  * **Participants**: 42 healthy adults (24 younger, 18 older) +
-  * **Trials**: 5-8 treadmill walking trials per participant, increasing speed per trial. +
-  * Data collected includes marker trajectories and kinetic data fr  * om an instrumented treadmill.+
  
-**Important Notes:** +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.
-  * Only left-side gait events were analyzed. +
-  * Data was pre-processed to extract joint anglessegment positions and other features required for each algorithm. This will be included in the sample data.+
  
-==== Downloads ====+This statistical framework allows us to access the consistency and reliability of each method in reproducing gait cycle structure comparable to kinetic-based baselines.
  
-The ZIP File for this tutorial can be downloaded here. This provides files for the different steps of the workflow process of the research. 
  
-=== 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 === +===== Preprocessing Using Visual3D =====
-Organize the workspace by participant. Make sure each trial has: +
-  * A working biomechanical model. +
-  * Joint angle outputs.+
  
-=== Step 2: Apply Kinetic Baseline Events === +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. 
-Use **Automatic_Gait_Event** command in Visual3D to generate Left Onset (LON) Kinetic eventsThese will serve as the gold-standard baseline.+ 
 +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. 
 + 
 +3This 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:
  
 <code> <code>
-Automatic_Gait_Events +Set_Pipeline_Parameter 
-! /FRAME_WINDOW=8 +/PARAMETER_NAME=USERIDX 
-! /USE_TPR=TRUE +**/PARAMETER_VALUE=01** 
-! /TPR_EVENT_INSTANCE=1+! /PARAMETER_VALUE_SEARCH_FOR= 
 +! /PARAMETER_VALUE_REPLACE_WITH= 
 +! /PARAMETER_VALUE_PREFIX
 +! /PARAMETER_VALUE_APPEND
 +! /MULTI_PASS=FALSE
 ; ;
 </code> </code>
  
-These events use vertical ground reaction force thresholds to identify HS/TO.+{{: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.
  
-==== Results Summary ==== +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.
-The project found that: +
-  * Zeni's method 1 (HS foot vertical position), method 2 (TO foot vertical position), and peak knee angle method produced the most reliable cycles compared to the kinetic baseline+
-  * Some methods introduced variability as speed increased. +
-  * Kinematic methods are viable alternatives in environments without force platesprovided 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.txt · Last modified: 2025/05/30 20:00 by wikisysop