How to remove a bone?

Hello.

I am looking for a way to remove the right foot and right talus from the model. Furthermore, I want the ground reaction forces that come from the force plate to apply directly at the bottom of the right shank.

The reason that I am asking how to do this is because me and my partner are working on transtibial gate. We have removed all the muscles from the shank and the foot, but we run into problems with the foot and the talus because there are no muscles that will rotate their respective joints. Rotating the knee is not a problem since we still have muscles from the thigh. We talked to someone who had done a similar project, and he suggested that we remove the foot and the talus to remove the DOF of those two bones and thus simplify the model. Furthermore, he suggested that we apply the ground the reaction forces below the right shank. Below is a part of the email where he describes what we should do:

‘‘To start in the approach that I described above, you can try at first to apply the Ground Reaction
Force DIRECTLY to the ankle joint, but in the resulting point obtained from the force plate - just as if you actually had a foot in the model.
Then run the model and make it work at this stage. This works because of the lever arm of the force that gives roughly the same moment (or torque) for the ankle.
Once this is done you can begin to remove the foot and its drivers. Run the model again and make it work.
Make any further modifications you see fit after this, since the model now has force applied to the ankle, in a global
refference system. You can change the files of the ground reaction force to point to your file that contains the spring,
replace the ground reaction force with a force defined by an equation, etc.’’

We have been trying to do this with the MoCapModel that is supplied when downloading the Anybody program.

Any help would be appreciated,
Háski

Hi Háski,

I think you could approach it the same way as you removed muscles. You can remove the talus and foot segments from the study using MechObjectExclude. I am not sure what happens to the relevant constraints, but my guess would be that removing segments will be enough.

Regarding the force-plates - you could specify the shank segment directly for the force-plate to be applied to. But by default the MoCap model uses an auto-detection class (check Input/ForcePlate.any). You would need to replace, say, ForcePlateType2AutoDetection definition by ForcePlateType2 one. And specify Shank as the limb.

Let us know if that helps.

Regards,
Pavel

Hi Pavel. Thanks for your reply.

Since yesterday, I have been trying to follow the THA-KneeBendDemo which is supplied by Anybody upon downloading. It is located in the examples folder. In this demo, the right thigh bone and the right thigh joint are removed. The bone is then replaced with another thigh bone that contains an implant. I decided to try use a few of the codes here and remove the thigh in the MoCapModel. I imagine that if that works, then the same method can be used to remove the foot and talus.

Upon inspecting the file, I am having a hard time seeing where the original thigh bone is removed. The only command input that seems to hint that the original thigh has been removed is the following line located in BoneExchange.any:

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.Drw3 ={

Visible = Off;
};

But, it seems to me that this does not remove the thigh, but rather make it invisible.

Instead, there is this code directly below that has been commented out:

MechObjectExclude =
arrcat(
arrcat(
ObjSearch(“Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.Drw3”,“AnyMechObject”),
ObjSearchRecursive(“Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.Drw3”,"",“AnyMechObject”)
)
,
ObjSearchRecursive(“Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.Drw3”,"Femur
",“AnyMechObject”)
);

I copied this piece of code and pasted in three studies:

  1. In the AnyBodyStudy KinematicStudyForParameterIdentification and AnyBodyStudy MotionOptimization located in Kinematics.any

  2. In the AnyBodyStudy InverseDynamicStudy located in InverseDynamics.any

Question 1:
However, I am not really sure how I am supposed to confirm that I have successfully removed the thigh. I imagined that I would get an error upon running the motion optimization since I have no bone to connect the pelvis with the right shank, but everything seems to run just fine … Do you know how I can confirm that what I am doing is correct?

Regarding the force plates, I simply changed (for each of the three force plates)

ForcePlateType4AutoDetection Plate1 (
PlateName = Plate1,
Folder =Main.ModelSetup.C3DFileData,
Limb1= .BodyModelRef.Right.Leg.Seg.Foot,
Limb2= .BodyModelRef.Left.Leg.Seg.Foot,
No=0,
VerticalDirection =“Y”,
HeightTolerance=0.07,
VelThreshold=2.2,
Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fx1,
Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fy1,
Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fz1,
Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mx1,
My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.My1,
Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mz1,
FootPresent=HumanModelPresent)
={
Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[0];
Switch_DrawForceVectorFromCOP = On;
};

Into

ForcePlateType4 Plate1 (
PlateName = Plate1,
Folder =Main.ModelSetup.C3DFileData,
Limb= .BodyModelRef.Right.Leg.Seg.Shank,
No=0,
Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fx1,
Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fy1,
Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fz1,
Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mx1,
My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.My1,
Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mz1)
={
Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[0];
Switch_DrawForceVectorFromCOP = On;
};

Question 2:
The kinematics ran smoothly, but when looking at the model in model view during the inverse dynamics, the forces originate from the center of pressure and seem to be applying to the foot. Is this ok? I can imagine that the code draws the force vectors for visual purposes, but actually applies them to the shank. I just want to make sure that I am correct. Also, do you know where the force is being applied to the shank? At the bottom or at its center of mass?

I’ve attached the model if you want to look at it.

P.S. In the forums, how do you write lines of code in a window like I see some do? It looks neat.

Thanks in advance,
Háski

Hi Háski,

BoneExchange simply replaces the geometry. HipExchange does the actual job. The segments are removed, but they will still be visible in the model tree - yet they are not used in the analysis. You can check relevant joint reaction or muscles forces (they’ll be all 0s).

Q1: It seems to be correct to me.
Q2: This code below shows how the force is being applied.


    AnyReacForce PlateFootReaction={
      
      AnyKinLinear Lin={
        Ref=0;
        AnySeg &ref2=..ForcePlate;
        AnySeg &ref1=..Limb;
      };
      
      AnyKinRotational Rot={
        AnySeg &ref2=..ForcePlate;
        AnySeg &ref1=..Limb;
        Type=RotAxesAngles;
      };
    };

So at this point it will be applied to the origin of the segmental ref. frame. You could change the “Limb” to be some AnyRefNode, but then you would need to modify the ForcePlateType4 to accept an AnyRefFrame object instead of AnySeg, and the same in the block of code that i copied.

This AnyRefNode should be a node, which moves the least wrt. to the force plate. So it might be a good idea to create a node that represents the missing foot.

Regards,
Pavel

P.S. You could use [ CODE ] [ / CODE ] (without spaces) to wrap your code. Or use the hash shortcut in the toolbar when writing a message.

Hi Pavel. Thanks for your reply.

I have had some success; I am able to remove the foot and talus bones. I also removed the ankle joint. I replaced the code that removed the thigh bone with the following code:

 MechObjectExclude = 
    arrcat(arrcat(arrcat(ObjSearch("Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Talus","AnyMechObject"),
                         ObjSearchRecursive("Main.Studies.HumanModel.BodyModel.Right.Leg.Talus","*","AnyMechObject")),
                    arrcat(arrcat(ObjSearchRecursive("Main.HumanModel.BodyModel.Right.Leg.Seg.Talus","Calcaneous*","AnyMechObject"),ObjSearchRecursive("Main.HumanModel.BodyModel.Right.Leg.Seg.Foot","Phalanges*","AnyMechObject")),ObjSearchRecursive("Main.HumanModel.BodyModel.Right.Leg.Seg.Foot","Calcaneous*","AnyMechObject"))),
           arrcat(arrcat(ObjSearch("Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Talus.AnkleJoint","AnyMechObject"),
                         ObjSearchRecursive("Main.Studies.HumanModel.BodyModel.Right.Leg.Jnt.Ankle","*","AnyMechObject")),
                    ObjSearchRecursive("Main.Studies.Model.ModelEnvironmentConnection.JointsAndDrivers.JntDriverRightLegTD","Ankle*","AnyMechObject")));

In order to run this, I need to turn the ThreeFootMarkersOnOff off in TrialSpecificData.any. Do you know how I can do this so I only turn off the markers on the right foot, but so that the markers on the left foot stay on?

When I run the optimization, the foot and talus bone remain in their original position. The optimization takes a while, but in the end, I obtain the optimized motion. I assume that the program has succesfully run the optimization the way I wanted to because:

  1. The MomentMeasure of the AnklePlantarFlexionNetMomentMuscle and SubTalarEversionNetMomentMuscle are zero.
    2)The foot segment remain at a constant value of r at
    Main.Studies.MotionOptimization.Output.BodyModel.Right.Leg.Seg.Foot.r. The same goes for the talus.

However, the values of r at Main.Studies.MotionOptimization.Output.BodyModel.Right.Leg.Jnt.Ankle.ShankNode.r do not remain constant, but they remain constant at foot node. Furthermore, the values of r at the subtalar joint with respect to the foot node and the with respect to the talus node remain constant. Why is it that the values of r at the shank node do not remain constant?

Now, the next step is to do the inverse dynamics. However, I keep getting the following error:

Model is kinematically over-constrained : Position analysis failed : 1 unsolvable constraint(s) found

What I find strange is that I only have 1 unsolvable constraint. Do you have any ideas on where this constraint could be coming from?

Thanks in advance,
Háski

Hi Pavel.

I was wondering if you have had the time to look at my problem?

Best regards,
Háski

Hi Haski,

Yes, there are markers (ModelSetup\Markers) for both right and left sides with relevant naming. So you can just delete markers that you do not use for the right side.

I’ve looked at the MechObjectExclude (you can check the contents in the model tree and the description view) and it looks like you excluded all segments , muscles, joints, but not the drivers. So it might be that there is a typo in the search pattern or something like that.

The number of DOF should match number of constraints and drivers. You can double-click on the relevant study to get a full list of it.

Otherwise everything looks good.

Kind regards,
Pavel

P.S. ShankNode moves because it is on the Shank, which is still attached to the human :slight_smile:

Hi Pavel

Thanks a lot for your help. It is great to see that we are finally able to run the inverse dynamics of the model.

However, I think I have run into problems with the accuracy of the motion optimization. I have been trying to run motion optimization for a different C3D file, and a very interesting error occurs. It is a bit tough to explain what happens, so I have made a .GIF that should help clarify the error that occurs.

As you can see, the knee is very flexed, and gives the ‘‘Kinematic analysis failed in time step 91’’ error. Do you know why this occurs?

Edit: For some reason, the GIF will not run, but you can still see what I mean; the knee is too flexed.
Edit2: Here is a link to the GIF:
http://makeagif.com/i/nujBh6

Thanks in advance,
Háski

Hi Háski,

There could be many things that cause the problem, but there is definitely something wrong with the shank segment. Probably markers were moved somewhere or something else goes wrong. I would start there.

You can see that the knee flexes way too much inside and most likely causes the kinematic error. Please check - it should at least look close to physiological for the joints.

Regards,
Pavel

Hi Pavel.

I have managed to fix the kinematics. It was indeed due to marker placement.

To progress further, I need to ensure that the ground reaction force is being applied correctly.

I have compared two cases; one where I have a model that includes the foot and the ground reaction force
is applied to the foot, and the other where the model excludes the foot and the ground reaction force is
applied to the shank. I apply the ground reaction force to each limb with the
Limb= .BodyModelRef.Right.Leg.Seg.Foot/Shank line in ForcePlates.any file.

The resulting moments in the knee and hip joints are very similar in each case. However, if I am correct,
it is ideal to have the moments in the second case to be the exact same as in the first case. The
difference probably occurs because of the loss of the lever arm from the foot in the second case. I need to
find a way to correctly apply the ground reaction force to the second model so that it includes the lever arm,
but does not include the foot.

Do you have any ideas? I was thinking of adding a rigid segment/limb to the bottom of the shank (that does not
include a joint between the shank and the segment/limb), and I wanted to know if this is possible. This
new segment/limb cannot have any degrees of freedom, or I would have to create new drivers and muscles.

I have included pictures that show the moments in the right knee and hip joints. The image on the left is
the case where the foot is included and the ground reaction force is applied to the foot, and the image
on the right is the case where the foot is excluded and the ground reaction force is applied to the shank.

Thanks in advance,
Háski.

PS. Just for fun, I tried running a model where I removed the foot, but still applied the ground reaction
force on the foot. To my surprise, the motion optimization and inverse dynami worked, but the moments in the
right knee and hip had low values and fluctuated about the horizontal axis. Why is it that the model still
runs when I apply a ground reaction force to a limb that has been removed?

Hi Haski,

That might be OK. The ankle flexion and subtalar eversion are probably being optimized and, thus, you get two different configurations in the area, which affect moments eventually. Just imagine you a person one, who wears a skiing boot (no motion in the foot joints), and soft shoes in another configuration - the muscle work and the load in the joints will be different.

As well as that you probably removed some muscles that could also change the value.

Regards,
Pavel