Diff of /Docs/Scaling/lesson1.md [000000] .. [38ba34]

Switch to unified view

a b/Docs/Scaling/lesson1.md
1
# Lesson 1: Joint to Joint Scaling Methods
2
3
This lesson covers five of the scaling laws available in AnyBody:
4
5
- `_SCALING_STANDARD_` (scale to a standard size)
6
- `_SCALING_NONE_` (do not scale)
7
- `_SCALING_UNIFORM_` (scale equally in all directions; input is joint to
8
  joint distances)
9
- `_SCALING_LENGTHMASS_` (scale taking mass into account; input is joint to
10
  joint distances and mass)
11
- `_SCALING_LENGTHMASSFAT_` (scale taking mass and fat into account; input
12
  is joint to joint distances)
13
14
## ScalingStandard
15
16
This scaling law produces a model with the default parameters for mass and size
17
(corresponding roughly to the 50th percentile European male). It is used by
18
default for non-specific models, or when there is no data available about the
19
modeled subject. This law has no input parameter to modify.
20
21
With the AnyBody Modeling System you already have a repository of models
22
available; for details please see the AnyBody Assistant available from
23
the menu. Let us practice, as a starting point for this tutorial, please
24
find this model:
25
26
```{image} _static/lesson1/ScalingDisplayHelp.png
27
```
28
29
To use this law you do not need to do anything at all; however, for
30
demonstration purposes the scaling law configuration parameter (BM_SCALING)
31
will be set to use the default value:
32
33
```AnyScriptDoc
34
/*------------- SCALING CONFIGURATION SECTION --------------------*/
35
36
// Scaling laws using joint to joint measures
37
   §#define BM_SCALING _SCALING_STANDARD_§
38
//  #define BM_SCALING _SCALING_NONE_
39
//  #define BM_SCALING _SCALING_UNIFORM_
40
//  #define BM_SCALING _SCALING_LENGTHMASS_
41
//  #define BM_SCALING _SCALING_LENGTHMASSFAT_
42
//  #define BM_SCALING _SCALING_XYZ_
43
44
//--------------- END OF SCALING CONFIGURATION -------------------
45
```
46
47
Now load the model and open a Model View window. You will see the
48
standing model with the standard size.
49
50
```{image} _static/lesson1/ScalingStandardFront.jpg
51
:width: 49%
52
```
53
54
```{image} _static/lesson1/ScalingStandardBack.jpg
55
:width: 49%
56
```
57
58
## ScalingNone
59
60
This particular scaling law can be used for the studies, which require the unscaled cadaveric
61
datasets, which were used for the construction of the body parts. Please enable the \_SCALING_NONE\_
62
option in order to switch to this scaling law.
63
64
```AnyScriptDoc
65
/*------------- SCALING CONFIGURATION SECTION --------------------*/
66
67
// Scaling laws using joint to joint measures
68
§#define BM_SCALING _SCALING_NONE_§
69
//  #define BM_SCALING _SCALING_UNIFORM_
70
//  #define BM_SCALING _SCALING_LENGTHMASS_
71
//  #define BM_SCALING _SCALING_LENGTHMASSFAT_
72
//  #define BM_SCALING _SCALING_XYZ_
73
74
```
75
76
The result will not noticeably change as compared to the ScalingStandard, but minor differences
77
can be observed when looking at the actual locations of the muscle attachment sites and so on.
78
79
## Working with known body part dimensions
80
81
When modelling a specific person with known anthropometric factors, e.g. weight,
82
height, body part lengths, etc., these details need to be incorporated into the model.
83
In this case \_SCALING_STANDARD\_ and \_SCALING_NONE\_ are not applicable, since they
84
correspond to predetermined human sizes and weights, which cannot be overwritten.
85
86
For these purposes a number of additional scaling laws were implemented, which
87
all share an input mechanism for subject-specific measurements. This mechanism
88
lets the user overwrite the height, weight, fat percentage, and individual
89
segmental measurements or scale factors. This is done like below:
90
91
```AnyScriptDoc
92
/*------------- SCALING CONFIGURATION SECTION --------------------*/
93
94
// Scaling laws using joint to joint measures
95
§//  #define BM_SCALING _SCALING_NONE_§
96
§    #define BM_SCALING _SCALING_UNIFORM_§
97
//  #define BM_SCALING _SCALING_LENGTHMASS_
98
...
99
// Example of how to overwrite the default values
100
§//  Main.HumanModel.Anthropometrics.BodyHeight = 1.8;§
101
§//  Main.HumanModel.Anthropometrics.BodyMass = 80;§
102
```
103
104
The above line shows how it can be overwritten from, say, the Main folder.
105
We cannow easily personalize the model using anthropometric measurements.
106
107
### Do I need to overwrite all the anthropometric variables?
108
109
No, you do not need to overwrite all the anthropometric variables. The implementation allows you to overwrite the ones you need. For example, if you only know the body mass and height, you can overwrite only these two variables and the rest will be calculated automatically.
110
111
## ScalingUniform
112
113
This law allows you to define the total weight of the model and the
114
individual sizes of the bones. The length of each bone is defined as a
115
joint to joint distance and the bone is then scaled in three dimensions
116
proportionally to its length. To use this law you must change the
117
scaling parameter to be \_SCALING_UNIFORM\_.
118
119
In the previous section we showed how this can be done. Please do so, then load the
120
model and have a look at the Model View window. Notice that the body size did
121
not change from the standard scaling version. This is because the default values
122
for segment masses and sizes in this file are the same as the standard values.
123
But if you change them, the model will scale according to your specifications.
124
125
Let us try to change the mass of the body. First, inspect the *BodyMass* variable in the Model Tree window.
126
You can find it at `Main.HumanModel.Anthropometrics.BodyMass`.
127
The default value is 75 kg.
128
129
Try changing it to 90 kg by adding the following to your main file:
130
131
```AnyScriptDoc
132
§Main.HumanModel.Anthropometrics.BodyMass = 90;§
133
```
134
135
Now load the model again. Once again the size
136
of the body did not change. In the ScalingUniform law, the `BodyMass`
137
parameter controls the mass of the segments but not their sizes. As shown
138
previously the overall body mass is distributed to each segment.
139
140
So the `BodyMass` parameter only controls the segment masses. The size
141
of the model is controlled by another list of variables defining the
142
lengths of the different bones. The length of each segment can be set
143
independently, for example we can increase the length of the thigh
144
by adding the following line to the main file:
145
146
```AnyScriptDoc
147
§Main.HumanModel.Anthropometrics.SegmentDimensions.Right.ThighLength = 0.626§;
148
```
149
150
Load the model again and have a look at the Model View window. The
151
femur bone is now bigger. It has been scaled uniformly in 3 directions
152
according to the defined length. Notice that we only changed the size
153
of the femur and not the other bones, so the femur looks unreasonably
154
big compared to the rest of the body. To avoid results such as this,
155
it is important to feed those variables with consistent data rooted in
156
real anthropometry.
157
158
```{image} _static/lesson1/LargeFemurFront.jpg
159
:width: 49%
160
```
161
162
Let us apply a more reasonable size. Please change the default values
163
to the following set of consistent measures:
164
165
```AnyScriptDoc
166
§Main.HumanModel.Anthropometrics.SegmentDimensions.PelvisWidth = 0.180§;
167
§Main.HumanModel.Anthropometrics.SegmentDimensions.HeadHeight = 0.169§;
168
§Main.HumanModel.Anthropometrics.SegmentDimensions.TrunkHeight = 0.754§;
169
170
§Main.HumanModel.Anthropometrics.SegmentDimensions.Right.UpperArmLength = 0.405§;
171
§Main.HumanModel.Anthropometrics.SegmentDimensions.Right.LowerArmLength =0.316§;
172
Main.HumanModel.Anthropometrics.SegmentDimensions.Right.ThighLength = §0.548§;
173
§Main.HumanModel.Anthropometrics.SegmentDimensions.Right.ShankLength = 0.551§;
174
§Main.HumanModel.Anthropometrics.SegmentDimensions.Right.FootLength = 0.243§;
175
176
§Main.HumanModel.Anthropometrics.SegmentDimensions.Left.UpperArmLength = 0.405§;
177
§Main.HumanModel.Anthropometrics.SegmentDimensions.Left.LowerArmLength =0.316§;
178
§Main.HumanModel.Anthropometrics.SegmentDimensions.Left.ThighLength = 0.548§;
179
§Main.HumanModel.Anthropometrics.SegmentDimensions.Left.ShankLength = 0.551§;
180
§Main.HumanModel.Anthropometrics.SegmentDimensions.Left.FootLength = 0.243§;
181
182
```
183
184
```{image} _static/lesson1/ScalingUniformFront.jpg
185
:width: 49%
186
```
187
188
When you reload the model you should see a tall body and with
189
proportionate sizes of the segments. If you can't see the difference
190
from the standard size model, notice how the feet are now sticking down
191
below the reference frame.
192
193
It should be obvious that this type of scaling requires good anthropometric data
194
to give reasonable results. But such data is not always easily available. To
195
help with this, the default values of the `_SCALING_UNIFORM_` law is implemented
196
in a way that it only takes as input the body mass and the body height and
197
subsequently scales all the segment lengths uniformly according to the defined
198
body height. This may not give you a model where each bone matches a given
199
subject, but it can be a reasonable estimate in cases where only the overall
200
mass and height of the body is known. Try to comment out these lines again:
201
202
```AnyScriptDoc
203
§//Main.HumanModel.Anthropometrics.SegmentDimensions.PelvisWidth = 0.180§;
204
§//Main.HumanModel.Anthropometrics.SegmentDimensions.HeadHeight = 0.169§;
205
§//Main.HumanModel.Anthropometrics.SegmentDimensions.TrunkHeight = 0.754§;
206
207
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Right.UpperArmLength = 0.405§;
208
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Right.LowerArmLength =0.316§;
209
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Right.ThighLength = 0.548§;
210
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Right.ShankLength = 0.551§;
211
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Right.FootLength = 0.243§;
212
213
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Left.UpperArmLength = 0.405§;
214
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Left.LowerArmLength =0.316§;
215
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Left.ThighLength = 0.548§;
216
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Left.ShankLength = 0.551§;
217
§//Main.HumanModel.Anthropometrics.SegmentDimensions.Left.FootLength = 0.243§;
218
219
```
220
221
Now it is easy to scale the body down to represent a small person.
222
Use thefollowing line to set the body height to 1.65 m and the body mass to 60 kg:
223
224
```AnyScriptDoc
225
§Main.HumanModel.Anthropometrics.BodyHeight = 1.65;§
226
§Main.HumanModel.Anthropometrics.BodyMass = 60;§
227
```
228
229
When you load the model you will see all the segments automatically
230
scaling down. The mass is also scaled, but as we said previously this is
231
not visible graphically with this scaling law.
232
233
## Scaling based on length and mass
234
235
This law scales the size of the body according not only to the segment
236
lengths but also to the segments masses, so unlike the ScalingUniform
237
law it provides the opportunity to define tall and skinny people or
238
small and squat people. Like in the ScalingUniform law, the total body
239
mass is defined by the variable `BodyMass`. Just as previously, this
240
total mass is then divided between the segments by means of
241
coefficients, but the size scaling is different. Let us investigate it.
242
In the main file, please choose the ScalingLengthMass law and switch
243
back to the AnyMan file:
244
245
```AnyScriptDoc
246
// Scaling laws using joint to joint measures
247
§//#define BM_SCALING _SCALING_UNIFORM_
248
  #define BM_SCALING _SCALING_LENGTHMASS_§
249
//  #define BM_SCALING _SCALING_LENGTHMASSFAT_
250
...
251
```
252
253
In the Main file, switch back the segment length values to the initial
254
ones (by outcommenting the added lines) and increase the body mass to 110 kg:
255
256
```AnyScriptDoc
257
Main.HumanModel.Anthropometrics.BodyMass = §110§;
258
```
259
260
Load the model and look at the Model View. Our model looks strange!
261
The body is deformed and looks a bit like a Neanderthal.
262
263
```{image} _static/lesson1/ScalingLengthMassFront.jpg
264
:width: 49%
265
```
266
267
```{image} _static/lesson1/ScalingLengthMassBack.jpg
268
:width: 49%
269
```
270
271
What really happens is that the ScalingLengthMass law scales the sizes
272
of the segments according to their masses, but only in two directions.
273
The third scaling direction is controlled by the segment length
274
variables. Unlike in the ScalingUniform law, the segment length
275
variables just control one scaling direction and not the two others.
276
277
So to have a normal-looking model we have to adjust segment mass and
278
length simultaneously. As the mass we defined is 110 kg, a height of
279
1.98 m could be reasonable:
280
  
281
```AnyScriptDoc
282
§Main.HumanModel.Anthropometrics.BodyHeight = 1.98§;
283
```
284
285
```{image} _static/lesson1/ScalingLengthMassCorrectFront.jpg
286
:width: 49%
287
```
288
289
```{image} _static/lesson1/ScalingLengthMassCorrectBack.jpg
290
:width: 49%
291
```
292
293
When you load the model you will see a more *Homo sapiens*-looking
294
figure corresponding to a large 110kg and 1.98 m person.
295
296
We mentioned at the beginning of the tutorial that the muscle strength
297
is also scaled. It is time to have a look at it and compare muscle
298
forces from different scaled models. To do so we need a body with
299
muscles. Please add the muscles by commenting out the following section
300
of the general configuration block in the `BodyModelConfiguration.any` file:
301
302
```AnyScriptDoc
303
§//#ifndef BM_LEG_MUSCLES_BOTH
304
//  #define BM_LEG_MUSCLES_BOTH OFF
305
//#endif
306
//#ifndef BM_ARM_MUSCLES_BOTH
307
//  #define BM_ARM_MUSCLES_BOTH OFF
308
//#endif
309
//#ifndef BM_TRUNK_MUSCLES
310
//  #define BM_TRUNK_MUSCLES OFF
311
//#endif
312
    §
313
```
314
315
We also need to add some forces to the model in order to make it react
316
and see muscle activity. This can be done by adding the following lines
317
to the Environment.any file. This piece of code creates a force of 50 N
318
on each hand and displays it in the model view:
319
320
```AnyScriptDoc
321
AnyFolder Environment = {
322
  AnyFixedRefFrame GlobalRef = {Origin = {0.0,0.0,0.0};};
323
};
324
 §
325
AnyForce3D RightHandLoad = {
326
    F = {0, -50, 0};
327
 AnyRefFrame &Hand = Main.HumanModel.BodyModel.Right.ShoulderArm.Seg.Glove;
328
};
329
330
  AnyForce3D LeftHandLoad = {
331
    F = {0, -50, 0};
332
    AnyRefFrame &Hand = Main.HumanModel.BodyModel.Left.ShoulderArm.Seg.Glove;
333
  };
334
335
  AnyDrawVector DrawRightLoad = {
336
    Vec = .RightHandLoad.F*0.015;
337
    PointAway = On;
338
    GlobalCoord = On;
339
    Line = {
340
      Style = Line3DStyleFull;
341
      Thickness = 0.01;
342
      RGB = {0, 0, 0};
343
      End = {
344
        Style = Line3DCapStyleArrow;
345
        RGB = {0, 0, 0};
346
        Thickness = 0.025;
347
        Length = 0.025;
348
      };
349
    };
350
    AnyRefFrame &Hand = .RightHandLoad.Hand;
351
  };
352
353
  AnyDrawVector DrawLeftLoad = {
354
    Vec = .LeftHandLoad.F*0.015;
355
    PointAway = On;
356
    GlobalCoord = On;
357
    Line = {
358
      Style = Line3DStyleFull;
359
      Thickness = 0.01;
360
      RGB = {0, 0, 0};
361
      End = {
362
        Style = Line3DCapStyleArrow;
363
        RGB = {0, 0, 0};
364
        Thickness = 0.025;
365
        Length = 0.025;
366
      };
367
    };
368
    AnyRefFrame &Hand = .LeftHandLoad.Hand;
369
  };§
370
```
371
372
```{image} _static/lesson1/AppliedForcesFront.jpg
373
:width: 49%
374
```
375
376
We are now ready to run an inverse dynamic analysis with our large 110kg
377
model. Please load the model and run the RunApplication operation from
378
the Operations tab. Then open a chart window to investigate the
379
results. By browsing your way to the MaxMuscleActivity in Main.Study you
380
should get the following value:
381
382
```{image} _static/lesson1/MaxMuscleActivity198cm110kg.jpg
383
```
384
385
We will now try to model a small person to compare his muscle activity
386
with the one we have just plotted. Let us enter the
387
parameters for a 65kg and 1.70 m person:
388
389
```AnyScriptDoc
390
Main.HumanModel.Anthropometrics.BodyHeight = §1.70§;
391
Main.HumanModel.Anthropometrics.BodyMass = §65§;
392
```
393
394
We can load the model, run the inverse dynamics analysis and check the
395
resultant value.
396
397
```{image} _static/lesson1/MaxMuscleActivity170cm65kg.jpg
398
```
399
400
For the same load on the hands (50 N) the tall heavy model has a muscle
401
activity of 53.3 %, whereas the short model reaches 67.7 % of muscle
402
activity. So our small model is definitely weaker than the tall one.
403
404
## ScalingLengthMassFat
405
406
Most scaled models used for practical investigations use the
407
ScalingLengthMassFat law. It works exactly like the ScalingLengthMass
408
but with an additional parameter: It takes the fat percentage of the
409
body into account. The argument is that the fat percentage adds to the
410
mass of each segment and in the ScalingLengthMass law would lead an
411
estimation of more muscle tissue rather than fat tissue. So the fat
412
percentage in this scaling model does not modify the mass or the size
413
of the body. It is only used to calculate the strength of the muscles.
414
Between two persons of similar segment masses, the one with higher fat
415
percentage will have less muscle strength, because the volume
416
otherwise occupied by the muscles is replaced by inactive fat.
417
418
So the mass and size scales are controlled as in the ScalingLengthMass
419
model by the `BodyMass` variable and all the segment length variables
420
respectively. The fat percentage is controlled in concert by the
421
variables `BodyHeight` and `BodyMass`. These two variables are used to
422
calculate the BMI (Body-Mass Index), and the BMI is used to calculate
423
the fat percentage of the body according to Frankenfield, D. C.; Rowe,
424
W. A.; Cooney, R. N.; Smith, J. S. & Becker, D. (2001): Limits of body
425
mass index to detect obesity and predict body composition, Nutrition
426
17(1), 26-30.
427
428
```AnyScriptDoc
429
// Default values for the fat percentage found in (ammr\Body\AAUHuman\Scaling\DefaultAnthropometrics.any)
430
AnyVar BMI = AnthroData.Body_Mass/(AnthroData.body_height*AnthroData.body_height);
431
AnyVar FatPercent = (-0.09 + 0.0149*BMI - 0.00009 *BMI*BMI)*100; //Estimation from Frankenfield et al. (2001) valid for men
432
```
433
434
Obviously it is important to input the correct height
435
of the body when using this law. Please notice, however, that it is
436
very easy for the user to substitute the formula for the fat
437
percentage by another equation or possibly by a fixed number for
438
modeling of a particular individual for whom the fat percentage has
439
been measured directly.
440
441
The resultant value for the fat percentage is then directly used to
442
compute an estimate of the strength of each muscle in the model.
443
444
This advanced strength scaling makes a significant difference for the
445
model that is short and heavy. The ScalingLengthMass law tends to
446
over-estimate the strength of those models, because they often have a
447
high fat percentage that is not taken into account by the law.
448
449
We will try to illustrate this by plotting the muscle activity of the
450
same short and heavy model with both ScalingLengthMass and
451
ScalingLengthMassFat laws. We will begin by adjusting the anthropometrics
452
to match a 90kg and 1.70 m person:
453
454
```AnyScriptDoc
455
Main.HumanModel.Anthropometrics.BodyMass = §90§;
456
```
457
458
Then please load the model and re-run the application. Notice that we
459
should still be using the ScalingLengthMass law. You should now get
460
the following value for the maximum muscle activity.
461
462
```{image} _static/lesson1/MaxMuscleActivity170cm90kgLM.jpg
463
```
464
465
The next step is to run an analysis with the same body but with the
466
ScalingLengthMassFat law:
467
468
```AnyScriptDoc
469
// Scaling laws using joint to joint measures
470
//  #define BM_SCALING _SCALING_UNIFORM_
471
§//  #define BM_SCALING _SCALING_LENGTHMASS_
472
#define BM_SCALING _SCALING_LENGTHMASSFAT_§
473
```
474
475
Once again load the model and run the inverse dynamics
476
analysis by executing the RunApplication operation. We should get the
477
following results:
478
479
```{image} _static/lesson1/MaxMuscleActivity170cm90kgLMF.jpg
480
```
481
482
If we compare these two activity values, the difference is clear. The
483
ScalingLengthMassFat law is increasing the muscle activity by
484
approximately 16 % in this case, from 50 % to 66 %. This shows the
485
limits of the ScalingLengthMass law for extreme cases.
486
ScalingLengthMassFat is able to cover a wider range of cases while
487
keeping its accuracy.
488
489
This completes scaling Lesson 1: Joint to joint scaling methods.
490
491
:::{admonition} **Next lesson:**
492
:class: seealso
493
{doc}`lesson2`.
494
:::