This repo contains the data, models and Python codes to reproduce the results of the following publication:
@article{Bicer2022fmaxiso,
title={Altering the Strength of the Muscles Crossing the Lower Limb Joints Only Affects Knee Joint Reaction Forces},
author={Metin Bicer, Andrew TM Phillips, Luca Modenese},
journal={Gait & Posture},
volume = {95},
pages = {210-216},
doi = {https://doi.org/10.1016/j.gaitpost.2022.03.020},
year={2022},
keywords = {Maximum isometric force, Musculoskeletal modelling, Joint reaction force, Total knee joint replacement, Walking}
}
The paper is available open access at this link.
In the manuscript:
-
We investigated effects of the strength alterations of the muscles crossing the hip, knee or ankle joints on the joint reaction forces.
-
In vivo measurements of the knee joint reaction forces (5 Grand Challenge Competition to Predict In Vivo Knee Loads) were used to assess our simulation results and select the most accurate model.
-
We found that the most accurate model was the one with 40% weakness in knee-crossing muscles, which represented the weakness of the subject with total knee replacement.
-
Modifying the strength of muscles crossing each lower limb joint mostly alters the estimated joint reaction force at the knee joint, and not at the hip and ankle.
-
The knee joint reaction force decreases with reducing the strength of muscles crossing the knee or ankle joints, while it increases when reducing the strength of hip-crossing muscles.
To reproduce the results,
-
download OpenSim 3.3
-
have Python installed, preferably Anaconda
-
create and activate a virtual environment with Python 2
either
conda create --name osim3 python=2.7 conda activate osim3 conda install numpy scipy pandas matplotlib scikit-learn
or
conda env create -f environment.yml conda activate osim3
-
setup OpenSim API (please refer to OpenSim documentation). In the Anaconda Command Prompt, navigate to OpenSim installation folder and run the python script,
cd OPENSIM_INSTALLATION_FOLDER\sdk\python python setup.py install
-
clone the repository using the following command on git and change directory to
fmax_iso_sensitivity
folder,git clone https://github.com/metinbicer/fmax_iso_sensitivity.git cd fmax_iso_sensitivity
Note: To use different Python version, you may need to build the OpenSim API from scratch. Further information can be found from the documentation.
The following scripts are used to reproduce the results
Script name | Script action | Related item in the manuscript |
---|---|---|
main.py |
reproduces the entire work with the user-defined parameters (subject's BW, unmodified scaled model, modified model names, modified joint names, % changes applied to the joint strengths, names of the gait trials. Imports certain functions from the following scripts | N/A |
createModels.py |
creates models with different joint strengths. createModels() is imported by main.py |
N/A |
analysis.py |
batch processes using inverse dynamics, static optimization and joint reaction analysis. runAnalysis() is imported by main.py |
N/A |
utils.py |
utility functions to process, save and load the results of all simulations. saveModelResults() , loadModelResults() and loadExpJRF() are imported by main.py to save and load all simulation results and in-vivo joint loads |
N/A |
plot.py |
plots results (joint reactions, muscle activations and forces) obtained from simulations with models having different joint strength. In-vivo joint loads can be included. plotTrial() and meanPeakDeviationPlot() is imported by main.py |
plotTrial() -> Figures 1&2, meanPeakDeviationPlot() -> Figure 3 |
compareResults.py |
calculates metrics to compare simulation results from modified models to those obtained using the nominal model or all simulation results to in-vivo joint loads. compare() is imported by main.py |
Tables 1 and 2 |
- In the command prompt, type
python main.py
,- runs inverse dynamics, static optimization and joint reaction analysis for all the data and models.
- saves joint reaction forces, muscle forces and activations to
JRF.pkl
,SO.pkl
andACT.pkl
for all valid simulations - loads the files saved in step 2, and
eTibia_data.mat
that contains in-vivo knee reaction loads - plots joint reaction forces for each trial in a separate figure, muscle forces and activations for a trial
- creates tables comparing simulation results to in-vio loadings, and modified model outputs to nominal results
- If you only want to analyse the previous analyses (saved to
JRF.pkl
), you need to comment out the following lines.
L33:createModels(modelFileName, groupNames, changeAmounts)
L35:runAnalysis(modelFileName, trials)
L38:JRF, SO, ACT = saveModelResults(trials, BW)
Then, typepython main.py
in the command window.