Personalized Morphing behaving Differently in the Standing Model

Hi all,
I would like to include a personalized tibia in the StandingModelScalingDisplay in order to export muscle attachment points for an FE simulation.

In order to do this, I have an STL file of a fractured, reconstructed tibia and I woud like the AnyBody tibia to approximately match this surface.

If I perform the morphing outside the whole standing model, the result is satisfactory, but once I include the same scaling function in the Standing Model as explained in Lesson 2: Including a custom scaling function into your model — AnyBody Tutorials v7.4.0, the scaling looks different.

This is my transformation:

AnyFunTransform3DLin2 RigidTransform = 
{            
  // Source Points (AnyBody Tibia Landmarks)
  Points0 = 0.001*{        
    {38.669,271.221,8.968},        // Tuberositas tibiae 
    {-1.995,324.449,44.601},       // Condylus lateralis 
    {-1.156,322.809,-44.791},      // Condylus medialis 
    {-3.8,341.661,3.635},          // Tuberculus lateralis 
    {-1.894,339.854,-10.245},      // Tuberculus medialis 
    {-26.881,318.974,27.329},      // Condylus posterolateralis 
    {-28.374,323.039,-16.314},     // Condylus posteromedialis 
    {-5.435,251.746,-3.913},       // Posterior Point
    {-7.535,289.903,1.719}         // Posterior Curvature Point
  });
  
  // Target Points (Custom Tibia Landmarks)
  Points1 = 0.001*{
    {-9.169,-28.448,-33.545},      // Tuberositas tibiae
    {-31.588,-5.353,-4.502},       // Condylus lateralis
    {35.381,5.87,-5.12},           // Condylus medialis
    {0.027,3.647,8.050},           // Tuberculus lateralis 
    {6.581,4.973,6.739},           // Tuberculus medialis
    {-10.321,19.616,-9.286},       // Condylus posterolateralis 
    {11.89,25.755,-11.103},        // Condylus posteromedialis 
    {0.507,6.124,-53.613},         // Posterior Point
    {-1.743,8.486,-35.638}         // Posterior Curvature Point
  };
  
  Mode = VTK_LANDMARK_SIMILARITY;
};

AnyFunTransform3DLin2 ReverseTransform = 
{ 
  Points0 = .RigidTransform.Points1;
  Points1 = .RigidTransform.Points0;
  Mode = VTK_LANDMARK_RIGIDBODY;
};

AnyFunTransform3D FinalTransform = {
PreTransforms = {&.RigidTransform, &.ReverseTransform};
};

I then draw the two surfaces as follows:

  AnyDrawSurf AnyTibia = 
  {
    FileName = "TibiaRight_AnyBody_localCsys.anysurf3";
    AnyFunTransform3D &ref = .FinalTransform;
  };
  
  AnyDrawSurf CustomTibia = 
  {
    FileName = "P4.anysurf3";
    AnyFunTransform3D &ref = .ReverseTransform;
  };

The result looks like this (which is satisfactory for my scope):

I then proceed to include this function in the Standing Model (here I'm omitting the lines with the mirrored function for the contralateral side for shortness):

HumanModel.Scaling.GeometricalScaling = {
#define CUSTOM_SCALING_Right_Shank

Right.Shank = {
#include "TibiaScalingFunction.any"
AnyFunTransform3D &ScaleFunction = TibiaScalingFunctions.FinalTransform;
};

};

whereby TibiaScalingFunction.any looks like this:

AnyFolder TibiaScalingFunctions = {

AnyFunTransform3D FinalTransform = {
PreTransforms = {&.RigidTransform, &.ReverseTransform};
};

AnyFunTransform3DLin2 RigidTransform = 
{
        
  // Source Points (AnyBody Tibia Landmarks)
  Points0 = ..TSeg2ScaleFrame(0.001*{        
    {38.669,271.221,8.968},        // Tuberositas tibiae 
    {-1.995,324.449,44.601},       // Condylus lateralis 
    {-1.156,322.809,-44.791},      // Condylus medialis 
    {-3.8,341.661,3.635},          // Tuberculus lateralis 
    {-1.894,339.854,-10.245},      // Tuberculus medialis 
    {-26.881,318.974,27.329},      // Condylus posterolateralis 
    {-28.374,323.039,-16.314},     // Condylus posteromedialis 
    {-5.435,251.746,-3.913},       // Posterior Point
    {-7.535,289.903,1.719}         // Posterior Curvature Point
  });
  
  // Target Points (Custom Tibia Landmarks)
  Points1 = 0.001*{
    {-9.169,-28.448,-33.545},      // Tuberositas tibiae 
    {-31.588,-5.353,-4.502},       // Condylus lateralis 
    {35.381,5.87,-5.12},           // Condylus medialis 
    {0.027,3.647,8.050},           // Tuberculus lateralis 
    {6.581,4.973,6.739},           // Tuberculus medialis 
    {-10.321,19.616,-9.286},       // Condylus posterolateralis 
    {11.89,25.755,-11.103},        // Condylus posteromedialis 
    {0.507,6.124,-53.613},         // Posterior Point
    {-1.743,8.486,-35.638}         // Posterior Curvature Point
  };
  
  Mode = VTK_LANDMARK_SIMILARITY;
};

AnyFunTransform3DLin2 ReverseTransform = 
{ 
  Points0 = .RigidTransform.Points1;
  Points1 = .RigidTransform.Points0;
  Mode = VTK_LANDMARK_RIGIDBODY;
};

};

However, the result I get is thinner and shorter compared to previous one, as can be seen here:

What am I missing? Are there other scaling functions that are being applied to my tibia except for my desired transformation?
Thank you in advance for your help.

Best regards,

Marco

Hi Marco,

check your input - could it be that you are working on the scaled surface (blue) that does not match AnyBody's one?

Kind regards,
Pavel

Hi Pavel,
thank you for the reply. AnyBody's Tibia from the Standing Model is in yellow and is actively being scaled (without scaling it would look much bigger, since my custom tibia is pretty small), except not in the way that it should.

The blue and the "bony" one instead are drawn directly from .stl files in the right shank reference frame, to check whether the scaling process has succedeed, so they're not actually part of the model but are rather there for reference.

I would then expect the blue tibia (.stl) and the yellow one (which is part of the model) to be exactly overimposed, since the same transformation is applied to them, but apparently that's not the case..

Regards,

Marco

Hi Marco,

I don't know exactly how you exported the surface, but if you say you got it from the StandingModel - it means it was already scaled (to an average human), and no longer represents the unscaled source, underlying data.

We have another anthropometric scaling option (_SCALING_NONE _) that I use to export original surfaces.

Kind regards,
Pavel