AnyBody™ Tutorials

Lesson 3: Scaling based on patient-specific landmarks

This tutorial presumes that you have completed Scaling tutorial Lesson 1: Joint to joint scaling methods and Scaling tutorial Lesson 2: Scaling based on external body measurements . They covered such methods as: ScalingStandard, ScalingUniform, ScalingLengthMass, ScalingLengthMassFat, ScalingUniformExt, ScalingLengthMassExt, and ScalingLengthMassFatExt.

This lesson introduces an advanced scaling method based on a non-affine transformation of a set of source landmarks into a set of target points using a radial basis function (RBF) approach.

Subject-specific scaling

Previously described scaling schemes are based on anthropometric measurements and an affine transform scaling. As such they do not reconstruct needed bone morphology to a very high level of detail, i.e. local deformities of certain bone features may not be covered by such scaling.

The scaling law described in this lesson is based on a surface approximation which must transform (not necessary in a linear manner) a set of given points (source landmarks) into a set of known subject-specific points (target landmarks). For this purpose the following approximation is constructed:

,

- where are the coefficients of the RBF functions , computed based on the source and target landmarks,

- is the polynomial of order

- is the RBF function, which can take one of the following forms:

o , Gaussian function, or

o Thin plate spline, or

o , Multiquadratic function, or other.

To define such a transform in AnyScript one can use a template provided by the AnyBody Modeling System:

AnyFunTransform3DRBF <ObjectName> = 
    {
      /*RBFDef = 
      {
      Type = RBF_Gaussian;
      Param = 1;
      };*/
      Points0 = ;
      //RBFCoefs = ;
      //PolynomDegree = -1;
      //PolynomCoefs = ;
      //PointDescriptions = ;
      //PointNames = ;
      //Points1 = ;
    };

The Points0 variable is a matrix (3 x k) of the source landmark coordinates, where k is the number of source points. Points1 is the matrix of target landmarks of the same size. These two entities alone define a 3D RBF transform.

PolynomDegree variable corresponds to the q degree of the polynomial term of the aforementioned approximation. Recommended degree is 1, i.e. a linear component of the approximation gives good results as it was observed empirically.

RBFDef.Type defines a type of the RBF function. Possible options are RBF_Gaussian (default), RBF_ThinPlate, RBF_Biharmonic, RBF_Triharmonic, RBF_MultiQuadratic, and RBF_InverseMultiQuadratic.

RBFDef.Param is a parameter mentioned in the definitions of various RBF functions. By varying this parameter it is possible to change the behaviour of a chosen RBF function, e.g. prescribe a local effect of the landmarks.

PointNames is a variable to give text identifiers for the landmarks. This can be used to output to landmarks to process in external packages. Similarly, PointDescriptions is an additional storage for more detailed information on how to locate the landmarks.

Alternative way to define an RBF transform is to specify the required approximation coefficients explicitly. This can be done by defining the RBFCoefs and PolynomCoefs variables. However, this is a very demanding and non-intuitive procedure and preferable way is to define the corresponding sets of landmarks.

Scaling example

This section describes a step-by-step procedure how to customize your model by utilizing given subject-specific morphology. This morphology, i.e. the bone surface, could be derived from a medical image of the subject. A number of image processing and segmentation packages, both commercial and open-source, are available to create STL surfaces from medical images. Having obtained the target STL surface it is possible to define points on it either in any CAD package or directly in the AnyBody Modeling System. Please note that the variables Points0 and Points1 of the AnyFunTransformRBF3D class have to be defined in the same reference frame, i.e. an initial registration of the objects has to be done (manually or programmatically).

For this example the L5 vertebra of the lumbar spine was used as the source surface. It was extracted from the standing model of the repository by selecting an export surface option of the corresponding AnyDrawSTL variable in the model tree view (see below):

A set of points is then selected to describe features of the vertebra, for this particular case the following anatomical features can be used:

Transverse processes (right and left)

Articular processes (right, left, inferior, and superior)

Spinal process

Vertebral body (anterior/exterior, superior/inferior, lateral)

Having found the coordinates of these landmarks, they are assigned to the Points0 variable:

Points0 =  
      {
        { 0.072462,     1.180805,    -0.036767},      // left transverse process
        { 0.072462,     1.180805,     0.036767},      // right transverse process
        { 0.044390,     1.173952,     0.000001},      // spinal process
        { 0.063322,     1.190380,    -0.022513},      // left superior articular process
        { 0.063322,     1.190380,     0.022513},      // right superior articular process
        { 0.065274,     1.155646,    -0.013893},      // left inferior articular process     
        { 0.065274,     1.155646,     0.013893},      // right inferior articular process     
        { 0.117145,     1.179924,     0.000001},      // anterior superior point of vert. body
        { 0.107595,     1.150322,     0.000001},      // anterior inferior point of vert. body
        { 0.085754,     1.186174,     0.000001},      // posterior superior point of vert. body
        { 0.081586,     1.161476,     0.000001},      // posterior inferior point of vert. body
        { 0.099929,     1.182663,    -0.023310},      // left superior lateral point of vert. body
        { 0.099929,     1.182663,     0.023310},      // right superior lateral point of vert. body           
        { 0.093791,     1.158033,    -0.023417},      // left inferior lateral point of vert. body
        { 0.093791,     1.158033,     0.023417}       // right inferior lateral point of vert. body
      };

For the demonstration purpose a random displacement field is used to simulate the subject-specific morphing scenario. Each component of the source landmark coordinates is randomly shifted by a value in a range between -3 and 3 mm. Points1 are defined as a sum of the Points0 and the randomization matrix:

AnyMatrix randomshift = 
      {
        {-0.003895,    -0.001451,     0.001701},
        {-0.008618,     0.001028,    -0.002344},
        {-0.001458,     0.002645,    -0.002440},
        {-0.002999,    -0.002629,    -0.001487},
        { 0.002042,    -0.001206,    -0.002876},
        {-0.002533,     0.002108,     0.002388},
        { 0.002364,    -0.001066,     0.001906},
        { 0.001912,     0.001885,    -0.000878},
        { 0.002069,    -0.001692,     0.001183},
        {-0.002830,    -0.001915,    -0.002315},
        {-0.002085,    -0.001003,    -0.002280},
        {-0.001388,     0.002440,    -0.002179},
        { 0.009382,     0.001788,    -0.001514},
        { 0.002813,     0.002817,     0.001695},
        {-0.002273,     0.002215,    -0.002401} 
      };
      Points1 = Points0 + randomshift;

Typically one would not use random or manually defined displacements as this is a time consuming and tedious procedure. It is possible to extract source landmarks using a Mimics-readable (by Materialize) XML file format, modify them in Mimics according to a CT scan/subjects geometry, and load back as target landmarks. This can be done in a loaded state of the model by accessing import/export options of AnyFunTransform3DRBF function:

Having done all of the above it is possible to use constructed scaling transform to morph the original vertebral geometry (red entities are source landmarks/surface, green entities corresponding target landmarks and result surface):

Please note, that successful morphing of the geometry does not change the behaviour of the model and inverse dynamics results the only thing that is changed is the visual representation of the model. However, the constructed transform can be used for customization of a particular segment and related nodes in an automated manner. To do so, one has to define all important nodes and their locations using a reference to the constructed transform please see an example:

<ANYSCRIPT>

AnySeg v5 = {

r0 = {0, 0, 0};

Mass = 0;

Jii = {0, 0, 0};

AnyFunTransform3D &Scale = .ScaleFunctionL5;

AnyRefNode org _ node = {

sRel = {0.095, 1.158, 0.0234};

AnyDrawNode a = {RGB = {0,1,1}; ScaleXYZ={1,1,1}*0.001;};

};

AnyRefNode scaled_node = {

sRel = .Scale({0.095, 1.158, 0.0234});

AnyDrawNode a = {RGB = {1,1,1}; ScaleXYZ={1,1,1}*0.001;}; };

};

< / ANYSCRIPT>

The following image shows what happens to a muscle/ligament attachment or any other node subjected to an RBF transform: a node defined on the original segment (grey) was morphed into (blue) similar to a source landmark (green) into the target landmark (red).

It is important to understand that this morphing law is sensitive to the selection of landmarks, their number, polynomial order, and the parameter of the RBF function. Thus, for a particular task it might be necessary to select and adjust the landmarks several times to achieve better fit. This morphing function is provided to facilitate non-linear scaling, however, it does not guarantee complete match of the source and target as it is just an approximation function. Moreover, using this transform for adjusting nodes as shown on the previous figure will work best on interpolation tasks rather than extrapolation.

The complete model of this example can be downloaded as a zip file: ScalingRBF.zip .

AnyBody Technology A/S · Niels Jernes vej 10 · DK-9220 Aalborg Ø · Denmark · Tel. +45 9635 4286 · Fax. +45 9635 4599            Sitemap