User Tools

Site Tools


visual3d:tutorials:knowledge_discovery:assesing_stability_during_gait

Assesing Stability During Gait

Introduction

In this tutorial, we will review the current literature definition of Margin of Stability (MoS) and provide an example of calculating this measure in Visual3D.

We will also explore a new way to present the MoS that we think is more intuitive and overcomes some of the limitations of MoS during walking. We will provide an example of measuring a new MoS in Visual3D, and visualizing this measure using Inspect3D.

This tutorial is applicable to both marker-based and markerless motion capture data.

Background

The most common way that the literature addresses stability in standing and walking is through the Margin Of Stability (MoS). When the extrapolated center of mass (xCoM) is within the Base of Support (BoS), the MoS is positive, indicating that the system is stable. If MoS is negative, this would indicate that the xCoM outside the BoS, and the system is unstable [1]. In this interpretation, it is unclear where the XCoM is positioned when we are given a negative or positive MoS. The subject could be beyond the boundary of stability to the left, right, forward, or behind, and the MoS value as it is presented does not describe where the limit is crossed. Additionally, MoS values are often averaged over strides, which does not provide information about stride-to-stride variability and also assumes that the trajectory of a stride is independent of past or future strides [2]. These limitations make it difficult to interpret the MoS as a measure of stability during walking. It is important that we explore alternative ways of organizing and displaying MoS values that can overcome some of these limitations - which we will do in this tutorial!

Data

To simplify this tutorial, the following files are available to download as a starting point. They are provided in the zip folder labeled Margin_of_Stability_Tutorial.zip, which can be downloaded here. The file types and contents are briefly described below:

Marker-based files: The tutorial data set includes one subject model file, a static standing file, and two walking trials for marker-based motion capture.

  • Static File (Sample_Static.c3d): standing trial from marker-based data set
  • Model File (Sample_Model.mdh): model template for marker-based subject
  • Motion Files (Sample_walking*.c3d): treadmill walking trials from marker-based data set

Markerless files: The markerless and marker-based trials were recorded simultaneously, and the provided markerless file from THEIA (https://www.theiamarkerless.ca/) is for the first trial of this subject.

  • Markerless motion file (Sample_Markerless): THEIA Markerless motion file. Visual3D automatically assigns a model and static trial to this file when loaded in the workspace.
  • Meta-Commands (_.v3m): Copy and paste all included meta commands into the plugins>meta_commands folder in your Visual3D Program files. Restart your Visual3D application. See more on meta-commands here.

Marker-based vs Markerless Landmarks

To prepare the subject models for finding the MoS in this tutorial, we need to apply foot landmarks for defining the BoS during the trial.

To apply landmarks to the marker-based data:

  • 1. Open a new Visual3D workspace
  • 2. Run “Model_Landmarks_For_MoS” Meta-command
    • Open the pipelines dialog
    • Open the meta commands subfolder
    • select Model_Landmarks_For_MoS and run pipeline

You will first be prompted to provide the name of the targets for the following markers: Left heel (l_heel), right heel (r_heel), left mid toes (l_met23), right mid toes (r_met23), left fifth metatarsal (l_met5), right fifth metatarsal (l_met5), left first metatarsal (l_met1), and right first metatarsal (l_met1). FOR THIS TUTORIAL, the marker-based data targets have the same names as the parameters they are being set to, and in the dialog you can type these same names as the value entry. This is shown in the figure below. IF you are applying this method to a DIFFERENT MODEL, make sure to check what your target signals are named for these markers.

Next you will be prompted to select your model template file and static file. Navigate to the location of the folder downloaded for this tutorial, and select Sample_Model.mdh for the model template and Sample_Static.c3d for the static file (or your own file names if you are not using tutorial data).

  • 3. Load motion files and apply model
    • Open files: Sample_Waling1.c3d and Sample_Waling2.c3d for the marker-based motion files.
    • Select model > assign model to motion files

All motion files in Signals and Events should now have a model applied, with blue markers on the feet showing the applied landmarks. In the figure, landmarks have been checked to show you which have been added from the pipeline, you do not need to do this yourself.

To apply landmarks to markeless data:

  • 1. Open a new Visual3D workspace
  • 2. Load markerless motion file

Open Sample_Markerless.c3d for the markerless data.

  • 3. Run “Model_Landmarks_For_MoS_Markerless” Meta-command
    • Open the pipelines dialog
    • Open the meta commands subfolder
    • select Model_Landmarks_For_MoS_Markerless and run pipeline

For markerless data, we do not need to select a static or model template file, as the model is automatically generated by Visual3D. Once we run the pipeline, the foot landmarks will appear in the workspace (see figure).

Margin Of Stability: Original Definition

At this point in the tutorial, we have loaded our motion files for our sample subject and applied landmarks to the feet that we will use to define BoS.

To derive the MoS as defined in the literature, we will use the following formula:

MoS = BoS -xCoM 

Where BoS is the area defined by the bounds of the feet during ground contact, and xCoM is the extrapolated CoM:

xCoM = CoM + vCoM/sqrt(g/l) [3]

We will first walk through how we define the BoS and XCoM before calculating the MoS. We will only describe bits of the pipelines and underlying meta-commands throughout this tutorial. If you want more detail about the functionality of these commands, the provided .v3m and .v3s files in the tutorial zip are commented to guide you through.

From this point forward, the process is the same for both Markerless and Marker-based data!

Extrapolated Center of Gravity

We begin this process in the pipeline Find_MoS_original.v3s, where we first use the Compute_Model_Based_Data command to find the center of gravity position and velocity of the model over the trial.

!=====================================================================
! 1. Define and Calculate Center of Gravity        
!===================================================================== 
Compute_Model_Based_Data
/RESULT_NAME=COG
/SUBJECT_TAG=ALL_SUBJECTS
/FUNCTION=MODEL_COG
/SEGMENT=
/REFERENCE_SEGMENT=
;
Compute_Model_Based_Data
/RESULT_NAME=COG_VELOCITY
/SUBJECT_TAG=ALL_SUBJECTS
/FUNCTION=MODEL_COG_VELOCITY
/SEGMENT=
/REFERENCE_SEGMENT=
;

The extrapolated center of gravity uses an expression in Visual3D:

Evaluate_Expression
/EXPRESSION=EXTRAPOLATED_COG(CURRENT_SIGNAL,1)
/SIGNAL_TYPES=LINK_MODEL_BASED+LINK_MODEL_BASED
/SIGNAL_FOLDER=ORIGINAL+ORIGINAL
/SIGNAL_NAMES=COG+COG_VELOCITY
! /RESULT_TYPES=DERIVED
/RESULT_FOLDERS=CENTER_OF_GRAVITY
/RESULT_NAME=XCOG
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

Base of Support

The BoS uses the AP and ML bounds of the feet from the landmarks we applied to the model. At each instant in the motion trial, the base of support is defined by four boundaries in single or double stance.

The bounds are defined using Evaluate_Expression through the foot landmarks. An example of setting the ML bounds of the right foot is seen here:

!=====================================================================
! 2. Set Medial/Lateral Bounds of Feet       
!===================================================================== 
!OUTER BOUND RIGHT 
Evaluate_Expression
/EXPRESSION=LANDMARK::ORIGINAL::RT_MET5
/SIGNAL_TYPES=LANDMARK
/SIGNAL_FOLDER=ORIGINAL
!/SIGNAL_NAMES=
/SIGNAL_COMPONENTS=X
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=BOS_ML
/RESULT_NAME=LATERAL_BOUND_RIGHT
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
! INNER BOUND RIGHT
Evaluate_Expression
/EXPRESSION=LANDMARK::ORIGINAL::RT_MET1
/SIGNAL_TYPES=LANDMARK
/SIGNAL_FOLDER=ORIGINAL
!/SIGNAL_NAMES=
/SIGNAL_COMPONENTS=X
 /RESULT_TYPES=DERIVED
 /RESULT_FOLDERS=BOS_ML
 /RESULT_NAME=MEDIAL_BOUND_RIGHT
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

After running the Find_MoS_Original.v3s pipeline, we can explore the derived signal subfolders to see the BoS outcomes. In the BoS_ML for example, we have plotted here the LATERAL_BOUND_LEFT and MEDIAL_BOUND_LEFT over time (x components since x-axis is in the ML direction for the global coordinate system). We have also plotted the XCOM signal x-component from the CENTER_OF_GRAVITY folder. We can see the XCOM crosses over the medial bound of the left foot several times throughout this trial, so we can expect to find some negative MoS values if the XCoM is swaying in and out of the stable boundary. However, we haven’t considered single and double support events to know when these bounds should be considered in our MoS calculations.

To trim our ML and AP bounds to reflect single and double support times, we use two meta-commands called BOS_Bilateral_Single_Support and BOS_Bilateral_Double_Support. Below is an example of calling these meta-commands from the tutorial pipeline:

Single Support:

!======================================================================
! 4. Trim All BoS Values For Single Stance     
!======================================================================  
! Medial/Lateral
BOS_Bilateral_Single_Support
/TYPE=DERIVED
/FOLDER=BOS_ML
/SIGNAL_LEFT=MEDIAL_BOUND_LEFT
/SIGNAL_RIGHT=MEDIAL_BOUND_RIGHT
;

Double Support:

!======================================================================
! 5. Trim BoS Values for Double Stance    
!======================================================================
! Anterior/Posterior
BOS_Bilateral_Double_Support
/TYPE=DERIVED
/FOLDER=BOS_AP
/SIGNAL_LEFT=POSTERIOR_BOUND_LEFT
/SIGNAL_RIGHT=POSTERIOR_BOUND_RIGHT
/SIGNAL_DIRECTION="posterior"
;

Looking now at our BOS_ML derived folder, we can plot the signals: LATERAL_BOUND_LEFT_DS, LATERAL_BOUND_LEFT_SS, MEDIAL_BOUND_LEFT_DS, MEDIAL_BOUND_LEFT_SS, and XCOM. Here we see that the left bounds of the feet are now cut to only have data when the left foot is on the ground. I have also highlighted the events LTO (blue) and LHS (red), which shows that between LTO and LHS, there are no bounds for the left foot.

Margin of Stability

To compute the margin of stability, we simply find the distance of the XCoM position to each bound defining the BoS through the Subtract_Signals command:

Example for MoS double support to the left anterior bound:

!======================================================================
! 7. Calculate Margin of Stability for Double Stance 
!======================================================================
Subtract_Signals
/SIGNAL_TYPES=DERIVED+DERIVED
/SIGNAL_FOLDER=BOS_AP+CENTER_OF_GRAVITY
/SIGNAL_NAMES=ANTERIOR_BOUND_LEFT_DS+XCOG
/RESULT_NAME=ANTERIOR_LEFT_DS
/RESULT_FOLDER=MOS_AP
/COMPONENT_SEQUENCE=Y,Y 
;

If we plot the anterior and posterior MoS of the left and right feet during single and double support, we see the following figure:

This is a cluttered plot with 8 different signals, so we have written a meta-command to return the smallest MoS (distance to closest boundary) between the AP and ML bounds at each frame. Typically, MoS is reported as a single value as the distance of the XCoM to the closest bound. For example, in this following command we are feeding in the anterior left and posterior right bounds that define the AP BoS during the event sequence RDOUBLE, to the meta-command called Closest_Bound.v3m. This will take the smallest MoS between the two signals at each frame of the sequence.

!==================== RDOUBLE CONDITION =========================
Conditional_Statement
/ITERATION_PARAMETER_NAME=3
/EXPRESSION="&::seq&" == "RDOUBLE";
;
Closest_Bound 
/FRAMES=::frame_ind
/SIG1=ANTERIOR_LEFT_DS
/SIG2=POSTERIOR_RIGHT_DS 
/SEQUENCE=LSINGLE+RSINGLE+LDOUBLE
/DIRECTION=AP
;
Closest_Bound 
/FRAMES=::frame_ind
/SIG1=LATERAL_RIGHT_DS
/SIG2=LATERAL_LEFT_DS 
/SEQUENCE=LSINGLE+RSINGLE+LDOUBLE
/DIRECTION=ML
;
Conditional_Statement_End
/ITERATION_PARAMETER_NAME=3
;

The following plot in the MoS output shows the final AP MoS values for the original interpretation. However, by just looking at single values at each point throughout the trial, which is typically shown in the literature, we don’t know the direction of instability. We know that a negative MoS is considered “unstable”, but we don’t know if they are in front or behind the BoS, or on either side in the ML direction. We propose a new way to define the MoS to improve the classification of stability and provide the direction, which we will show in the following sections of this tutorial.

Margin Of Stability: New Definition

This section will use the pipeline: Find_MoS_New.v3s This pipeline builds off of the previous section. You must run Find_MoS_Original.v3s first!

We took a slightly different approach to defining the MoS in this second pipeline. Here we build a polygon with four vertices based on the foot landmarks, which lies on the ground plane as our BoS area. We then projected the XCoM in the direction of gravity onto the ground to determine if the XCoM lies within the BoS (stable) or not (unstable).

NEW MoS Definition: Here we consider a new convention for the MoS values that provide more information about where the XCoM lies relative to the BoS. If the XCoM is within the polygon, we set the MoS to 0 and say this is STABLE. If the XCoM is beyond the BoS anteriorly or to the right, the MoS is a POSITIVE value. If the XCoM is beyond the BoS posteriorly or to the left, the MoS is a NEGATIVE value.

Projected XCoM

To project the XCoM onto the ground plane, we first found the direction of gravity for the current .c3d file:

!============================================================================
!   1. Project XCoM onto ground plane, here we find the direction of gravity first
!============================================================================
! Find direction of gravity
Evaluate_Expression
/EXPRESSION=Gravity()
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
 /RESULT_TYPES=DERIVED
 /RESULT_FOLDERS=CENTER_OF_GRAVITY
 /RESULT_NAME=GRAVITY_VECTOR
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

We then found the unit vector and projected the XCoM:

Evaluate_Expression
/EXPRESSION=Project_Point_On_Plane(DERIVED::CENTER_OF_GRAVITY::GRAVITY_UNIT_VECTOR,DERIVED::CENTER_OF_GRAVITY::XCOG)
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
 /RESULT_TYPES=DERIVED
 /RESULT_FOLDERS=CENTER_OF_GRAVITY
 /RESULT_NAME=XCOM_Projected
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

Base of Support

The BoS was defined using vertices with foot landmarks. Here we show the left foot vertices as an example:

! ==== Make Vertices for LEFT foot ============
Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=LV1
/METRIC_VALUE=VECTOR(LANDMARK::ORIGINAL::LT_MET1::X,LANDMARK::ORIGINAL::LTOES_DISTAL::Y,0)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=LV2
/METRIC_VALUE=VECTOR(LANDMARK::ORIGINAL::LT_MET5::X,LANDMARK::ORIGINAL::LTOES_DISTAL::Y,0)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=LV3
/METRIC_VALUE=VECTOR(LANDMARK::ORIGINAL::LT_MET5::X,LANDMARK::ORIGINAL::LT_HEEL::Y,0)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=LV4
/METRIC_VALUE=VECTOR(LANDMARK::ORIGINAL::LT_MET1::X,LANDMARK::ORIGINAL::LT_HEEL::Y,0)
;

Margin of Stability

To re-define the MoS with the new convention, we used the following procedure. Main pipeline:

  • Define BoS vertices for current event sequence
  • Determine if the projected XCoM lands within BoS polygon

Meta-command (Is_In_Bounds.v3m):

  • If is inside polygon (returned value of 1), set the MoS to 0 for that frame
  • If not inside polygon (returned value of 0), look at BoS bounds and find where the XCoM is closest to
  • Set MoS to closest bound outside the BoS
  • If anterior or to the right of the BoS, make MoS a positive value
  • If posterior or to the left of the BoS, make MoS a negative value

An example of following this process for the RSINGLE event sequence:

!======================== RSINGLE CONDITION============================
! Conditional for RSINGLE - use correct vertices from listed earlier
Conditional_Statement
/ITERATION_PARAMETER_NAME=1
/EXPRESSION="&::seq&" == "RSINGLE";
;
! Is XCoM in polygon?
Evaluate_Expression
/EXPRESSION=Is_Point_Inside_Polygon(DERIVED::CENTER_OF_GRAVITY::XCOM_PROJECTED,METRIC::VERTEX::RV1,METRIC::VERTEX::RV2,METRIC::VERTEX::RV3,METRIC::VERTEX::RV4)
/RESULT_TYPES=DERIVED
/RESULT_FOLDER=MOS_NEW
/RESULT_NAME=INSIDE_RSINGLE
;
!AP
Is_In_Bounds
/XCOM=DERIVED::CENTER_OF_GRAVITY::XCOM_PROJECTED
/UPPER_BOUND=ANTERIOR_RIGHT_SS
/LOWER_BOUND=POSTERIOR_RIGHT_SS 
/FRAMES=::frame_ind
/SIG=INSIDE_RSINGLE
/SEQUENCE=RDOUBLE+LSINGLE+LDOUBLE
/DIRECTION=AP
;
!ML
Is_In_Bounds
/XCOM=DERIVED::CENTER_OF_GRAVITY::XCOM_PROJECTED
/UPPER_BOUND=LATERAL_RIGHT_SS
/LOWER_BOUND=MEDIAL_RIGHT_SS 
/FRAMES=::frame_ind
/SIG=INSIDE_RSINGLE
/SEQUENCE=RDOUBLE+LSINGLE+LDOUBLE
/DIRECTION=ML
;

After running the Find_MoS_New.v3s pipeline, we can plot the DERIVED::MOS_ORIGINAL::MOS_AP, and DERIVED::MOS_NEW::MOS_AP for comparison. Here we can see that any time the original signal was positive/”stable”, it is now 0 in the new signal. When the subject’s XCoM is anterior of the AP BoS, the MoS is positive, and is negative when the XCoM is posterior of the AP BoS.

Further MoS Analysis

In the MOS_NEW derived folder, you will see several normalized signals for each left or right stride of the selected walking trial. This was done to plot several strides on top of eachother. Here we only have a few strides, but analyzing these MoS signals normalized between heel strikes may be a more useful way to assess a subject's stability. If we consider that the MoS is being classified as ‘unstable’ for the majority of the stride, but we know the subject walked normally and did not fall, we might be able to detect moments of actual instability through outlier MoS strides.

Inspect3D

Time normalization can also be applied to data in Inspect3D when groups are defined between event labels. Here we show an example of the MoS output plotted for the AP and ML directions of one subject with 8 walking trials. To learn how to load workspaces, define groups, and create figures in Inspect3D, see **here**.

References

[1] Watson, F. et al. (2021). Use of the margin of stability to quantify stability in pathologic gait – a qualitative systematic review. BMC musculoskeletal disorders, 22 (1). doi:10.1186/s12891-021-04466-4

[2] Dingwell, J. B., Cusumano, J. P., Cavanagh, P. R., & Sternad, D. (2001). Local dynamic stability versus kinematic variability of continuous overground and treadmill walking. Journal of biomechanical engineering, 123(1), 27–32. https://doi.org/10.1115/1.1336798

[3] Hof, A. L., Gazendam, M. G., & Sinke, W. E. (2005). The condition for dynamic stability. Journal of biomechanics, 38(1), 1–8. https://doi.org/10.1016/j.jbiomech.2004.03.025

visual3d/tutorials/knowledge_discovery/assesing_stability_during_gait.txt · Last modified: 2024/11/15 14:14 by wikisysop