[38ba34]: / Body / AAUHuman / Scaling / ScalingXYZMassFat.any

Download this file

487 lines (403 with data), 25.1 kB

/* -------------------------------------------------------------------------------------------
This file implements a scaling law based on scaling vectors for each bone or region, mass and fat percentage are used
for mass, strength, and fiber length scaling. Each segment requires a scaling triplet (length, depth, width), which should be
defined in a special file that contains segmental scaling vectors.
------------------------------------------------------------------------------------------- */

// Scaling law.
// Main.HumanModel.Scaling

  AnyFolder MassScaling = {
    AnyFolder Pelvis = { AnyVar MassScale = ...Anthropometrics.SegmentMasses.Pelvis / ..StandardParameters.Pelvis.Mass; };
    AnyFolder Head = { AnyVar MassScale = (...Anthropometrics.SegmentMasses.Head) / (..StandardParameters.Head.Mass); };
    AnyFolder Cervical = { AnyVar MassScale = .Head.MassScale;};
    AnyFolder Thorax = { AnyVar MassScale = ( ...Anthropometrics.SegmentMasses.Thorax) / (..StandardParameters.Trunk.Mass  ); }; //Ratio of mass of thorax plus lumbar mass
    AnyFolder Lumbar = { AnyVar MassScale = (...Anthropometrics.SegmentMasses.Lumbar) / (..StandardParameters.Lumbar.Mass); };//Ratio of mass of lumbar mass
    
    AnyFolder Right = 
    {
      AnyFolder Clavicula = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Shoulder / (  ...StandardParameters.Clavicula.Mass + ...StandardParameters.Scapula.Mass); };   
      AnyFolder Scapula   = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.Shoulder / (  ...StandardParameters.Clavicula.Mass + ...StandardParameters.Scapula.Mass); };       
      AnyFolder Humerus   = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.UpperArm   /    ...StandardParameters.Humerus.Mass; };
      AnyFolder Ulna      = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.LowerArm   / (2*...StandardParameters.Ulna.Mass); };
      AnyFolder Radius    = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.LowerArm   / (2*...StandardParameters.Ulna.Mass);  };
      AnyFolder Hand      = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.Hand        /    ...StandardParameters.Hand.Mass; };
      
      AnyFolder Foot = { AnyVar MassScale = (....Anthropometrics.SegmentMasses.Right.Foot ) / ...StandardParameters.Right.Foot.Mass; };
      AnyFolder Talus = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.Talus / ...StandardParameters.Right.Talus.Mass; };  
      AnyFolder Shank = { AnyVar MassScale = (....Anthropometrics.SegmentMasses.Right.Shank) / (...StandardParameters.Right.Shank.Mass+...StandardParameters.Right.Patella.Mass); };
      AnyFolder Thigh = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Right.Thigh / ...StandardParameters.Right.Thigh.Mass; };  
    };
    AnyFolder Left = 
    {
      AnyFolder Clavicula = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Shoulder  / (  ...StandardParameters.Clavicula.Mass + ...StandardParameters.Scapula.Mass); };   
      AnyFolder Scapula   = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Shoulder  / (  ...StandardParameters.Clavicula.Mass + ...StandardParameters.Scapula.Mass); };       
      AnyFolder Humerus   = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.UpperArm   /    ...StandardParameters.Humerus.Mass; };
      AnyFolder Ulna      = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.LowerArm   / (2*...StandardParameters.Ulna.Mass); };
      AnyFolder Radius    = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.LowerArm   / (2*...StandardParameters.Ulna.Mass);  };
      AnyFolder Hand      = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Hand        /    ...StandardParameters.Hand.Mass; };
      
      AnyFolder Foot = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Foot  / ...StandardParameters.Left.Foot.Mass; };
      AnyFolder Talus = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Talus / ...StandardParameters.Left.Talus.Mass; };  
      AnyFolder Shank = { AnyVar MassScale = (....Anthropometrics.SegmentMasses.Left.Shank) / (...StandardParameters.Right.Shank.Mass+...StandardParameters.Left.Patella.Mass); };
      AnyFolder Thigh = { AnyVar MassScale = ....Anthropometrics.SegmentMasses.Left.Thigh / ...StandardParameters.Left.Thigh.Mass; };  
    };
  };
  
  AnyFolder StrengthScaling = {    
    AnyVar Rother = 0.5;          // Mass fraction in the body of organs, blood, skeleton, etc.
    AnyVar Rfat = ..Anthropometrics.FatPercent/100; // Fat ration in the entire body
    AnyVar Rfat0 = .StandardParameters.BodyParameters.FatPercent/100;
    AnyFolder Pelvis = { AnyVar StrengthScale = (..MassScaling.Pelvis.MassScale / ..GeometricalScaling.Pelvis.LengthScale) * ((1-.Rother-.Rfat)/(1-.Rother-.Rfat0)); };
    AnyFolder Spine = { AnyVar StrengthScale = (..MassScaling.Thorax.MassScale / ..GeometricalScaling.Thorax.LengthScale ) * ((1-.Rother-.Rfat)/(1-.Rother-.Rfat0)); };
    
    AnyFolder Right =
    { 
      AnyFolder Humerus = { AnyVar StrengthScale = (...MassScaling.Right.Humerus.MassScale / ...GeometricalScaling.Right.Humerus.LengthScale            ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Ulna    = { AnyVar StrengthScale = (...MassScaling.Right.Ulna.MassScale    / ...GeometricalScaling.Right.Ulna.LengthScale               ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Hand    = { AnyVar StrengthScale = (...MassScaling.Right.Hand.MassScale    / ...GeometricalScaling.Right.Hand.LengthScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      
      // Strength scaling factors for the leg strength is not normalized with respect to segment length because 
      // PSCA is calculated based on the muscle fibers which are scaled separately. 
      AnyFolder Foot = { AnyVar StrengthScale = (...MassScaling.Right.Foot.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Shank = { AnyVar StrengthScale = (...MassScaling.Right.Shank.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0));};
      AnyFolder Thigh = { AnyVar StrengthScale = (...MassScaling.Right.Thigh.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
    };
    AnyFolder Left =
    { 
      AnyFolder Humerus = { AnyVar StrengthScale = (...MassScaling.Left.Humerus.MassScale / ...GeometricalScaling.Left.Humerus.LengthScale            ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Ulna    = { AnyVar StrengthScale = (...MassScaling.Left.Ulna.MassScale    / ...GeometricalScaling.Left.Ulna.LengthScale               ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Hand    = { AnyVar StrengthScale = (...MassScaling.Left.Hand.MassScale    / ...GeometricalScaling.Left.Hand.LengthScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      
      // Strength scaling factors for the leg strength is not normalized with respect to segment length because 
      // PSCA is calculated based on the muscle fibers which are scaled separately. 
      AnyFolder Foot = { AnyVar StrengthScale = (...MassScaling.Left.Foot.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
      AnyFolder Shank = { AnyVar StrengthScale = (...MassScaling.Left.Shank.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0));};
      AnyFolder Thigh = { AnyVar StrengthScale = (...MassScaling.Left.Thigh.MassScale ) * ((1-..Rother-..Rfat)/(1-..Rother-..Rfat0)); };
    };
  };
  
  AnyFolder FiberLengthScaling = {    
    AnyFolder Pelvis = { AnyVar FiberLengthScale = ...Anthropometrics.SegmentScaleFactors.Pelvis.WidthScale; };
    
    AnyFolder Right =
    {
      AnyFolder Foot = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Foot.LengthScale; };
      AnyFolder Shank = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Shank.LengthScale; };
      AnyFolder Thigh = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Thigh.LengthScale; };
    };
    AnyFolder Left =
    {
      AnyFolder Foot = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Foot.LengthScale; };         
      AnyFolder Shank = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Shank.LengthScale; };
      AnyFolder Thigh = { AnyVar FiberLengthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Thigh.LengthScale; };
    };
    
  };
  
  AnyFolder GeometricalScaling = {
    
    AnyFolder Right ={
      
      AnyFolder Clavicula = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Clavicula.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Clavicula.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Clavicula.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = 
          {
            {.LengthScale, 0.0,           0.0         }, // Length
            {0.0,          .WidthScale,   0.0         }, // anteroposterior thickness           
            {0.0,          0.0,           .DepthScale}   // vertical thickness
          };
          Offset = {0,0,0};
        };
        
      };
      
      AnyFolder Scapula = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Scapula.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Scapula.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Scapula.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = 
          {
            {.WidthScale, 0.0,          0.0        }, // mediolateral stretch  
            {0.0,         .LengthScale, 0.0        }, // vertical stretch           
            {0.0,         0.0,          .DepthScale}  // thickness of scapula
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Humerus = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Humerus.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Humerus.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Humerus.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.WidthScale, 0.0, 0.0},   // mediolateral width
            {0.0, .LengthScale, 0.0},  // long axis          
            {0.0, 0.0, .DepthScale}    // anteroposterior depth
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Ulna = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Ulna.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Ulna.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Ulna.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.WidthScale, 0.0, 0.0},   // mediolateral width
            {0.0, .LengthScale, 0.0},  // long axis          
            {0.0, 0.0, .DepthScale}    // anteroposterior depth
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Radius = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Radius.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Radius.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Radius.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.LengthScale, 0.0, 0.0}, // long axis
            {0.0, .WidthScale, 0.0},  // mediolateral width          
            {0.0, 0.0, .DepthScale}   // depth
          };
          Offset = {0,0,0};        
        };
      };
      
      AnyFolder Hand = {
        
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Hand.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Hand.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Hand.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat ={
            {.LengthScale, 0.0, 0.0},   // fingers aligned axis
            {0.0, .WidthScale, 0.0},    // mediolateral width
            {0.0, 0.0, .DepthScale}     // hand thickness 
          };        
          Offset = {0,0,0};
        };
      };
      
      // Talus uses the scaling function of the Foot segment
      AnyFolder &Talus = Foot;
      
      AnyFolder Foot  = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Foot.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Foot.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Foot.WidthScale;
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.LengthScale, 0.0, 0.0}, // toes aligned axis
            {0.0, .DepthScale, 0.0},  // thickness of the foot          
            {0.0, 0.0, .WidthScale}   // mediolateral width
          };
          Offset = {0, 0, 0};            
        };
      };
      
      AnyFolder Shank = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Shank.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Shank.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Shank.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.DepthScale, 0.0, 0.0},   // anteroposterior thickness
            {0.0, .LengthScale, 0.0},  // long axis            
            {0.0, 0.0, .WidthScale}    // mediolateral width
          };
          Offset = {0, 0, 0};
        };
        
      };
      
      AnyFolder Thigh = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Right.Thigh.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Thigh.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Right.Thigh.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.DepthScale, 0.0, 0.0},   // anteroposterior thickness
            {0.0, .LengthScale, 0.0},  // long axis            
            {0.0, 0.0, .WidthScale}    // mediolateral width
          };
          Offset = {0, 0, 0};
        };
        
      };
      
      // Patella uses the scaling function of the Thigh segment.
      AnyFolder &Patella = Thigh;
      
    }; // Right
    
    AnyFolder Left ={
      AnyFolder Clavicula = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Clavicula.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Clavicula.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Clavicula.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = 
          {
            {.LengthScale, 0.0,           0.0         }, // Length
            {0.0,          .WidthScale,   0.0         }, // anteroposterior thickness           
            {0.0,          0.0,           .DepthScale}   // vertical thickness
          };
          Offset = {0,0,0};
        };
        
      };
      
      AnyFolder Scapula = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Scapula.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Scapula.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Scapula.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = 
          {
            {.WidthScale, 0.0,          0.0        }, // mediolateral stretch  
            {0.0,         .LengthScale, 0.0        }, // vertical stretch           
            {0.0,         0.0,          .DepthScale}  // thickness of scapula
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Humerus = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Humerus.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Humerus.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Humerus.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.WidthScale, 0.0, 0.0},   // mediolateral width
            {0.0, .LengthScale, 0.0},  // long axis          
            {0.0, 0.0, .DepthScale}    // anteroposterior depth
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Ulna = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Ulna.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Ulna.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Ulna.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.WidthScale, 0.0, 0.0},   // mediolateral width
            {0.0, .LengthScale, 0.0},  // long axis          
            {0.0, 0.0, .DepthScale}    // anteroposterior depth
          };
          Offset = {0,0,0};
        };
      };
      
      AnyFolder Radius = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Radius.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Radius.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Radius.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {
            {.LengthScale, 0.0, 0.0}, // long axis
            {0.0, .WidthScale, 0.0},  // mediolateral width          
            {0.0, 0.0, .DepthScale}   // depth
          };
          Offset = {0,0,0};      
        };
      };
      
      AnyFolder Hand = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Hand.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Hand.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Hand.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat ={
            {.LengthScale, 0.0, 0.0},   // fingers aligned axis
            {0.0, .WidthScale, 0.0},    // mediolateral width
            {0.0, 0.0, .DepthScale}     // hand thickness 
          };        
          Offset = {0,0,0};
        };
      };
      
      // Talus uses the scaling function of the Foot segment
      AnyFolder &Talus = Foot;
      
      AnyFolder Foot  = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Foot.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Foot.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Foot.WidthScale;
        
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat ={
            {.LengthScale, 0.0, 0.0}, // toes aligned axis
            {0.0, .DepthScale, 0.0},  // thickness of the foot          
            {0.0, 0.0, .WidthScale}   // mediolateral width
          };        
          Offset = {0, 0, 0};
        };
      };
      
      AnyFolder Shank = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Shank.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Shank.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Shank.WidthScale;

        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat ={
            {.DepthScale, 0.0, 0.0},   // anteroposterior thickness
            {0.0, .LengthScale, 0.0},  // long axis            
            {0.0, 0.0, .WidthScale}    // mediolateral width
          };  
          Offset = {0, 0, 0};
        };
      };
      
      AnyFolder Thigh = {
        AnyFloat LengthScale = ....Anthropometrics.SegmentScaleFactors.Left.Thigh.LengthScale;
        AnyFloat DepthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Thigh.DepthScale;
        AnyFloat WidthScale  = ....Anthropometrics.SegmentScaleFactors.Left.Thigh.WidthScale;

        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat ={
            {.DepthScale, 0.0, 0.0},   // anteroposterior thickness
            {0.0, .LengthScale, 0.0},  // long axis            
            {0.0, 0.0, .WidthScale}    // mediolateral width
          }; 
          Offset = {0, 0, 0};
        };
        
        
      };
      
      // Patella uses the scaling function of the Thigh segment.
      AnyFolder &Patella = Thigh;
      
    }; // Left
    
    // Common law for the upper body
    // *****************************
    
    AnyFolder Pelvis = {
      AnyFloat LengthScale = ...Anthropometrics.SegmentScaleFactors.Pelvis.LengthScale;
      AnyFloat DepthScale  = ...Anthropometrics.SegmentScaleFactors.Pelvis.DepthScale;
      AnyFloat WidthScale  = ...Anthropometrics.SegmentScaleFactors.Pelvis.WidthScale;

      AnyFunTransform3DLin ScaleFunction = {
        ScaleMat = diag({.DepthScale, .LengthScale, .WidthScale});
        AnyMatrix ScaleMatInverse = diag({1/.DepthScale, 1/.LengthScale, 1/.WidthScale}); 
        Offset = {0, 0, 0};
      };
    };
    
    AnyFolder Lumbar = {
      AnyFloat LengthScale = ...Anthropometrics.SegmentScaleFactors.Lumbar.LengthScale;
      AnyFloat DepthScale  = ...Anthropometrics.SegmentScaleFactors.Lumbar.DepthScale;
      AnyFloat WidthScale  = ...Anthropometrics.SegmentScaleFactors.Lumbar.WidthScale;

      AnyFloat OriginUnscaled ??= warn(
        0, "To ensure continuity in the scaling law the lumbar origin must be specified"
      );

      AnyFunTransform3DLin ScaleFunction = {
        ScaleMat = diag({.DepthScale, .LengthScale, .WidthScale});
        AnyMatrix ScaleMatInverse = diag({1/.DepthScale, 1/.LengthScale, 1/.WidthScale});
      
        Offset = (
          ..Pelvis.ScaleFunction(.OriginUnscaled) - (.OriginUnscaled * ScaleMat')
        ) * ScaleMatInverse;
      };
    };

    AnyFolder Thorax = {
      AnyFloat LengthScale = ...Anthropometrics.SegmentScaleFactors.Thorax.LengthScale;
      AnyFloat DepthScale  = ...Anthropometrics.SegmentScaleFactors.Thorax.DepthScale;
      AnyFloat WidthScale  = ...Anthropometrics.SegmentScaleFactors.Thorax.WidthScale;
      
      AnyFloat OriginUnscaled ??= warn(
        0, "To ensure continuity in the scaling law the thoracic origin must be specified"
      );

      AnyFunTransform3DLin ScaleFunction = {
        ScaleMat = diag({.DepthScale, .LengthScale, .WidthScale}); 
        AnyMatrix ScaleMatInverse = diag({1/.DepthScale, 1/.LengthScale, 1/.WidthScale});

        Offset = (
          ..Lumbar.ScaleFunction(.OriginUnscaled) - (.OriginUnscaled * ScaleMat')
        ) * ScaleMatInverse;
      };      
    };
    
    AnyFolder Head = {
      AnyFloat LengthScale = ...Anthropometrics.SegmentScaleFactors.Head.LengthScale;
      AnyFloat DepthScale  = ...Anthropometrics.SegmentScaleFactors.Head.DepthScale;
      AnyFloat WidthScale  = ...Anthropometrics.SegmentScaleFactors.Head.WidthScale;
      
      AnyFunTransform3DLin ScaleFunction = {
        ScaleMat = diag({.DepthScale, .LengthScale, .WidthScale}); 
        AnyMatrix ScaleMatInverse = diag({1/.DepthScale, 1/.LengthScale, 1/.WidthScale});
        Offset = {0, 0, 0};
      };      
    };
    
    AnyFolder Cervical = {
      AnyFloat LengthScale = ...Anthropometrics.SegmentScaleFactors.Neck.LengthScale;
      AnyFloat DepthScale  = ...Anthropometrics.SegmentScaleFactors.Neck.DepthScale;
      AnyFloat WidthScale  = ...Anthropometrics.SegmentScaleFactors.Neck.WidthScale;
      
      AnyFloat OriginUnscaled ??= warn(
        0, "To ensure continuity in the scaling law the cervical origin must be specified"
      );

      AnyFunTransform3DLin ScaleFunction = {
        ScaleMat = diag({.DepthScale, .LengthScale, .WidthScale}); 
        AnyMatrix ScaleMatInverse = diag({1/.DepthScale, 1/.LengthScale, 1/.WidthScale});

        Offset = (
          ..Thorax.ScaleFunction(.OriginUnscaled) - (.OriginUnscaled * ScaleMat')
        ) * ScaleMatInverse;
      };   
    };
  };