Skip to content

Commit 4f23c52

Browse files
authored
Merge pull request #64 from AnyBody/ScalingTutorialAdjustments
Adding clarifications and extra explanations to Scaling Tutorial
2 parents a324909 + 6356669 commit 4f23c52

4 files changed

Lines changed: 79 additions & 25 deletions

File tree

Scaling/_static/lesson2/image4.png

1.15 KB
Loading

Scaling/index.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ instructions on how to configure the model to use the built-in *scaling laws*
1616
and provide general anthropometric information.
1717
:::
1818

19+
Scaling schemes described in the AMMR documentation are based on
20+
anthropometric measurements and affine transform scaling. Such schemes
21+
are good assumptions when more accurate measurements are not feasible or not
22+
available. Therefore, these schemes are used quite often. However, a
23+
natural next step would be to improve the precision of a model by
24+
utilizing subject-specific geometry available from the medical images. Medical images
25+
contain more subject-specific information about the bone shapes and local
26+
deformities that cannot be handled by the anthropometric regression
27+
equations.
28+
1929
This tutorial introduces an advanced procedure of model personalization by means of
2030
nonlinear morphing for both, bone surface and relevant soft tissue attachment sites,
2131
to take a subject-specific shape. In this example, bone geometries segmented from medical
@@ -32,6 +42,6 @@ with the basic scaling laws and concepts presented in the
3242
```{toctree}
3343
:maxdepth: 1
3444
35-
Lesson 1: Scaling based on medical images <lesson1>
36-
Lesson 2: Including a custom scaling function into your model <lesson2>
45+
Lesson 1: Scaling Based on Medical Images <lesson1>
46+
Lesson 2: Including a Custom Scaling Function into Your Model <lesson2>
3747
```

Scaling/lesson1.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,39 @@
33

44
# Lesson 1: Personalizing Individual Segments Based on Geometric Data from Medical Images
55

6+
:::{note}
67
This tutorial presumes that you have read the [AMMR documentation](https://anyscript.org/ammr/Scaling/intro.html)
78
and know how to personalize your model using information about height, weight,
89
and individual segment lengths.
10+
:::
11+
12+
In this lesson you will learn how to personalize a bone segment (the femur) so
13+
a generic model matches a specific person’s anatomy from medical imaging. We do
14+
this by scaling the bone surface, starting with basic affine
15+
transformations and advancing to more sophisticated nonlinear methods.
916

10-
This lesson introduces an advanced approach to scaling based on a sequence of
17+
You will be introduced to an advanced approach to scaling based on a sequence of
1118
affine and non-affine transformations. Each of these transforms is constructed
1219
based either on subject-specific geometry or on a set of landmarks selected on
1320
the bone surface. As opposed to the simple scaling laws explained in the AMMR
1421
documentation, this lesson is rather methodological than conceptual and provides
1522
a good overview of how to pipeline and combine different 3D transforms to obtain
1623
subject-specific morphing and registration between frames of reference.
1724

18-
## Linear Point-Based Scaling
25+
Shortly explained, the sections in this lesson are as follows:
26+
27+
- **Linear Point-Based Scaling**: Using a *set of matching landmarks (points)* on
28+
the source and target geometries to construct a *linear* transform
29+
(move, rotate, scale, and skew) that scales the source into the target
30+
geometry.
1931

20-
Scaling schemes described in the AMMR documentation are based on
21-
anthropometric measurements and affine transform scaling. Such schemes
22-
are good assumptions when more accurate measurements are not feasible or not
23-
available. Therefore, these schemes are used quite often. However, a
24-
natural next step would be to improve the precision of a model by
25-
utilizing subject-specific geometry available from the medical images. Medical images
26-
contain more subject-specific information about the bone shapes and local
27-
deformities that cannot be handled by the anthropometric regression
28-
equations.
32+
- **Landmark-Based Nonlinearities**: Refining the scaling by adding a *nonlinear*
33+
transform fitted to a *new set of matching landmarks (points)*.
34+
35+
- **Surface-Based Nonlinearities**: Further refining the scaling by adding a
36+
*nonlinear* transform fitted to the *surfaces* of the source and target geometries.
37+
38+
## Linear Point-Based Scaling
2939

3040
The simplest inclusion of the subject-specific bone shape from medical
3141
image data is to find the affine (linear) transformation that fits a
@@ -101,6 +111,20 @@ step, we change the mode of the `AnyFunTransform3DLin2` object to
101111
:end-before: //# END SNIPPET 1
102112
```
103113

114+
:::{admonition} Tip for landmark selection
115+
:class: tip dropdown
116+
If you want to extract the coordinates of the points on the surfaces in *your own
117+
model*, you can use the open source software MeshLab, which can be downloaded
118+
{download}`here<https://www.meshlab.net/>`.
119+
120+
1. Import the STL surface into MeshLab
121+
2. Use the `PickPoints` tool to select points on the surface by right-clicking
122+
on the desired locations ![PickPoints](_static/lesson2/image4.png)
123+
3. Save the points to a file
124+
4. Open the saved file in a text editor and copy the coordinates of the points
125+
into your AnyScript model (be aware of the order of the x-, y-, and z-coordinates)
126+
:::
127+
104128
The selected points on the surface represent specific anatomical
105129
landmarks and points described in the comments of the AnyScript code.
106130
Final modification before we can use the constructed linear transform is

Scaling/lesson2.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@
33

44
# Lesson 2: Including a Custom Scaling Function into Your Model
55

6-
This lesson explains how we can use our own custom scaling function,
7-
which we designed in Lesson 1 and combine it with the overall human body scaling laws.
6+
This lesson explains how to use your own custom scaling function designed in
7+
Lesson 1 and combine it with the overall human body scaling laws, so
8+
anthropometric scaling and subject-specific scaling are combined.
9+
10+
Shortly explained, the sections in this lesson are as follows:
11+
12+
- **Prepare the base model**: Opening the Standing Human Model and preparing the
13+
model for subject-specific scaling.
14+
15+
- **Include your custom scaling function**: Add your custom scaling function
16+
to personalize a single segment (the femur).
17+
18+
- **Include a mirrored custom scaling function**: Apply the same custom scaling
19+
to the opposite femur by mirroring the original scaling function.
820

921
```{seealso}
1022
This lesson uses the human body scaling laws presented in the AMMR, thus
@@ -210,16 +222,24 @@ scaling law into the model.
210222
:width: 50%
211223
```
212224

213-
If we worked with a bone that does not have a controlateral pair, e.g.
214-
vertebrae, skull, etc., or just wanted to personalize a single side, we would
215-
continue with running the inverse dynamics. But as an exercise, we want to
216-
continue and scale the other side as well to ensure symmetry of the model.
217-
Normally, we would use the contralateral patient-specific bone and
218-
copy the scaling code. But, in our case, only one side was available. We will assume
219-
that the body is symmetric, which is only true up to a certain extent.
220-
So let us include a similar scaling for the corresponding mirrored pair.
221-
In the next section we will describe how to introduce mirroring to our
222-
scaling functions.
225+
:::{warning}
226+
It is important to note that the scaling function so far only personalizes a
227+
single bone (one femur). The rest of the body still uses the standard body
228+
model with anthropometric scaling laws.
229+
:::
230+
231+
If we worked with a bone that does not have a contralateral pair (e.g. vertebrae
232+
or skull), or if you intentionally personalize only one side of the human body,
233+
we would continue with running the inverse dynamics. However, for paired
234+
segments like the femur it is recommended to also scale the other side of the
235+
model to ensure symmetry of the body.
236+
237+
Best practice is to have patient-specific geometry for both sides and reuse the
238+
scaling code with the second dataset. But, in this tutorial, only one side is
239+
available, so we assume that the body is symmetric, which is only true up to a
240+
certain extent. So let us include a similar scaling for the corresponding
241+
mirrored pair. In the next section we will describe how to introduce mirroring
242+
to our scaling functions.
223243

224244
## Introducing a Mirrored Custom Scaling Function
225245

0 commit comments

Comments
 (0)