Code to create a symmetric OpenSim model based a model of one side.
- Made and tested with OpenSim 4.3 - 4.5
- Requires helper functions that are included in the code to mirror muscles.
-
Prepare OpenSim model
Make sure the names of all bodies, wrapping objects, geometries, joints, coordinates muscles, and pathpoints that belong to the left or right side have an appropriate suffix or prefix. By default, these are:
'_l','_L','_left','_Left','l_','L_','left_','Left_'and'_r','_R','_right','_Right','r_','R_','right_','Right_'. Seehelp mirrorNameon how you can modify the code to use different options. -
Run MirrorBodies
This script mirrors the bodies, joints and coordinates. It also links to geometry files with a name referring to the mirrored side, but you have to provide theses files yourself (Use e.g. meshlab to mirror existing files). Set
useStandard = '';if you want left and right body frames to have the same global orientation. SetuseStandard = 'archosaur';to use the standard proposed by Gatesy SM, Manafzadeh AR, Bishop PJ, Turner ML, Kambic RE, Cuff AR, et al. A proposed standard for quantifying 3-D hindlimb joint poses in living and extinct archosaurs. Journal of Anatomy. 2022;241(1):101–18. -
Run MirrorMuscles_Osim4_global.m
This script mirrors the muscles, wrapping objects, and path points. The current version only supports mirroring from left to right, and only supports muscles of the type Millard2012EquilibriumMuscle.