Update Body for Muscle Origin

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Brecca Gaffney
Posts: 4
Joined: Thu Aug 01, 2013 4:09 pm

Update Body for Muscle Origin

Post by Brecca Gaffney » Mon Feb 12, 2018 6:10 pm

Hello,

Is it possible to update the body that serves as the muscle origin in the .osim file? For example, I would like to update the <body> flagged as 'femur_r' to a new geometry named 'femur_dist_r' for an updated model that has the femur split into two segments. This could be done manually, but it is quite laborious.

I have used the PathPointSet class to determine the body that corresponds to the muscle (example code below) within Matlab, but do not see a functionality within this class to update the segment name to create a new model. Any help is greatly appreciated!

model = Model(modelFile);
model.initSystem();

Muscles = model.getMuscles();
nMuscles = Muscles.getSize();

for i = 29

myForce = model.getMuscles().get(i - 1);
myMuscle = Muscle.safeDownCast(myForce);
muscleType = char(myForce.getConcreteClassName);
% Get a reference to the concrete muscle class in the model
eval(['myMuscle =' muscleType '.safeDownCast(myForce);'])
pathPoints = model.getMuscles().get('vasint_r').getGeometryPath().getPathPointSet();
BodyName = char(pathPoints.get(0).getBody());

end

POST REPLY