my colleague and I are currently working on a bone-morphing problem and @CDzialo asked us if we could share the issue here with the community. So there you go ;-).
We took the TLEM 2 femur from the AMMR and changed its anteversion, neck length, CCD angle and femoral length with a MatLab script without further changes of the mesh-topology. So the number of the vertices are the same, but their positions might have changed. Especially in the proximal part of the femur.
Our question is: how can we import the “new” vertex positions back into AnyBody?
Considering that we did not use the whole transformation process, like it is shown in tutorial 15, lesson 1.
Unfortunately you will need to do the morphing to “import the new vertices back”. The good news are that you can select points on your STL files using the block of code below :
You can then copy and paste all those transformations to get your morphing ready. But this will, of course, require the mesh topology to be consistent with the source bone. Meaning that those vertices that you moved - should represent same areas of the original bone.
If this is not the case - you can still use those vertices that match, but add a new logic to the modified regions.
yesterday I tried to run a Parameter Identification with the “morphed femur” model.
Loading the model works fine. It looks like this:
When I started the Parameter Identification, I got an error message that said, the kinematic analysis failed and there were lots of constraint violations.
I think the problem may be that you are not applying the ‘TSeg2ScaleFrame’ transformation to your Points0unscaled (both in the affinetransformation and the RBF).
And I recieve the same Error during Parameter Identification.
Is it possible that if the initially defined scaling, which is for my subject specific simulations the SCALING_LENGTHMASSFAT (defined in the BodyModelConfig).
is not SCALING_STANDARD is a reason for the strange looking model?
Because the scaling in the Tutorial should be set to STANDARD.
As far as I’m concerned, SCALING_LENGTHMASSFAT is fine with the custom scaling.
I believe the reason is you used the AnyFunTransform3DSTL which requires the surfaces have to be topologically equivalent, i.e. the surfaces have the same number of triangles and each neighbor and vertices represent the same features on both surfaces.
Please try to use RBFTransform scalefunction like this:
Looking at your code I found the following things going wrong:
Since the stls are both of right femurs, Mirroring will need to happen on the left leg, adjust CustomScalingFemur.any to account for this.
The STLs were both in mm so *0.001 needs to be applied to code using the STLs or points derived from STLs in order to bring back into [m] for use in AnyBody. For example:
You can change your STLTransform settings such that UseClosestPointMatchingOnOff=Off since you are lucky enough to have matching topology
Then you will get something like this (green is the actual target geometry so you can visualise how well AnyBody morphs to the subject-specific geometry)
1: When a segment is scaled all nodes on the segment is usually scaled.
You can always visualize the coordinate system in the node to see its position and orientation, using an AnyDrawRefFrame .
2: As a rule yes all nodes are scaled, wrapping surfaces are controlled by points and these points are part of the scaling so when the move the wrapping surface will change.
I'm the supervisor of Lukas, who has finished his work now.
Regarding point 3:
The error of the RunAnalysis is:
#### Macro command : mcr(1:1)> classoperation Main.ModelSetup.Views.KinematicView"Set View"
1.0.1.0.0.2) ...Kinematic analysis completed.
1.0.1.0.0.3) ...Dependent variables are fully updated.
1.0.1.0) Kinematic analysis...
Progressing to solve kinematic optimality conditions and hard constraints.
Progressing to solve kinematic optimality conditions and hard constraints.
Progressing to solve kinematic optimality conditions and hard constraints.
Progressing to solve kinematic optimality conditions and hard constraints.
Failed to solve kinematic optimality conditions and hard constraints after 5 fallback attemps.
Constraint violations for study 'Main.Studies.MarkerTracking' :
ERROR(OBJ.MCH.KIN3) : D:/B..s/Hip/A..y/ammr/T..s/A..p/AnyMocapModel.any(41) : MarkerTracking.Kinematics : Kinematic analysis failed in time step 80 : Position analysis is not completed
Yes, that would be the normal way to do it.
It is also possible to have both if the custom scaling has been made a function of e.g. thigh length, but this a more special case.