Hi everyone,
My goal is to use a Matlab interface with OpenSim to compute participant-specific parameters for the scapulothoracic joint model developed by Seth, Matias and colleagues. The required parameters for that joint are the position, orientation and radii of an ellipsoid that sets the constrained movement of the scapula. In my Matlab code, I need to read all these parameters from the scaled skeleton and replace them with the adjusted values.
I had no issues in getting the position and orientation of the joint frame, but nothing that I tried up to the moment allowed me to get the current ellipsoid radii and then set the adjusted values. A couple of weeks ago, I had the chance to briefly speak to Ayman Habib who recommended the use of the PropertyHelper class (in a previous post I also saw Carmichael speaking about it) but couldn't make it work, as I am not familiar with class programming. This is what I got so far:
import org.opensim.modeling.*;
[model.file, model.path] = uigetfile('.osim', 'Please select the scaled OpenSim model','C:\');
model.filepath = [model.path model.file];
% Create the scaled OpenSim model object from the .osim file
Model.LoadOpenSimLibrary('D:\...\ScapulothoracicJointPlugin40_WinX64.dll');
osimScaledModel=Model(model.filepath);
osimScaledModel.initSystem;
joints = osimScaledModel.get_JointSet();
RSTC = joints.get(21); %This is the position of the scapulothoracic joint in my model
Rellip_radii = RSTC.getPropertyByName('thoracic_ellipsoid_radii_x_y_z');
% Up to this point, everything goes well, and the Rellip_radii is an AbstractProperty instance, though the Type Name of the 'thoracic_ellipsoid_radii_x_y_z' is showed as Vec3. But then, if I try the next line:
PropertyHelper.getValueVec3(Rellip_radii);
I get the error:
No method 'getValueVec3' with matching signature found for class
'org.opensim.modeling.PropertyHelper'.
I'm sure I am not using the PropertyHelper class correctly, but as I am not familiar with it, I simply couldn't figure out how to do it. Any feedback in that sense would be very much appreciated.
Thank you,
Using the PropertyHelper to get and set the ellipsoid radii of the new Scapulothoracic Joint Model by Seth and Matias
- Marcel Rossi
- Posts: 8
- Joined: Sat Aug 25, 2018 1:02 am
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Using the PropertyHelper to get and set the ellipsoid radii of the new Scapulothoracic Joint Model by Seth and Matia
Hello,
In general you should check the doxygen documentation for the full signatures. In matlab you can use methodsview instead. In this specific case,
the signature indicates that you can get/set elements of Vec3 one at a time
Please let us know if that works for you.
Best regards,
-Ayman
In general you should check the doxygen documentation for the full signatures. In matlab you can use methodsview instead. In this specific case,
the signature indicates that you can get/set elements of Vec3 one at a time
Code: Select all
double getValueVec3(AbstractProperty p, int index)
setValueVec3(double v, AbstractProperty p, int index)
Best regards,
-Ayman
- Marcel Rossi
- Posts: 8
- Joined: Sat Aug 25, 2018 1:02 am
Re: Using the PropertyHelper to get and set the ellipsoid radii of the new Scapulothoracic Joint Model by Seth and Matia
Excellent!! It worked!
Thanks again Ayman, much appreciated! I had looked at it using the methodsview, but I guess I skipped the line that showed the int argument!
Cheers,
Marcel
Thanks again Ayman, much appreciated! I had looked at it using the methodsview, but I guess I skipped the line that showed the int argument!
Cheers,
Marcel