Using the PropertyHelper to get and set the ellipsoid radii of the new Scapulothoracic Joint Model by Seth and Matias
Posted: Wed Jul 22, 2020 12:53 am
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,
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,