Giter VIP home page Giter VIP logo

modenaxe / muscleparamoptimizer Goto Github PK

View Code? Open in Web Editor NEW
18.0 6.0 7.0 6.1 MB

Scripts and models to optimize musculotendon parameters in musculoskeletal models.

Home Page: https://simtk.org/projects/opt_muscle_par

License: Apache License 2.0

MATLAB 78.84% Python 21.16%
biomechanics optimization-technique musculotendon-parameters matlab opensim muscle-parameters muscle scientific-publications scientific-research bioengineering

muscleparamoptimizer's Introduction

Introduction

This repository contains a MATLAB package implementing an algorithm for optimizing the parameters of Hill-type muscle models defined by adimensional force-lenght-velocity curves, as described by Zajac (1989).

The algorithm is generic but the implementation is specific for musculoskeletal models of the software for biomechanical analyses OpenSim.

The repository is made available as accompanying material of this publication:

@article{modenese2016estimation,
  title={Estimation of musculotendon parameters for scaled and subject specific musculoskeletal models using an optimization technique},
  author={Modenese, Luca and Ceseracciu, Elena and Reggiani, Monica and Lloyd, David G},
  journal={Journal of biomechanics},
  volume={49},
  number={2},
  pages={141--148},
  year={2016},
  publisher={Elsevier}
}

and includes scripts, models and materials to reproduce figures and results of that work.

Requirements

In order to use this MATLAB package it is necessary to:

  • install MATLAB with the Optimization Toolbox
  • install OpenSim 3.2 or higher
  • setup the OpenSim API (Application User Interface) for MATLAB as described at this link.

Contents from the paper

Algorithm description

The algorithm starts from an existing model in which the muscle parameters, and the derived muscle dynamics, are assumed to be accurate. These models, known as generic models and here referred to as Reference Models, are generally created from cadaveric measurements.

The idea consists in mapping the normalized muscle contractile conditions from these reference models to those of personalised models, i.e. linearly scaled or fully subject-specific, for the same joint angles and muscle activation levels. In this respect, the algorithm is a generalization of method proposed by Winby et al. (2008) for the knee-spanning muscles.

Considered Cases

  • Scaled generic model: a lower limb model was scaled linearly to the size of an individual to perform a running simulation as published by Hamner et al. (2010). The muscle parameters of the obtained model were then optimized non-linearly using the original generic model as reference model.
  • Subject-specific model: a model of the lower limb was built from scratch using the LHDL cadaveric dataset and its muscle parameters were estimated and validated using the lower limb model of Arnold et al. (2010) as reference model.

Versions of the tool

MATLAB version

A MATLAB version of the tool MATLAB tool is available in the corresponding folder, together with an example of use. The same main script can be easily adapted for the optimization of other personalized models.

For the MATLAB version, there is a manuscript folder including all the scripts and models from the publication. Following the alphabetic order of the scripts, it is possible to:

  • reproduce exactly the results presented in the associated publication in the manuscript (scripts a and b)
  • generate the associated Figures (scripts c-d-e).

Please note that reproducing the sensitivity study can be time-consuming, depending on the available computational resources.

Python tool (currently under revision)

A Python version of the tool has been written and kindly shared by @eravera. It is currently under assessment although tested and working.

OpenSim C++ plugin and User Interface Menu

A generic tool to optimize musculotendon parameters in musculoskeletal models is also available at this repository as:

  • C++ OpenSim plugin
  • as menu extension of the OpenSim GUI (graphical user interface). Please refer directly to the repository and to the nice documentation available at this website.

Contributors

Special thanks to:

  • Bryce Killen from KU Leuven, Belgium, for updating the code for OpenSim 4.1!
  • Emiliano Ravera from Instituto de Investigación y Desarrollo en Bioingenieria y Bioinformática, IBB (CONICET-UNER), Argentina.

References

  • Zajac, F.E. Muscle and tendon: properties, models, scaling, and application to biomechanics and motor control. Critical Reviews in Biomedical Engineering. 17: 359-411, 1989. LINK
  • Winby, C.R., Lloyd, D.G. Kirk, T.B. Evaluation of different analytical methods for subject-specific scaling of musculotendon parameters. Journal of Biomechanics. 41: 1682-1688, 2008. LINK
  • Hamner, S.R., Seth, A. Delp, S.L. Muscle contributions to propulsion and support during running. Journal of Biomechanics. 43: 2709-2716, 2010. LINK
  • Arnold, E., Ward, S., Lieber, R. Delp, S. A Model of the Lower Limb for Analysis of Human Movement. Annals of Biomedical Engineering. 38: 269-279, 2010. LINK

muscleparamoptimizer's People

Contributors

bkillen05 avatar eravera avatar modenaxe avatar mrrezaie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

muscleparamoptimizer's Issues

organise proper test cases

I think this would help maintaining the functionalities

  • organise the existing examples from the paper as test cases.
  • include the initial test (self-mapping) to ensure correct implementation.

[Suggestion] for reducing the time of computation

Hi,

Thanks for providing this great toolbox. Given that this may take ~3 hours for every subject, I have a suggestion to reduce this time by 50%. I see that this function, sampleMuscleQuantities.m is the most time consuming one. Lots of users may use generic models as reference, e.g. modified Rajagopal model in my case. My suggestion is to store the sample muscle quantities of the reference model once forever and use it for each subject.
First, collate the sample quantities of all muscles into one struct using Mus_ref_all.(curr_mus_name) = sampleMuscleQuantities(osimModel_ref,curr_mus,'all',N_eval); instaed of the following line of code and save the Mus_ref_all variable as a MAT file. Then, load the file before the loop and use Mus_ref = Mus_ref_all.(curr_mus_name); instead of:

Mus_ref = sampleMuscleQuantities(osimModel_ref,curr_mus,'all',N_eval);

The good point is that this file is readable in Python as well. Here is an example (N_eval=5):
Rajagopal2015_passiveCal_hipAbdMoved.zip

Best - Mohammadreza

getJointsSpannedByMuscle crashes if a muscle crosses branches on the model topology tree

Thanks for the tool! This optimizer has been great for my simulations. I've bumped into a rare bug that I thought I'd share: if you are using this tool on a model that has muscles whose origin and insertion points are on different branches of the model topology tree, the tool crashes.

I ran into this when scaling the Arnold2010 model which has an (inactive) "dummy muscle" representing the patellar tendon, but another common instance where this error would crop up is in models where the psoas inserts on the femur and originates on the torso.

The error occurs because of the way getJointsSpannedByMuscle() seeks out the joints that a muscle spans. To do this, it starts at the body of the most distal PathPoint, then "climbs" the model topology tree going body-to-joint-to-body until it reaches the body with the most proximal PathPoint. This works fine for almost all cases, but if the origin point of a muscle is on a different branch of the topology tree, the function will never reach that body: it will just keep going, from femur to pelvis to ground and then crashing, since no joint exists above the ground. I can't think of any easy fixes, other than an exhaustive search of every branch of the model tree to find the right path from insertion to origin.

I've attached a zip file with a reproducible example showing a case with a simple model that works (psoas_r muscle goes from the femur to the pelvis) and a model that causes the crash (the same model but the psoas_r attaches on the torso). The figure below illustrates the difference between these models.

This is not a pressing issue for me—since I'm only using a dummy muscle to get the patellar tendon's line of action, I can just tweak the code to skip this muscle entirely. However other users might run into this same issue for full-body models incorporating a psoas muscle and possibly some other rare cases.

Hopefully this info proves useful!

MuscleParOpt_crash_reprex.zip

Upgrade to OpenSim 4.1

TO DO

  • verify if there are incompatibilities, e.g. due to different model structure
  • upgrade verified by test check

lxml vulnerability issue

Hi @eravera, apparently one of the packages in the python version has a vulnerability (see security tab of the repository).

Do you think it's ok to update lxml to:

lxml>=4.6.5 

in the requirements?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.