Page 1 of 2

Muscle Activation

Posted: Thu Sep 13, 2012 12:16 am
by giovannitti
Hi,

I'm quite new in Opensim and for my thesis work I have to compute muscular effort (sum of square muscles activation) for the arm in some static positions.

Is there an easy way to compute muscle activation in a static pose?

Thanks,
Eliana

Re: Muscle Activation

Posted: Wed Oct 31, 2012 4:48 am
by lamourip
Hi Eliana,

I am also quite new in Opensim ; did you manage to compute muscular effort in static position ?
I'm in the same situation, except that I'm trying to make inverse dynamic to determinate neck muscle force and activation.

Are you going to do the same thing ? (Not necessary in the same anatomical region)

Thanks,
Pierre

Re: Muscle Activation

Posted: Wed Oct 31, 2012 10:04 am
by aymanh
Hi Pierre and Eliana,

You could run StaticOptimization on a static pose (create a motion with 10 frames with fixed value of coordinates, and use this motion as input to the static optimization tool). Then you'll get muscle activations as outputs.

After you have that information, you can compute the sum of squared activations offline (e.g. using excel or matlab), and you can incorporate weighting and anything else that you need at that point. There're potentially other methods to do that all inside OpenSim but I think these steps should be simple to follow.

Please let me know if you have any questions.

Best regards,
-Ayman

Re: Muscle Activation

Posted: Wed Nov 07, 2012 5:14 am
by lamourip
Hi Ayman,

Apologies for the belated reply, we had an Internet cut for a week. First of all, I would like to thank you for your answer and your advices.

I am using the Vasavada neck muscle model (downloaded here : https://simtk.org/project/xml/downloads ... oup_id=253). Last week I made few motions of neck movement (as flexion, extension, axial rotation and lateral bending) from fixed value (it was before I see your answer) and I tried to launch a StaticOptimization, following general instructions in the support site page (http://simtk-confluence.stanford.edu:80 ... leshooting).

Nevertheless, I noticed that my results were wrong because activation for each muscle was still the same (0,0099) whatever the movement of the neck I choose. Is it because I have no setting to load ? I believe it is because my model hasn't any mass propreties, but I am not sure. Could you please confirm this point ?

Thank you very much for your advices,

Best regards,
Pierre

Re: Muscle Activation

Posted: Wed Nov 07, 2012 11:53 am
by aymanh
Hi Pierre,

There's no need to load files to run the various tools (though it's convenient) as you can enter all the info through the GUI. The main question for Static Optimization is whether the optimization succeeded or failed on each frame (you should see a line in the messages window to indicate that). If optimization failed then you should ignore the output of Static Optimization and go back to figure out what issues with the model/actuators need to be fixed.

Please let me know what you find out.

Best regards,
-Ayman

Re: Muscle Activation

Posted: Thu Nov 08, 2012 2:32 am
by lamourip
Hi Ayman,

Thank you for your help. Endeed, optimization on each frame failed, even if it is not written clearly ; here there are the results which appear on the message box :
---------------------------------------------------------------------------------------------------------------------
Old version storage/motion file encountered
Storage: file=C:\Users\pierre.lamouri\Desktop\Neck_Model\Motions\3DOF\flexion_3DOF.mot (nr=72 nc=7)
.. assuming rotations in Degrees.

Creating states from motion storage
Model::formCompleteStorages(): WARNING- Did not find column aux7jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux7jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux7jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux6jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux6jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux6jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux5jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux5jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux5jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux4jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux4jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux4jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux3jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux3jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux3jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux2jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux2jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux2jnt_r2 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux1jnt_r3 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux1jnt_r1 in storage object.
Model::formCompleteStorages(): WARNING- Did not find column aux1jnt_r2 in storage object.
No external loads will be applied (external loads file not specified).
Executing the analyses from 0.1 to 5...

time = 0.1 Performance =0.00389999 Constraint violation = -1.#IND
Bounds for stern_mast: 0 to 1
Bounds for cleid_mast: 0 to 1
Bounds for cleid_occ: 0 to 1
Bounds for scalenus_ant: 0 to 1
Bounds for scalenus_med: 0 to 1
Bounds for scalenus_post: 0 to 1
Bounds for long_cap_sklc4: 0 to 1
Bounds for long_col_c1thx: 0 to 1
Bounds for long_col_c1c5: 0 to 1
Bounds for long_col_c5thx: 0 to 1
Bounds for trap_cl: 0 to 1
Bounds for trap_acr: 0 to 1
Bounds for splen_cap_sklc6: 0 to 1
Bounds for splen_cap_sklthx: 0 to 1
Bounds for splen_cerv_c3thx: 0 to 1
Bounds for semi_cap_sklc5: 0 to 1
Bounds for semi_cap_sklthx: 0 to 1
Bounds for semi_cerv_c3thx: 0 to 1
Bounds for levator_scap: 0 to 1
Bounds for longissi_cap_sklc6: 0 to 1
Bounds for longissi_cerv_c4thx: 0 to 1
Bounds for iliocost_cerv_c5rib: 0 to 1
Bounds for rectcap_post_maj: 0 to 1
Bounds for rectcap_post_min: 0 to 1
Bounds for obl_cap_sup: 0 to 1
Bounds for obl_cap_inf: 0 to 1
Bounds for supmult-C4/5-C2: 0 to 1
Bounds for supmult-C5/6-C2: 0 to 1
Bounds for supmult-C6/7-C2: 0 to 1
Bounds for supmult-T1-C4: 0 to 1
Bounds for supmult-T1-C5: 0 to 1
Bounds for supmult-T2-C6: 0 to 1
Bounds for deepmult-C4/5-C2: 0 to 1
Bounds for deepmult-C5/6-C3: 0 to 1
Bounds for deepmult-C6/7-C4: 0 to 1
Bounds for deepmult-T1-C5: 0 to 1
Bounds for deepmult-T1-C6: 0 to 1
Bounds for deepmult-T2-C7: 0 to 1
Bounds for deepmult-T2-T1: 0 to 1

time = 0.2 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.3 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.4 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.5 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.6 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.7 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.8 Performance =0.00389999 Constraint violation = -1.#IND
time = 0.9 Performance =0.00389999 Constraint violation = -1.#IND
time = 1 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.1 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.2 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.3 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.4 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.5 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.6 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.7 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.8 Performance =0.00389999 Constraint violation = -1.#IND
time = 1.9 Performance =0.00389999 Constraint violation = -1.#IND
time = 2 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.1 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.2 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.3 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.4 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.5 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.6 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.7 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.8 Performance =0.00389999 Constraint violation = -1.#IND
time = 2.9 Performance =0.00389999 Constraint violation = -1.#IND
time = 3 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.1 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.2 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.3 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.4 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.5 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.6 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.7 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.8 Performance =0.00389999 Constraint violation = -1.#IND
time = 3.9 Performance =0.00389999 Constraint violation = -1.#IND
time = 4 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.1 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.2 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.3 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.4 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.5 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.6 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.7 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.8 Performance =0.00389999 Constraint violation = -1.#IND
time = 4.9 Performance =0.00389999 Constraint violation = -1.#IND
time = 5 Performance =0.00389999 Constraint violation = -1.#IND

Printing results of investigation neck joints to C:\Users\pierre.lamouri\Desktop\Resultats\Static Optimization.
--------------------------------------------------------------------------------------------------------------------------

If it is a problem with the mass and internia propreties, I'll try to fix it. I will tell you what I will find out...

Best regards,
Pierre

Re: Muscle Activation

Posted: Thu Nov 08, 2012 6:42 am
by ttouman
Hi Pierre,

I am similar to you a new user to OpenSim and I have exactly the same problem running the Christophy model for the lumbar spine including 238 muscles (https://simtk.org/project/xml/downloads ... oup_id=567). Although the inverse dynamics worked for a 40d flexion load,the static optimization fails returning the same messages and the same unreal activations for all muscle fascicles as in your case (0.00999999).

it would be really helpful if Ayman could give us a clue to that.Thanks in advance!

Best,
Thenia

Re: Muscle Activation

Posted: Thu Nov 08, 2012 12:01 pm
by aymanh
Hi Pierre and Thenia,

The first step of troubleshooting Static Optimization failure is to run Inverse Dynamics (ID) and inspect the results.
1. If ID fails, it's likely an issue with mass/inertia properties, resolve these before moving forward.
2. If it succeeds, the next step would be to inspect the results (plot them) and see if ID results contain large spikes or large torques that cannot be possibly produced by the muscles in your model. If you find any then you have to go back and reprocess your data.
3. Other reasons Static Optimization may fail:
- The model contains degree(s) of freedom that are not actuated by muscles (even if they need little torques). In this case StaticOptimization can't find muscle activations that match the accelerations computed by InverseDynamics, and you need to add "residual actuators" to these specific un-actuated degrees of freedom.
- The muscles are not strong enough (under-actuated degrees of freedom), this can be fixed by modifying the relative strength of the muscles in question (you have to have a justification for why and by how much) or add actuators to these degrees of freedom (reserves) to help the muscles.

I'm not sure if you have similar issues with your models, but I'd contact the model authors in each case to find out if they were able to run ID and/or SO on their respective models.

You may also find the support page below helpful in pointing out tips and tricks to troubleshooting
http://simtk-confluence.stanford.edu:80 ... timization

Best regards and please let us know how it goes,
-Ayman

Re: Muscle Activation

Posted: Fri Nov 09, 2012 6:16 am
by lamourip
Hi Ayman and Thenia,

Ayman, thank you for the description of theses differents cases. For my part, it was a problem of mass and inertia propreties. I am currently fixing it by addind mass, mass center and inertia matrix in the joint file. I will tell you what I will find out when I would have completed that.

Thenia, because you have downloaded your model, it could be possible you are in the same case I am. You can see if it is by checking your segments in the joint file. If it is not, the other points Ayman mentionned could certainely be the good explanation...

Best regards,
Pierre

Re: Muscle Activation

Posted: Tue Nov 20, 2012 11:01 am
by ttouman
Hi Ayman and Pierre,

Ayman,thank you very much for your response and I am sorry for my late reply.The ID failed and I think I am at the first case of your description so I am currently working on that.

In the mean time,a partner that is performing similar analysis with OpenSim passed me the predicted forces for 40d flexion extension moments for each fascicle as derived by ID methods.Nonetheless,apart from the time histories that are included in the *.sto file,it would be more helpful for me to have the deformations that correspond to each increment-#degree inclination.

However,it seems that we cannot have access to the deformation data (MT-length changes) but only to the MT-length at each increment which ok, could be used for manual calculations of the deformations. But this file includes the time increments between 0-100 and the second column is (by default) called ''flex_extension'' and, although I was expecting it to range between -40 and 40 degrees, the kinematics ranges between -70 and 26d. The length results give me the information that corresponds only to the extension because, e.g. psoas fascicles are lengthening while the multifidus are shortening.Do you have any idea on how I could solve this problem?

I am performing the muscle forces predictions with a FE spine generic model under flexion loads coupled to a hyperelastic constitutive model that I would like to calibrate at first instance using the force estimations of OpenSim.Do you know if there is another way to get the deformations of the fascicles? (since I cannot run forward dynamics simulations)

Pierre, thank you for the idea.As you said I have to check the joint file,too. Hope you got through the problems in your model..

Best regards,
Thenia