Page 1 of 1

How to convert muscle type

Posted: Mon Mar 11, 2013 11:10 am
by jp123909
Hi, all

Our lab bought a SIMM full body model before. I have imported it into OpenSim 3.0, but
I find that the muscle type is Schutte1993Muscle, which has been deprecated. How can
I convert it to the newest muscle type?

Looking forward to your reply,

Many thanks,

Jiang

Re: How to convert muscle type

Posted: Mon Mar 11, 2013 12:59 pm
by jp123909

Code: Select all

Muscle & mus=my.updMuscles().get(musclenames[0]);   //musclenames[0] is the name of a test 1993muscle

Thelen2003Muscle *test0=new Thelen2003Muscle();

test0->set_isDisabled(mus.get_isDisabled());
test0->setMinControl(mus.getMinControl());
test0->setMaxControl(mus.getMaxControl());
test0->set_GeometryPath(mus.get_GeometryPath());
test0->setOptimalForce(mus.getOptimalForce());
test0->setMaxIsometricForce(mus.getMaxIsometricForce());
test0->setOptimalFiberLength(mus.getOptimalFiberLength());
test0->setTendonSlackLength(mus.getTendonSlackLength());
test0->setPennationAngleAtOptimalFiberLength(mus.getPennationAngleAtOptimalFiberLength());
test0->setMaxContractionVelocity(mus.getMaxContractionVelocity());

test0->setName("test");
my.addForce(test0);
My code for conversion.

Re: How to convert muscle type

Posted: Tue Mar 12, 2013 3:34 am
by yansch
As far as i know you can simply open the .osim file in your favourite text editor and do a search and replace. Replace "Schutte1993Muscle_deprecated" with "Thelen2003Muscle" or the muscle model you want to use.
When you open the file in OpenSim it will set the Thelen specific parameters to default values.

Re: How to convert muscle type

Posted: Tue Mar 12, 2013 10:16 am
by aymanh
Thanks Yannik and Jiang,

Indeed changing the string corresponding to the muscle-model-name in XML will modify the muscle model. The muscle-path is common to all muscle models so it will stay intact, other parameters however need to be examined because:
1. Different muscle models may have different attributes/properties. Unspecified ones will take on default value.
2. Even in the case when properties have the same name, they could mean something different (e.g. pre 3.0 muscle models had activation1 & activation2 that had completely different meaning even if they had the same name in the file).

So, whether using a script (C++, Matlab or Jython) or editing XML you need to decide how to set the various properties of the new muscle model if not satisfied with defaults.

Best regards,
-Ayman