Matlab API transformPosition method does not agree with GUI (SOLVED)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Davide Pavan
Posts: 3
Joined: Mon Dec 11, 2017 10:23 am

Matlab API transformPosition method does not agree with GUI (SOLVED)

Post by Davide Pavan » Wed Aug 28, 2019 3:15 am

Hi all,

I'm trying to find a knee ligaments geometry matching literature data from cadaveric knees. Available data are ligament elongation, and ligament angle against the tibial anatomical frame (AF) vertical axis, in both frontal and sagittal plane, during passive FE (with secondary rotations data provided as well).

Said that is consequent that I'll have to transform the position of the ligament's femural insertion to the tibial AF to compute the angles to be compared with literature.

After a few "there's something wrong here" I tried to transform the position of the ligament's femural insertion to the tibial AF both with Matlab API and Opensim GUI, at different flexion degrees and with different ab/adduction and intra/extrarotation configurations: there's a discrepancy in results between GUI and API, with a positioning difference up to 2 mm.

Here below is the part of code where the tranformation is performed.

The model I used is published by Xu and available here:
https://simtk.org/projects/kneeligament

Code: Select all

P1=Lig_pathset.get(TibialInsertionName);
P2=Lig_pathset.get(FemuralInsertionName);

% get bodies
tibia=getBody(P1);
femur=getBody(P2);

% get point vectors 
PP1 = getLocation(P1);
PP2_f = getLocation(P2);
PP2_t= Vec3(0); % preallocate femural insertion in tibial coordinates

% Transform femural insertion to tibial reference frame coordinates 
osimModel.getSimbodyEngine.transformPosition(state, femur, PP2_f, tibia, PP2_t);
Any thoughts about this discrepancy? 2 mm are a lot for a ligament, in terms of newtons computed trough the force-elongation curve.

Thank You

David
Last edited by Davide Pavan on Wed Aug 28, 2019 9:05 am, edited 2 times in total.

Tags:

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

Re: Matlab API transformPosition method does not agree with GUI

Post by jimmy d » Wed Aug 28, 2019 5:13 am

Hi, David-

How are you performing the transform in the GUI and where do you see the differences (in a GUI pane or in the Model file?)? I ask because it may be a display issue in the GUI.

Also, just to check, are you using 3.3 or 4.0?

-James

User avatar
Davide Pavan
Posts: 3
Joined: Mon Dec 11, 2017 10:23 am

SOLVED - MY FAULT

Post by Davide Pavan » Wed Aug 28, 2019 9:16 am

Hi all,
I finally found a mistake in the previous steps of my code: I'm using functions to set different degrees of freedom, and there was a double call for deg2rad() (inside and outside of a function), so the model was having a slightly different pose when computing the trasnform. As the mistake was in knee rotation, the effect was little and led me to the tought of a computational error (also because I checked my code several times... :cry: ).

I corrected my code and re-run all the tests I've done before of posting here in the forum and everything is working fine.

Thanks to everyone who thought about it, and thaks to James who came out with an idea but... now we know that the GUI has no display issues.

- David

POST REPLY