Page 1 of 1

Improving moment arm calculation speed

Posted: Thu Nov 25, 2010 4:49 pm
by marc_carc
Hi,

A part of my work involves mapping muscle moment arm data to model pose. I use the computeMomentArm() function through the API to do this, but it takes quite a while to compute for every muscle in a large model.

I was wondering if some one could explain how this function works to compute the moment arms, and if there has been any progress or new techniques that can make this faster while achieving results with similar accuracy?

Thanks

Marc

RE: Improving moment arm calculation speed

Posted: Sun Nov 28, 2010 10:12 am
by aymanh
Hi Marc,

What version of OpenSim are you using? Version 2.2 contains a new method that should produce the same results but solves for the moment arm analytically (vs. numerically by perturbing coordinates and measuring length in previous versions) so it should be really fast. If using the API (again in version 2.2) you can use the MomentArmSolver to compute the moment arms for several muscles simultaneously.

Good luck and please let me know if you have any questions,
-Ayman

RE: Improving moment arm calculation speed

Posted: Sun Nov 28, 2010 8:36 pm
by marc_carc
Hi Ayman,

I was using version 2.0, but what you describe in 2.2 sounds exactly what I am after.

I downloaded the Linux 2.2.0 version but it does not include the MomentArmSolver.h header file. Has this functionality been included in the linux version libraries? If so should copying the header files from the Windows version work?

Cheers

Marc

RE: Improving moment arm calculation speed

Posted: Mon Nov 29, 2010 2:08 am
by aymanh
Hi Marc,

The header and libraries go together. The header is located in
opensim220-linux32-API.tar\OpenSimInstall\sdk\include\OpenSim\Simulation\MomentArmSolver.h

in the linux distribution posted under release betas. Please give it a spin and let me know how it goes.

Good luck,
-Ayman

RE: Improving moment arm calculation speed

Posted: Mon Nov 29, 2010 4:58 pm
by aymanh
Hi Marc,

I updated the Linux distribution on the downloads page as I found out that the older tar file was missing a dependent library, please give the new distribution a shot and let me know how it goes.

Thanks,
-Ayman

RE: Improving moment arm calculation speed

Posted: Mon Nov 29, 2010 6:13 pm
by marc_carc
Thanks Ayman, I tried the new Linux distribution and it works fine.

I calculated the muscle moment-arm matrix for the upper limb model for 50 muscles over 7 joints. In version 2.0.2 it took 2110ms and in 2.2.0 it took only 1120ms. This is a significant decrease but I was still hoping it could be reduced more (we always want more :P ).

In 2.2.0 I compared using computeMomentArm() with using MomentArmSolver::solve() and found they both take the same time. Is this because computeMomentArm now utilizes the moment-arm solver?

Can you think of any other steps I could take to improve the speed of moment arm calculation? Perhaps using computeMomentArms() instead of computeMomentArm() ?

Thanks for you help

Marc