Hi,
To 'validate' the muscle forces determined with static optimization, I would like to compare the length changes of the muscle fiber as estimated by static optimization to the muscle fascicle length changes I measured using B-mode ultrasound.
When I use the muscle analysis tool the fiber lengths do not make sense at all as it does not change at all (note I checked compute joint moments to on in the tool). In contrast, MTU length does change as expected. Therefore, I was wondering how I can get the muscle fiber lengths used in static optimization?
Does this for example require me to perform static optimization with the analysis tool?
Get muscle fiber lenghts used in static optimization
- Bas Van Hooren
- Posts: 30
- Joined: Fri Jan 29, 2016 10:59 am
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Get muscle fiber lenghts used in static optimization
Hi,
What type of contraction or movement are you trying to make this comparison for? For example, do you have data from an isometric contraction in a dynamometer vs something more dynamic like walking?
Most static optimization routines will have the tendon as rigid and then simply, based on the objective function, provide activations of the muscles to get the desired muscles forces to match the moment you provided for the static optimization. Maybe you could consider a different method that you simulate the muscle fiber length changes with a given activation and a compliant tendon?
Maybe you knew a lot of that information anyway, but if not, I hope it is helpful!
Mike
What type of contraction or movement are you trying to make this comparison for? For example, do you have data from an isometric contraction in a dynamometer vs something more dynamic like walking?
Most static optimization routines will have the tendon as rigid and then simply, based on the objective function, provide activations of the muscles to get the desired muscles forces to match the moment you provided for the static optimization. Maybe you could consider a different method that you simulate the muscle fiber length changes with a given activation and a compliant tendon?
Maybe you knew a lot of that information anyway, but if not, I hope it is helpful!
Mike
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Get muscle fiber lenghts used in static optimization
Hi Bas,
There are a couple of options. You can run muscle analysis in the analyze tool. However, you might not get very nice results (constant or strange values for fiber velocity) if you use the kinematics as an input. For proper calculation of fiber length one must also consider the muscle excitation if the muscle has a tendon. There are two ways to obtain these things from OpenSim:
1) Run CMC and append a MuscleAnalysis in the AnalysisSet of the setup xml file (or perform MA using the state obtained from CMC). This is a very slow operation and you will get discontinuities in the fiber velocity of the muscle. However, you will take into account the tendon.
2) If you use Millard muscles, then you can disable the tendon (rigid tendon assumption). If you do this, fiber length and velocities are calculated without numerical integration but through the MTU length. This means, that you can perform SO and MA together through the analyze tool. The results will be very smooth compared to CMC and analysis execute fast. I have been using this approach and for me it works fine. If your model does not contain Millard muscles, then you can run SO with the original model and then create another model where you will substitute the muscles so that you can perform the analysis. (please find a script for doing this below)
In the muscle analysis you have to substitute the force set using the one generated by the above function (Python).
I have found that for gait if you assume a rigid tendon you will not get very different results compared to CMC. However, do not take my world for it and try to compare the two approaches to be sure.
Dimitar
There are a couple of options. You can run muscle analysis in the analyze tool. However, you might not get very nice results (constant or strange values for fiber velocity) if you use the kinematics as an input. For proper calculation of fiber length one must also consider the muscle excitation if the muscle has a tendon. There are two ways to obtain these things from OpenSim:
1) Run CMC and append a MuscleAnalysis in the AnalysisSet of the setup xml file (or perform MA using the state obtained from CMC). This is a very slow operation and you will get discontinuities in the fiber velocity of the muscle. However, you will take into account the tendon.
2) If you use Millard muscles, then you can disable the tendon (rigid tendon assumption). If you do this, fiber length and velocities are calculated without numerical integration but through the MTU length. This means, that you can perform SO and MA together through the analyze tool. The results will be very smooth compared to CMC and analysis execute fast. I have been using this approach and for me it works fine. If your model does not contain Millard muscles, then you can run SO with the original model and then create another model where you will substitute the muscles so that you can perform the analysis. (please find a script for doing this below)
Code: Select all
def replace_thelen_muscles_with_millard(model_file, target_folder):
"""Replaces Thelen muscles with Millard muscles so that we can disable
tendon compliance and perform MuscleAnalysis to compute normalized
fiber length/velocity without spikes.
"""
model = opensim.Model(model_file)
new_force_set = opensim.ForceSet()
force_set = model.getForceSet()
for i in range(force_set.getSize()):
force = force_set.get(i)
muscle = opensim.Muscle.safeDownCast(force)
millard_muscle = opensim.Millard2012EquilibriumMuscle.safeDownCast(
force)
thelen_muscle = opensim.Thelen2003Muscle.safeDownCast(force)
if muscle is None:
new_force_set.adoptAndAppend(force.clone())
elif millard_muscle is not None:
millard_muscle = millard_muscle.clone()
millard_muscle.set_ignore_tendon_compliance(True)
new_force_set.adoptAndAppend(millard_muscle)
elif thelen_muscle is not None:
millard_muscle = opensim.Millard2012EquilibriumMuscle()
# properties
millard_muscle.set_default_activation(
thelen_muscle.getDefaultActivation())
millard_muscle.set_activation_time_constant(
thelen_muscle.get_activation_time_constant())
millard_muscle.set_deactivation_time_constant(
thelen_muscle.get_deactivation_time_constant())
# millard_muscle.set_fiber_damping(0)
# millard_muscle.set_tendon_strain_at_one_norm_force(
# thelen_muscle.get_FmaxTendonStrain())
millard_muscle.setName(thelen_muscle.getName())
millard_muscle.set_appliesForce(thelen_muscle.get_appliesForce())
millard_muscle.setMinControl(thelen_muscle.getMinControl())
millard_muscle.setMaxControl(thelen_muscle.getMaxControl())
millard_muscle.setMaxIsometricForce(
thelen_muscle.getMaxIsometricForce())
millard_muscle.setOptimalFiberLength(
thelen_muscle.getOptimalFiberLength())
millard_muscle.setTendonSlackLength(
thelen_muscle.getTendonSlackLength())
millard_muscle.setPennationAngleAtOptimalFiberLength(
thelen_muscle.getPennationAngleAtOptimalFiberLength())
millard_muscle.setMaxContractionVelocity(
thelen_muscle.getMaxContractionVelocity())
# millard_muscle.set_ignore_tendon_compliance(
# thelen_muscle.get_ignore_tendon_compliance())
millard_muscle.set_ignore_tendon_compliance(True)
millard_muscle.set_ignore_activation_dynamics(
thelen_muscle.get_ignore_activation_dynamics())
# muscle path
pathPointSet = thelen_muscle.getGeometryPath().getPathPointSet()
geomPath = millard_muscle.updGeometryPath()
for j in range(pathPointSet.getSize()):
pathPoint = pathPointSet.get(j).clone()
geomPath.updPathPointSet().adoptAndAppend(pathPoint)
# append
new_force_set.adoptAndAppend(millard_muscle)
else:
raise RuntimeError(
'cannot handle the type of muscle: ' + force.getName())
new_force_set.printToXML(os.path.join(target_folder, 'muscle_set.xml'))
I have found that for gait if you assume a rigid tendon you will not get very different results compared to CMC. However, do not take my world for it and try to compare the two approaches to be sure.
Dimitar
Last edited by Dimitar Stanev on Sat Jul 18, 2020 1:51 am, edited 1 time in total.
- Kristy Godoy
- Posts: 23
- Joined: Thu Feb 05, 2015 12:53 pm
Re: Get muscle fiber lenghts used in static optimization
Hello, I'm trying to use the muscle analysis option in the analysis tool, but I did not find information on how to use it.
The OpenSim documentation shows how to use the analysis tool in general, and then the induced acceleration analysis and probes.
What I want to verify if the muscle lenght of some muscles after the static optimization analysis.
What files should I input to the tool?
Thank you for any help.
The OpenSim documentation shows how to use the analysis tool in general, and then the induced acceleration analysis and probes.
What I want to verify if the muscle lenght of some muscles after the static optimization analysis.
What files should I input to the tool?
Thank you for any help.
- Thomas Uchida
- Posts: 1794
- Joined: Wed May 16, 2012 11:40 am
Re: Get muscle fiber lenghts used in static optimization
I find it easy to go wrong with the Analysis Tool. I would instead try adding the MuscleAnalysis to the SO setup file so the muscle analysis is run at the same time as SO. If you open the SO setup file in a text editor, you will find an "AnalysisSet" tag; you can add the MuscleAnalysis code there (under "objects"). The template XML code can be found in the GUI: Help menu -> XML Browser -> MuscleAnalysis.
- Bas Van Hooren
- Posts: 30
- Joined: Fri Jan 29, 2016 10:59 am
Re: Get muscle fiber lenghts used in static optimization
Thanks all for your replies.
In response to Michael: It is a dynamic contraction involving slow concentric-eccentric muscle fascicle behavior. Since the movements are relatively slow, I want to use SO as I think the rigid tendon assumption is reasonable. However, to check this assumption I would like to compare the muscle fibers length from OpenSim to fascicle length from ultrasound.
Thanks also Dimitar and Thomas for your further suggestions, I will give both of these a try.
In response to Michael: It is a dynamic contraction involving slow concentric-eccentric muscle fascicle behavior. Since the movements are relatively slow, I want to use SO as I think the rigid tendon assumption is reasonable. However, to check this assumption I would like to compare the muscle fibers length from OpenSim to fascicle length from ultrasound.
Thanks also Dimitar and Thomas for your further suggestions, I will give both of these a try.
- Axel Koussou
- Posts: 56
- Joined: Mon Aug 10, 2020 12:07 am
Re: Get muscle fiber lenghts used in static optimization
Hi all,
I'm new in OpenSim. I'm using the Rajagopal's model, and I animate it with a .mot file, corresponding to the joint angles previously computed in MatLab. The motion corresponds to a passive sollicitation of the knee using an handheld dynamometer. It seems to work, the motion is well reconstructed in the GUI.
Then, I would like to use the muscle analysis tool to obtain the muscle-tendon length of the semitendinosus. But, as you, this tool "do not make sense at all as the length obtained does not change at all".
Therefore, I was wondering if, Bas, you succeeded to obtain the muscle fiber length through one of the method proposed or if anyone else know how I can proceed.
Thanks
I'm new in OpenSim. I'm using the Rajagopal's model, and I animate it with a .mot file, corresponding to the joint angles previously computed in MatLab. The motion corresponds to a passive sollicitation of the knee using an handheld dynamometer. It seems to work, the motion is well reconstructed in the GUI.
Then, I would like to use the muscle analysis tool to obtain the muscle-tendon length of the semitendinosus. But, as you, this tool "do not make sense at all as the length obtained does not change at all".
Therefore, I was wondering if, Bas, you succeeded to obtain the muscle fiber length through one of the method proposed or if anyone else know how I can proceed.
Thanks
- Bas Van Hooren
- Posts: 30
- Joined: Fri Jan 29, 2016 10:59 am
Re: Get muscle fiber lenghts used in static optimization
Hi Axel,
I managed to obtain muscle fiber lenghts using dynamic optimizaton. For the MTU length, it might help to open the generated file in excel and plot the MTU length. THis did help me in the past.
I managed to obtain muscle fiber lenghts using dynamic optimizaton. For the MTU length, it might help to open the generated file in excel and plot the MTU length. THis did help me in the past.