Journal of NeuroEngineering and RehabilitationBioengineeringPeer-reviewed journal article
The Neuromusculoskeletal Modeling Pipeline: MATLAB-based Model Personalization and Treatment Optimization Functionality for OpenSim
Claire V. HammondiD, S.T. Williams, Marleny M. Vega, Di AoiD, G. Li, Robert M. Salati, Kayla M. Pariser, Mohammad Sharif ShourijehiD, A.W. Habib, Carolynn PatteniD, Benjamin Jon FreglyiD
Abstract
Neuromusculoskeletal injuries including osteoarthritis, stroke, spinal cord injury, and traumatic brain injury affect roughly 19% of the U.S. adult population. Standardized interventions have produced suboptimal functional outcomes due to the unique treatment needs of each patient. Strides have been made to utilize computational models to develop personalized treatments, but researchers and clinicians have yet to cross the "valley of death" between fundamental research and clinical usefulness. This article introduces the Neuromusculoskeletal Modeling (NMSM) Pipeline, two MATLAB-based toolsets that add Model Personalization and Treatment Optimization functionality to OpenSim. The two toolsets facilitate computational design of individualized treatments for neuromusculoskeletal impairments through the use of personalized neuromusculoskeletal models and predictive simulation. The Model Personalization toolset contains four tools for personalizing 1) joint structure models, 2) muscle-tendon models, 3) neural control models, and 4) foot-ground contact models. The Treatment Optimization toolset contains three tools for predicting and optimizing a patients functional outcome for different treatment options using a patients personalized neuromusculoskeletal model with direct collocation optimal control methods. Support for user-defined cost functions and model modification functions facilitate simulation of a vast number of possible treatments. An NMSM Pipeline use case is presented for an individual post-stroke with impaired walking function, where the goal was to predict how the subjects neural control could be changed to improve walking speed without increasing metabolic cost. First the Model Personalization toolset was used to develop a personalized neuromusculoskeletal model of the subject starting from a generic OpenSim full- body model and experimental walking data (video motion capture, ground reaction, and electromyography) collected from the subject at his self-selected speed. Next the Treatment Optimization toolset was used with the personalized model to predict how the subject could recruit existing muscle synergies more effectively to reduce muscle activation disparities between the paretic and non-paretic legs. The software predicted that the subject could increase his walking speed by 60% without increasing his metabolic cost per unit time by modifying existing muscle synergy recruitment. This hypothetical treatment demonstrates how NMSM Pipeline tools could allow researchers working collaboratively with clinicians to develop personalized neuromusculoskeletal models of individual patients and to perform predictive simulations for the purpose of designing personalized treatments that maximize a patients post-treatment functional outcome.
- organism: human
- research focus: software / tool
- research focus: cell type annotation
- approach: simulation
- approach: matrix factorization
- approach: experimental assay
In-depth summary
Claude Opus 5.5 · xhigh effort · 8 Nov 2026 · from the full text of version 3 (28 Feb 2025) · CC BY 4.0
MATLAB toolsets add joint, muscle, synergy, and foot-contact personalization and optimal-control treatment design to OpenSim; one post-stroke case predicted 60% faster walking at equal metabolic cost.
Designing treatments for individual patients with movement impairments needs subject-specific neuromusculoskeletal models and repeatable predictive simulation. OpenSim and Moco cannot personalize models, and existing tools such as SimCP do not combine personalization of several model parts with predictive treatment design; the Neuromusculoskeletal Modeling (NMSM) Pipeline supplies both in an XML-configured MATLAB framework that works with OpenSim.
Key results
SuggestedDesign Optimization predicted that rebalancing four asymmetric synergy-activation pairs (raising weak paretic, lowering strong non-paretic) would let the subject walk at 0.8 m/s with a metabolic cost per unit time matching his 0.5 m/s level, a 60% speed gain.
With final time fixed to the 0.8 m/s gait cycle, DO cut metabolic cost per unit time by 9.9% against a 10% reduction target (the 0.5 m/s value is 90% of the 0.8 m/s value). It also closely matched the peak amplitudes of the four modified synergy pairs. The run took 489 IPOPT iterations and about 730 min of CPU time. · 4.4 Treatment Optimization Process; 4.1 Treatment Design Rationale
ShownJoint, muscle-tendon, and neural control personalization of a scaled RCNL2023 full-body model reproduced the stroke subject's marker, inverse dynamics, and EMG-derived activation data with small remaining errors.
Joint tool (JMP): thigh, shank, and foot marker distance errors fell by 48.4% (about 90 min CPU). Muscle-tendon tool (MTP): average moment RMS error 3.5 Nm left leg, 2.1 Nm right leg (about 30 min). Synergy tool (NCP), six synergies with the bilateral synergy-vector symmetry option on: moment RMSE 2.2 Nm, activation RMSE 0.034 (about 3 h). · 4.3 Model Personalization Process
ShownGround contact personalization fitted a non-uniform spring-stiffness distribution on a 5 by 11 elastic-foundation grid under a two-segment foot. It reproduced ground reaction forces and moments while allowing small foot kinematic deviations.
RMSE was 4.6 N for ground reaction forces, 2.1 Nm for ground reaction moments, 6.4 mm for foot positions, and 1.7 degrees for foot orientations. The fit used three sequential tasks, with viscous friction as a design variable and dynamic friction turned off; about 4 h CPU. · 4.3 Model Personalization Process; 3.1.4 Ground Contact Model Personalization
ShownTracking Optimization (TO) produced a dynamically consistent full-body 0.8 m/s gait simulation (synergy-controlled lower body, torque-controlled upper body); Verification Optimization (VO) reproduced it by tracking only controls and upper-body joint positions, confirming the formulation.
TO average RMSE versus experiment: joint angles 2.1 degrees, moments 5.1 Nm, ground reaction forces 25.3 N, ground reaction moments 4.0 Nm, activations 0.038 (305 IPOPT iterations, about 770 min CPU). VO versus TO: 0.1 deg, 0.1 Nm, 0.7 N, 0.1 Nm, 0.01 (101 iterations, about 170 min). · 4.4 Treatment Optimization Process; 3.2.2 Verification Optimization
ShownDesign Optimization accepts user-written MATLAB cost terms and model modification functions linked to GPOPS-II static parameters. These let users simulate changes to bone geometry, muscle properties, synergies, contact parameters, or device control.
Both features were used in the stroke case. A custom cost term rewarded similar amplitudes between the weak and strong activations in each synergy pair, and one user-defined static parameter per pair (four in total) scaled the strong-side activation. Built-in DO terms set targets for braking and propulsive impulse, metabolic cost, whole-body angular momentum, and joint energy. · 3.2.3 Design Optimization; 4.4 Treatment Optimization Process
Methods, data and reproducibility
Model Personalization calibrates OpenSim joint, Hill-type muscle-tendon, synergy, and elastic-foundation foot-contact parameters from marker, ground reaction, and EMG data using MATLAB gradient-based optimizers (lsqnonlin, fmincon); Treatment Optimization chains tracking, verification, and design direct-collocation problems solved with GPOPS-II and IPOPT.
- Previously published treadmill walking data (Meyer et al. 2016) from a high-functioning chronic hemiparetic stroke survivor: full-body marker motion capture and split-belt ground reactions · human · n = one subject (male, 79 years, right hemiparesis)
- Surface and fine-wire EMG recorded from both legs, including deep muscles such as iliopsoas and tibialis posterior · human · n = 16 muscles per leg
- Analyzed gait cycles: the single most periodic cycle at self-selected (0.5 m/s) and fastest comfortable (0.8 m/s) speeds, resampled to 101 time points · human · n = one cycle per speed
- RCNL2023 full-body OpenSim model, a modified Rajagopal model with altered ankle and knee kinematics, distributed with the software · human (generic musculoskeletal model)
- Methods & tools
- OpenSim (Scale, Inverse Kinematics, Inverse Dynamics, Muscle Analysis tools), MATLAB optimization (lsqnonlin, fmincon), GPOPS-II direct collocation optimal control software, IPOPT, OpenSim MATLAB API with C++ Mex files, Synergy Extrapolation (SynX), Non-negative matrix factorization and principal component analysis (muscle synergies), Hill-type rigid-tendon muscle-tendon model, Elastic foundation foot-ground contact model, Vicon motion capture; Bertec split-belt instrumented treadmill, Motion Lab Systems EMG, OpenSim Moco (qualitative comparison)
- Data & accessions
- https://simtk.org/projects/nmsm
- Software & environment
- MATLAB version 2023a or higher on Windows or MacOS; Treatment Optimization requires the commercial GPOPS-II with IPOPT; built on OpenSim through its MATLAB API; Apache 2.0 license.
- Assay conditions & compute
- Dell PC workstation with 48 cores; CPU time about 90 min (JMP), 30 min (MTP), 3 h (NCP), 4 h (GCP), 770 min (TO), 170 min (VO), 730 min (DO).
- Reproducibility gaps
- Needs commercial MATLAB and GPOPS-II licenses (academic discounts noted); the archived-version field is blank; per-joint results sit in Tables 1 to 6 and supplementary material whose values are not in the text.
Limitations (6)
- Personalization quality depends on the quality and amount of experimental data, and it is currently hard to collect every input needed to run all seven tools with a synergy-driven model. · stated by the authors
- Gradient-based Model Personalization can get trapped in local minima, and the synergy tool and Treatment Optimization work on muscle activations rather than excitations. · stated by the authors
- Calling OpenSim through its MATLAB API rules out automatic differentiation and is inherently slow; Moco is generally faster and free, whereas MATLAB and GPOPS-II are commercial. · stated by the authors
- The software cannot personalize bone shape from imaging and has no muscle fatigue model. The muscle-tendon tool assumes rigid tendons and the ground contact tool supports only a two-segment foot; extending to fast movements and more detailed foot mechanics is left to future work. · stated by the authors
- Predicted post-treatment function is not validated. It is unknown how a treatment changes model parameters and neural control, and post-intervention data are needed for each clinical application before clinical use. · stated by the authors
- The 60% speed prediction rests on one subject, one gait cycle per speed, a model-estimated metabolic cost, and the assumption that synergy vectors are the same in both legs. All fits are in-sample, with no accuracy or runtime benchmark against Moco or SimCP. · noted in this summary
Read this if you build OpenSim models and want MATLAB tools to personalize joint, muscle, synergy, and foot-contact parameters from gait data and run predictive treatment-design simulations.
- Citations
- 18
- FWCI
- 4.11
- Field percentile
- top 5%
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- Reproducible Research: Computational Design of Personalized Clinical Treatments for Walking Impairments Caused by Knee Osteoarthritis and Stroke
Robert M. Salati, Geng Li, … Benjamin Jon Fregly·bioRxiv·Sep 14, 2026
- Musculoskeletal Model Personalization Affects Metabolic Cost Estimates for Walking
M. Arones, M. S. Shourijeh, … B. J. Fregly·bioRxiv·Aug 5, 2020
- Synergy-based Feedforward with Minimal Feedback Control Predicts Walking Over Multiple Cycles
Spencer T. Williams, Geng Li, Benjamin Jon Fregly·Frontiers in Bioengineering and BiotechnologyPeer-reviewed·Aug 3, 2026
- Physics-based predictive simulations to explore the differential effects of motor control and musculoskeletal deficits on gait dysfunction in cerebral palsy: a retrospective case study
A. Falisse, L. Pitto, … I. Jonkers·bioRxiv·Sep 14, 2019
- Can predictive simulations of walker-assisted gait using calibrated muscle models capture subject-specific walking features in individuals with spinal cord injury?
Filippo Maceratesi, Carlos Pagès Sanchis, … Míriam Febrer-Nafría·Mechanism and Machine TheoryPeer-reviewed·Apr 3, 2026
- An approximate stochastic optimal control framework to simulate nonlinear neuromusculoskeletal models in the presence of noise
Tom Van Wouwe, Lena H. Ting, Friedl De Groote·PLoS Computational BiologyPeer-reviewed·Jun 8, 2022