Scaling

Dear Pavel,

finally I got the 6.0.3 Update! I updated my local “D: …\StandingModelScalingDisplay” folder and done the necessary changes as you described in the new scaling tutorial.

The reference “…TSeg2ScaleFrame” is pointing to the CostomScaling.any file where the definitions of the custom scaling are made. I assumed that the definition of “TSeg2ScaleFrame” should be defined here as well or am I missing something? Anyway … I created this to point out of MyScalingLaws (with “s”):


HumanModel.Scaling.GeometricalScaling = {
  
  #define CUSTOM_SCALING_Left_Thigh
  #define CUSTOM_SCALING_Right_Thigh
  
  AnyFunTransform3DIdentity TSeg2ScaleFrame = {
    PreTransforms = {&Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.Scale.T0};
  };
  
  Left.Thigh = {
    #include "MyScalingLaws.any"
    AnyFunTransform3D &ScaleFunction = MyScalingLaws.MyTransform1; 
  };
  Right.Thigh = {
    #include "MyScalingLaws_Mirrored.any"
    AnyFunTransform3D &ScaleFunction = MyScalingLaws_Mirrored.MyTransform1; 
  }; 
};

After all I still got an obviously wrong final geometry. Still confuesed. I can’t understand why I have to make changes to MyScalingLaws in order to solve the problem. I though it works like getting a perfect Individual Segment Scaling (with MyScalingLaws) and passing it to the Anatomic Ref Frame where it is rigid body transformed to the model?

King Regards,
felix

Felix,
Just to make sure we are on the same page. Do you use the latest repository that comes along with 6.0.3? Those TSeg2ScaleFrame’s are already defined and they are different for different segments, so you cannot really use the same one for everything. If you are using a special repository - you can copy CustomScaling.any into your version and it should just work.

And you are right, it should work just like you said. But there is some mismatch - it could be due to what i said. This is why we made it so that the only change needed to your scaling will be a …TSeg2ScaleFrame.

Regarads, Pavel

Dear Pavel,

The file “CustomScaling.any” of the StandingModelScalingDisplay Model is almost empty. Do you mean “ScalingCustom.any” in the “\AAUHuman\Scaling” Folder?

/Further I’m trying to implement the scale-functions into the MoCapModel. I tried it like in the tutorial with defining the actual scaling law and including my own with the define-statements of the segements I want to be individual scaled (Thigh) in the HumanModel-Folder. It produces an error that ‘ScaleFunction’ of the pelvis is unresolved. How can I turn off that AnyBody is trying to find a costum scaling function for the pelvis? Or is it somehow related to the problem above? Another way that I found is described in “\Scaling\ScalingCustom.any” which gets me a ‘AnthroData’: Unresolved object. I couldn’t figure out which link he is searching for./ --> solved!

Am I supposed to define first the specific rule and than the global scaling setting or is it the other way around?

Thank you very much Pavel!

Regards,
felix

Dear Felix,

I am sorry for the delayed answer.

Yes, ScalingCustom.any in AAUHuman\Scaling.

The anthropometrics is separate from an individual law, but it is also possible to combine them if needed. But the idea is that if you have an STL of the actual bone - you can just morph the bone directly into this shape. But if you for some reason need to use the anthropometric scaling beforehanf - it is also possible, but you should do it in the custom scaling law.

Pavel

Dear Pavel,

thank you for your patient help with this scaling issue! Finally I could manage to get everything in a proper manner.

I’ve antoher question on scaling: I need to use my own stl instead of the scaled one in my model. Is it possible to get the target femur (my own stl) into my model instead of the scaled source? Or not instead, in addition. I thought about a rigid body transform to the scaled source stl in the model with the same orientation of the local coord. system. Unfortunatly the local coord. systems are not the same and I couldn’t find a solution to creat >exactly< the same system in the target niether transforming the target in this way.

Thank you for your help,
felix

Felix,

Yes, do you need it just for the visualization or for the contact analysis? If the former - you can use AnyDrawSurf class objects, otherwise you can use AnySurfSTL or alike. AnyDrawSurf also has an option to include a transform, that will be applied to the surface - this could be a target-to-source rigid body transform that we used in the subject-specific scaling function.

You could also visualize the object and export it after applying the transform - this way it will be saved in a new ref. frame. Right-click on the drawing object in the model tree.

Regards,
Pavel

Dear Pavel,

the purpose is not for any contact analysis. The visualization of the target in the same position as the source would be terrific. I figured out two different solutions:

1.) Doing a rigid body transform of the target to the source with the landmarks used in the tutorial before applying the “Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.Scale” transfrom of the “SegScaleFunWrtAnatomicalFrame.any” File. I applied the TSeg2ScaleFrame (correction-(?)) factor as you told me earlier but this time to the target landmark set (Points1). See the result below. Its acutally not so bad. It looks like that there is something little missing. Do you have any hints for me?

2.) Doing a direct rigid body transform to the source (which is already transformed by the …Seg.Thigh.Scale transform). Therefore directly into the model. But in order to do so I should define a new set of landmarks for the rigid body transform in the local coord, getting the local coords in global and implementing them into the definition of the direct transfrom. I guess it would work like this but you have to take care of the landmarks in every new model which makes it a little bit static to me.

And I noticed the source femur used in the tutorial is a left-sideed one. Whereas the one used in STL.any is a right-sided one. I’ve looked into the scaling tutorial quite a lot of times but couldn’t understand really how this mirroring works. Even after “debugging” each transformation step of the mirrored laws: When displaying the results of both laws after the source backwards rigid body transform they look very different and the one which is supposed to be right (mirrored) is obviously still left. I assume that the “real” mirroring is happening later on? How does the scaling in the SegScaleFunWrtAnatomicalFrame.any File works and why do I need t0 and t0_inv etc.?

Sorry Pavel for poking you again and again on this topic. This scaling issue seems a little bit tricky to me … I hope that I could describe my thoughts clear enough.

Regards,
felix

Dear Felix,

This transformation is needed to perform scaling in the anatomic (“scaling”) reference frame as compared to the segmental one. Our intention was that you would not really need to do anything special about that, but just add the TSeg2ScaleFrame in one place.

I think if you want to display the target bones in the model - you need to place them into the anatomic reference frame and everything will just work.

Does that help?

Regards,
Pavel

Dear Pavel,

it took a while but finally I got my own STL-Geometry into the MoCapModel. Its somehow the solution like 1.) I had in my mind earlier. As you said I had to place the AnyDrawSurf object of my target bone into the anatomic reference frame of the desired segment. But in addition to that I had to do some transformation on it. The ScalingLaw looks like this:

  AnyFunTransform3DLin2 T_FORWARD_RIGIDBODY = {

    Points0 = { ... Landmark Set on Source Geom ... };
    Points1 = { ... Landmark Set on Target Geom ... } [b]* Main.Studies.HumanModel.BodyModel.Left.Leg.Seg.Thigh.Scale.T1[/b];
 
    Mode = VTK_LANDMARK_RIGIDBODY;}; 

Where T1 is the scaling law for the transformation from segmental frame to the scaled anatomical frame.

Thank yo very much for your patient help all the time (!),
felix

Sounds good, Felix.

Thanks for the solution.

Regards,
Pavel

Dear Pavel,
I managed to scale all 5 vertebrae in StandingModelScalingDisplay.any with no further problems.
I also did it in AirlinePassenger.main.any.
When I try to do it in the MoCap model, I have several problems.
Where would you suggest that I should place the “Transform Commands” ?
I tried it exactly before the “HumanModel.any” as it seems to work in both Standing and AirlinePassenger.
Is there a way to take the scaled human model from the “StandingModel” for example and use it in MoCap model ?

Thank you very much in advance

Best regards,
George.

Dear George,

The difference in these models is that the MoCap model contains two studies in the same file, which are being interchanged depending on whether you’re performing an optimization or an inverse dynamics analysis. This difference ends up into having HumanModel folder in the studies.

I have just explained this problem to someone else - please have a look here:
relevant thread.

Kind regards,
Pavel