Muscle Origin and Insertion Coordinate Transformation

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Tue May 30, 2017 12:02 pm

Yes, it works. Thanks!

Also, is OpenSim 4.0 available for download?

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Thomas Uchida » Tue May 30, 2017 12:28 pm

is OpenSim 4.0 available for download?
OpenSim 4.0 has not been officially released, but the code is available on GitHub: https://github.com/opensim-org/opensim-core.

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Tue May 30, 2017 1:40 pm

Thank you!

Also, a few quick questions.

1. Is there a guide or tutorial on developing OpenSim scripting within Matlab aside from these references:
http://simtk-confluence.stanford.edu:80 ... g+Commands
https://simtk.org/api_docs/opensim/api_docs/index.html

2. Any ideas how to index the "Vec3" within Matlab? Or a general method for indexing the variables created with the OpenSim tools?

3. I assume the "model.getCoordinateSet().get('r_shoulder_elev')" followed by "shoulder.setValue(state, 0.1);" gets the coordinates for right shoulder elevation and sets it to 0.1 degrees? Is this correct? If so, is there a resource that describes the function of these tools used in Matlab in depth or is everything in the two resources mentioned above? I ask because, although I can understand what each line is likely performing, certain functions such as "getGroundBody" do not have a description (I believe) in the references above and this information might be important when developing my own scripts.

Thanks again!

Mike

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Thomas Uchida » Tue May 30, 2017 4:11 pm

1. Is there a guide or tutorial on developing OpenSim scripting within Matlab aside from these references:
Some resources in addition to the two links you mentioned:
- the "Scripting with Matlab" page on Confluence: http://simtk-confluence.stanford.edu:80 ... ith+Matlab
- example scripts in your local OpenSim\Scripts\Matlab directory
- there's a MATLAB version of the dynamic walker example here: http://simtk-confluence.stanford.edu:80 ... nuary+2014 (direct link to the code: https://simtk.org/frs/download.php?file_id=3862).
- this Forum!
Additional documentation and examples for scripting will be accompanying the 4.0 release.
2. Any ideas how to index the "Vec3" within Matlab?

Code: Select all

>> import org.opensim.modeling.*;
>> a = Vec3(3.14)
 
a =
 
~[3.14,3.14,3.14]
 
>> a.set(0, 1.618);
>> a
 
a =
 
~[1.618,3.14,3.14]
 
>> a.get(0)

ans =

    1.6180
Or a general method for indexing the variables created with the OpenSim tools?
It can vary depending on which class you're dealing with and what information you're trying to extract. The get…() methods are good places to start. The methodsview MATLAB function can also be helpful.
3. I assume the "model.getCoordinateSet().get('r_shoulder_elev')" followed by "shoulder.setValue(state, 0.1);" gets the coordinates for right shoulder elevation and sets it to 0.1 degrees? Is this correct?
Yes.
If so, is there a resource that describes the function of these tools used in Matlab in depth or is everything in the two resources mentioned above? I ask because, although I can understand what each line is likely performing, certain functions such as "getGroundBody" do not have a description (I believe) in the references above and this information might be important when developing my own scripts.
Many methods like get…() and set…() are not documented because they follow the standard naming conventions used throughout OpenSim (see the "Naming conventions" section of CONTRIBUTING.md on GitHub: https://github.com/opensim-org/opensim- ... onventions). Thus, getGroundBody() returns a reference to Ground, which is a Body that exists in every Model.

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Wed May 31, 2017 7:20 am

Thanks Tom!

Mike

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Wed Jun 14, 2017 1:28 pm

Thanks for the advice on indexing the Vec3. I have a follow up question about indexing a muscle name in Matlab and setting it as a string. Here is an example of what I have done

import org.opensim.modeling.*;
model = Model('C:\OpenSim 3.3\Models\Arm26\arm26.osim');
MuscleName=model.getMuscles().get(0)


MuscleName =

TRIlong


The format of MuscleName is a "1x1 Muscle". I was wondering if there is a method to index the MuscleName, in this example TRIlong, and set it as a string?

Thanks!

Mike

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Muscle Origin and Insertion Coordinate Transformation

Post by jimmy d » Wed Jun 14, 2017 2:28 pm

MuscleName = char(model.getMuscles().get(0).getName())

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Thu Jun 15, 2017 6:37 am

Thanks James! Much appreciated.

Mike

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Michael Asmussen » Fri Jun 16, 2017 11:05 am

After indexing the muscle names, I was wondering if there is a method to only index the muscles that contribute to a certain rotation? For example, index only the muscles that contribute to right ankle plantarflexion?

Also, once setting a model to a certain configuration in Matlab, is there a method to extract the moment arm for a muscle for all three degrees of freedom of a joint? Is there also a method to extract the muscle length for a given model configuration or does this have to be computed manually?

Thank you,

Mike

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: Muscle Origin and Insertion Coordinate Transformation

Post by Thomas Uchida » Sat Jun 17, 2017 2:06 am

I was wondering if there is a method to only index the muscles that contribute to a certain rotation? For example, index only the muscles that contribute to right ankle plantarflexion?
Not sure what you mean by "contribute". A muscle can accelerate joints it does not cross. Presumably, you want to collect only the muscles that generate an ankle plantarflexion moment. Even that takes some care since a muscle's path is a function of the pose. You could compute the moment arm for each muscle at a few poses and find the muscles whose moment arm is nonzero in at least one pose.
is there a method to extract the moment arm for a muscle for all three degrees of freedom of a joint?
Have you tried the MomentArmSolver (https://simtk.org/api_docs/opensim/api_ ... olver.html)?
Is there also a method to extract the muscle length for a given model configuration or does this have to be computed manually?
Fiber and tendon lengths are available through the MuscleAnalysis (https://simtk.org/api_docs/opensim/api_ ... lysis.html).

POST REPLY