Switch to unified view

a/README.md b/README.md
1
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5075982.svg)](https://doi.org/10.5281/zenodo.5075982)
1
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5075982.svg)](https://doi.org/10.5281/zenodo.5075982)
2
![visitors](https://visitor-badge.laobi.icu/badge?page_id=modenaxe.msk_bone_deformation)<!-- omit in toc -->
2
![visitors](https://visitor-badge.laobi.icu/badge?page_id=modenaxe.msk_bone_deformation)<!-- omit in toc -->
3
3
4
# Table of contents <!-- omit in toc -->
4
# Table of contents <!-- omit in toc -->
5
5
6
- [Bone deformation tool](#bone-deformation-tool)
6
- [Bone deformation tool](#bone-deformation-tool)
7
- [Requirements and setup](#requirements-and-setup)
7
- [Requirements and setup](#requirements-and-setup)
8
- [How to use the bone deformation tool](#how-to-use-the-bone-deformation-tool)
8
- [How to use the bone deformation tool](#how-to-use-the-bone-deformation-tool)
9
- [How the bone deformation tool works](#how-the-bone-deformation-tool-works)
9
- [How the bone deformation tool works](#how-the-bone-deformation-tool-works)
10
- [Which models can I deform with this MATLAB tool?](#which-models-can-i-deform-with-this-matlab-tool)
10
- [Which models can I deform with this MATLAB tool?](#which-models-can-i-deform-with-this-matlab-tool)
11
- [Definition of femoral version and tibial torsion angles](#definition-of-femoral-version-and-tibial-torsion-angles)
11
- [Definition of femoral version and tibial torsion angles](#definition-of-femoral-version-and-tibial-torsion-angles)
12
  - [Baseline angles for the Rajagopal full body model](#baseline-angles-for-the-rajagopal-full-body-model)
12
  - [Baseline angles for the Rajagopal full body model](#baseline-angles-for-the-rajagopal-full-body-model)
13
- [Examples of use](#examples-of-use)
13
- [Examples of use](#examples-of-use)
14
  - [Femoral anteversion](#femoral-anteversion)
14
  - [Femoral anteversion](#femoral-anteversion)
15
  - [Femoral torsion](#femoral-torsion)
15
  - [Femoral torsion](#femoral-torsion)
16
  - [Tibial torsion](#tibial-torsion)
16
  - [Tibial torsion](#tibial-torsion)
17
- [Provided example scripts](#provided-example-scripts)
17
- [Provided example scripts](#provided-example-scripts)
18
- [Video summary of the associated publication](#video-summary-of-the-associated-publication)
18
- [Video summary of the associated publication](#video-summary-of-the-associated-publication)
19
- [How to contribute](#how-to-contribute)
19
- [How to contribute](#how-to-contribute)
20
- [Contributors](#contributors)
20
- [Contributors](#contributors)
21
21
22
# Bone deformation tool
22
# Bone deformation tool
23
23
24
This repository is used for sharing a MATLAB toolbox that enables researcher in biomechanics to modify their generic musculoskeletal models by applying arbitrary torsional profiles to the long axis of the bone model.
24
This repository is used for sharing a MATLAB toolbox that enables researcher in biomechanics to modify their generic musculoskeletal models by applying arbitrary torsional profiles to the long axis of the bone model.
25
25
26
The MATLAB tool works with musculoskeletal models in the format provided for the software for biomechanical analyses [OpenSim](https://opensim.stanford.edu/).
26
The MATLAB tool works with musculoskeletal models in the format provided for the software for biomechanical analyses [OpenSim](https://opensim.stanford.edu/).
27
27
28
The tool is introduced and described in the following publication, which we invite you to cite if you are using the content of this repository for your research or teaching:
28
The tool is introduced and described in the following publication, which we invite you to cite if you are using the content of this repository for your research or teaching:
29
29
30
```bibtex
30
```bibtex
31
@article{Modenese2021bonedef,
31
@article{Modenese2021bonedef,
32
  title={Dependency of Lower Limb Joint Reaction Forces on Femoral Version},
32
  title={Dependency of Lower Limb Joint Reaction Forces on Femoral Version},
33
  author={Luca Modenese, Martina Barzan and Christopher P. Carty},
33
  author={Luca Modenese, Martina Barzan and Christopher P. Carty},
34
  journal={Gait & Posture},
34
  journal={Gait & Posture},
35
  volume = {88},
35
  volume = {88},
36
  pages = {318-321},
36
  pages = {318-321},
37
  doi = {https://doi.org/10.1016/j.gaitpost.2021.06.014},
37
  doi = {https://doi.org/10.1016/j.gaitpost.2021.06.014},
38
  year={2021},
38
  year={2021},
39
  keywords = {Femoral version, Femoral anteversion, Musculoskeletal modeling, Tibiofemoral contact force, Knee Loading, Femur, Walking}
39
  keywords = {Femoral version, Femoral anteversion, Musculoskeletal modeling, Tibiofemoral contact force, Knee Loading, Femur, Walking}
40
}
40
}
41
```
41
```
42
The [paper is open access](https://doi.org/10.1016/j.gaitpost.2021.06.014) and all the materials and scripts used for that manuscript are available at [this repository](https://github.com/modenaxe/femoral-anteversion-paper). 
42
The [paper is open access](https://doi.org/10.1016/j.gaitpost.2021.06.014) and all the materials and scripts used for that manuscript are available at [this repository](https://github.com/modenaxe/femoral-anteversion-paper). 
43
Please note that version of the tool used in the reproducibility repository is [v0.1](https://github.com/modenaxe/msk-bone-deformation/releases/tag/v0.1), while the latest version is always recommended for new users.
43
Please note that version of the tool used in the reproducibility repository is [v0.1](https://github.com/modenaxe/msk-bone-deformation/releases/tag/v0.1), while the latest version is always recommended for new users.
44
44
45
# Requirements and setup
45
# Requirements and setup
46
46
47
In order to use the bone deformation tool you will need to:
47
In order to use the bone deformation tool you will need to:
48
1. download [OpenSim 4.1](https://simtk.org/projects/opensim) or more recent. OpenSim 3.3 is also supported but the examples refer to the latest version.
48
1. download [OpenSim 4.1](https://simtk.org/projects/opensim) or more recent. OpenSim 3.3 is also supported but the examples refer to the latest version.
49
2. have MATLAB installed in your machine. The development of the paper was done using R2020a.
49
2. have MATLAB installed in your machine. The development of the paper was done using R2020a.
50
3. set up the OpenSim API (Application User Interface) for MATLAB. Please refer to the OpenSim [documentation](https://simtk-confluence.stanford.edu/display/OpenSim/Scripting+with+Matlab).
50
3. set up the OpenSim API (Application User Interface) for MATLAB. Please refer to the OpenSim [documentation](https://simtk-confluence.stanford.edu/display/OpenSim/Scripting+with+Matlab).
51
51
52
The tool should be able to detect the version of your installed OpenSim API automatically, so you do not have to modify anything related to this toolbox if you are using OpenSim 3.3.
52
The tool should be able to detect the version of your installed OpenSim API automatically, so you do not have to modify anything related to this toolbox if you are using OpenSim 3.3.
53
53
54
# How to use the bone deformation tool
54
# How to use the bone deformation tool
55
55
56
In order to run the bone deformation tool you will need to specify variable in the example scripts, or in your own scripts:
56
In order to run the bone deformation tool you will need to specify variable in the example scripts, or in your own scripts:
57
1. where the OpenSim bone geometries are stored (variable `OpenSim_Geometry_folder`)
57
1. where the OpenSim bone geometries are stored (variable `OpenSim_Geometry_folder`)
58
2. which segment of the OpenSim model you want to deform (variable `bone_to_deform`)
58
2. which segment of the OpenSim model you want to deform (variable `bone_to_deform`)
59
3. along which axis the torsional profile will be applied(variable `torsionAxis`)
59
3. along which axis the torsional profile will be applied(variable `torsionAxis`)
60
4. the points defining the torsional profile, i.e. the torsion applied to the proximal and distal joint centres (variable `TorsionProfilePointsDeg`)
60
4. the points defining the torsional profile, i.e. the torsion applied to the proximal and distal joint centres (variable `TorsionProfilePointsDeg`)
61
5. if you want the torsional to be applied just to the bone or also to the joints, i.e. if you want the kinematic model to be altered by the torsion (variable `apply_torsion_to_joints`)
61
5. if you want the torsional to be applied just to the bone or also to the joints, i.e. if you want the kinematic model to be altered by the torsion (variable `apply_torsion_to_joints`)
62
6. where the resulting model will be saved (variable `altered_models_folder`)
62
6. where the resulting model will be saved (variable `altered_models_folder`)
63
63
64
# How the bone deformation tool works
64
# How the bone deformation tool works
65
65
66
The bone deformation tool will execute the following operations:
66
The bone deformation tool will execute the following operations:
67
1. read and modify the bone geometry described in the OpenSim `vtp` file according to the specified rotational profile
67
1. read and modify the bone geometry described in the OpenSim `vtp` file according to the specified rotational profile
68
2. generate a new bone geometry in `vtp` format and save it in the same folder
68
2. generate a new bone geometry in `vtp` format and save it in the same folder
69
3. adjust all the muscle attachments and virtual markers attached to the bone of interest
69
3. adjust all the muscle attachments and virtual markers attached to the bone of interest
70
4. rotate the joints axes according to the specified torsional profile if the user decides to do that (see examples below). This will modify the kinematic model.
70
4. rotate the joints axes according to the specified torsional profile if the user decides to do that (see examples below). This will modify the kinematic model.
71
5. generate a new OpenSim model that includes all the previous modifications.
71
5. generate a new OpenSim model that includes all the previous modifications.
72
72
73
# Which models can I deform with this MATLAB tool?
73
# Which models can I deform with this MATLAB tool?
74
74
75
We tested the MATLAB tool with two popular lower limb models: 
75
We tested the MATLAB tool with two popular lower limb models: 
76
* the `gait2392` model distributed with OpenSim 
76
* the `gait2392` model distributed with OpenSim 
77
* the `Rajagopal full-body model` published by [Rajagopal et al. (2016)](https://doi.org/10.1109/tbme.2016.2586891). 
77
* the `Rajagopal full-body model` published by [Rajagopal et al. (2016)](https://doi.org/10.1109/tbme.2016.2586891). 
78
The latter model was used in the publication associated with this repository and to produce the images in this document.
78
The latter model was used in the publication associated with this repository and to produce the images in this document.
79
79
80
Please consider that the formulation of the tool is however **completely generic** in its managing the OpenSim model components, so nothing prevents you from testing it on other bones and models, including upper limb models.
80
Please consider that the formulation of the tool is however **completely generic** in its managing the OpenSim model components, so nothing prevents you from testing it on other bones and models, including upper limb models.
81
81
82
# Definition of femoral version and tibial torsion angles
82
# Definition of femoral version and tibial torsion angles
83
83
84
The generic OpenSim model are provided with bone geometry for visualization purposes, and it is possible to estimate the femoral version and tibial rotation using their geometry. We have estimated the following angles as in [Strecker et al. (1997)](https://online.boneandjoint.org.uk/doi/abs/10.1302/0301-620X.79B6.0791019)
84
The generic OpenSim model are provided with bone geometry for visualization purposes, and it is possible to estimate the femoral version and tibial rotation using their geometry. We have estimated the following angles as in [Strecker et al. (1997)](https://online.boneandjoint.org.uk/doi/abs/10.1302/0301-620X.79B6.0791019)
85
85
86
![alignment-angles](/images/angle-measurements.png)
86
87
88
## Baseline angles for the Rajagopal full body model
87
## Baseline angles for the Rajagopal full body model
89
88
90
For the full-body model by Rajagopal et al. we found:
89
For the full-body model by Rajagopal et al. we found:
91
* femoral version: `12 degrees`
90
* femoral version: `12 degrees`
92
* tibial rotation: `28 degrees`
91
* tibial rotation: `28 degrees`
93
92
94
The reference systems that we constructed for the estimation of these angles are available in the folder [baseline-angles-estimation-Rajagopal](baseline-angles-estimation-Rajagopal) and can be visualized using [NMSBuilder](http://www.nmsbuilder.org/).
93
The reference systems that we constructed for the estimation of these angles are available in the folder [baseline-angles-estimation-Rajagopal](baseline-angles-estimation-Rajagopal) and can be visualized using [NMSBuilder](http://www.nmsbuilder.org/).
95
94
96
**WARNING** the bone geometries provided with the OpenSim models are normally of low quality, not comparable with those obtainable from segmentation of CT scans, for example. Estimation of these rotational angle is therefore challenging.
95
**WARNING** the bone geometries provided with the OpenSim models are normally of low quality, not comparable with those obtainable from segmentation of CT scans, for example. Estimation of these rotational angle is therefore challenging.
97
96
98
Knowledge of the bone rotation for the baseline model is essential because the bone deformation prescribed with this deformation tool will be added to the existing bone rotation.
97
Knowledge of the bone rotation for the baseline model is essential because the bone deformation prescribed with this deformation tool will be added to the existing bone rotation.
99
98
100
# Examples of use
99
# Examples of use
101
100
102
## Femoral anteversion
101
## Femoral anteversion
103
102
104
It is possible to modify the femoral anteversion of a generic model as in the figure below.
103
It is possible to modify the femoral anteversion of a generic model as in the figure below.
105
104
106
If you want, for example, to generate a model with 40 degrees of femoral anteversion, you can apply a 28 degrees of rotation to the proximal femur of generic model, which we have estimated to have a baseline femoral anteversion of 12 degrees.
105
If you want, for example, to generate a model with 40 degrees of femoral anteversion, you can apply a 28 degrees of rotation to the proximal femur of generic model, which we have estimated to have a baseline femoral anteversion of 12 degrees.
107
106
108
The typical setting in the main script would then be:
107
The typical setting in the main script would then be:
109
108
110
```
109
```
111
%---------------  MAIN SETTINGS -----------
110
%---------------  MAIN SETTINGS -----------
112
% Model to deform
111
% Model to deform
113
modelFileName = './test_models/Rajagopal2015.osim';
112
modelFileName = './test_models/Rajagopal2015.osim';
114
113
115
% where the bone geometries are stored
114
% where the bone geometries are stored
116
OSGeometry_folder = './Geometry';
115
OSGeometry_folder = './Geometry';
117
116
118
% body to deform
117
% body to deform
119
bone_to_deform = 'femur_l';
118
bone_to_deform = 'femur_l';
120
119
121
% axis of deformation
120
% axis of deformation
122
torsionAxis = 'y';
121
torsionAxis = 'y';
123
122
124
% define the rotation at the joint centre of the specified bone
123
% define the rotation at the joint centre of the specified bone
125
% TorsionProfilePointsDeg = [ proximalTorsion DistalTorsion ];
124
% TorsionProfilePointsDeg = [ proximalTorsion DistalTorsion ];
126
TorsionProfilePointsDeg = [ 28  0 ];
125
TorsionProfilePointsDeg = [ 28  0 ];
127
126
128
% decide if you want to apply the rotation to joint as well as other objects.
127
% decide if you want to apply the rotation to joint as well as other objects.
129
apply_torsion_to_joints = 'no';
128
apply_torsion_to_joints = 'no';
130
```
129
```
131
130
132
131
133
![femoral_anteversion](/images/femoral_anteversion_example.png)
132
134
135
## Femoral torsion
133
## Femoral torsion
136
134
137
For applying a distal femoral torsion it is necessary to specify also that the torsion will be applied to the joints with the setting `apply_torsion_to_joints = 'yes'`.
135
For applying a distal femoral torsion it is necessary to specify also that the torsion will be applied to the joints with the setting `apply_torsion_to_joints = 'yes'`.
138
136
139
The typical setting would be:
137
The typical setting would be:
140
138
141
```
139
```
142
%---------------  MAIN SETTINGS -----------
140
%---------------  MAIN SETTINGS -----------
143
% Model to deform
141
% Model to deform
144
modelFileName = './test_models/Rajagopal2015.osim';
142
modelFileName = './test_models/Rajagopal2015.osim';
145
143
146
% where the bone geometries are stored
144
% where the bone geometries are stored
147
OSGeometry_folder = './Geometry';
145
OSGeometry_folder = './Geometry';
148
146
149
% body to deform
147
% body to deform
150
bone_to_deform = 'femur_l';
148
bone_to_deform = 'femur_l';
151
149
152
% axis of deformation
150
% axis of deformation
153
torsionAxis = 'y';
151
torsionAxis = 'y';
154
152
155
% define the torsion at the joint centre of the specified bone
153
% define the torsion at the joint centre of the specified bone
156
% TorsionProfilePointsDeg = [ proximalTorsion DistalTorsion ];
154
% TorsionProfilePointsDeg = [ proximalTorsion DistalTorsion ];
157
TorsionProfilePointsDeg = [ 0  -30 ];
155
TorsionProfilePointsDeg = [ 0  -30 ];
158
156
159
% decide if you want to apply torsion to joint as well as other objects.
157
% decide if you want to apply torsion to joint as well as other objects.
160
apply_torsion_to_joints = 'yes';
158
apply_torsion_to_joints = 'yes';
161
```
159
```
162
160
163
![femoral_torsion](/images/femoral_torsion_example.png)
161
164
165
## Tibial torsion
162
## Tibial torsion
166
163
167
Exactly the same setting can be used for applying a distal tibial torsion, with the only difference being 
164
Exactly the same setting can be used for applying a distal tibial torsion, with the only difference being 
168
165
169
```
166
```
170
% body to deform
167
% body to deform
171
bone_to_deform = 'tibia_l';
168
bone_to_deform = 'tibia_l';
172
```
169
```
173
170
174
The resulting tibial torsion will be 2 degrees.
171
The resulting tibial torsion will be 2 degrees.
175
172
176
![distal_torsion](/images/tibial_torsion_example.png)
173
177
178
# Provided example scripts
174
# Provided example scripts
179
175
180
We have provided example scripts that demonstrate how to modify the geometry of femur and tibia in the gait2392 and Rajagopal models:
176
We have provided example scripts that demonstrate how to modify the geometry of femur and tibia in the gait2392 and Rajagopal models:
181
* [`Example_deform_distal_femur_gait2392.m`](Example_deform_distal_femur_gait2392.m)
177
* [`Example_deform_distal_femur_gait2392.m`](Example_deform_distal_femur_gait2392.m)
182
* [`Example_deform_distal_femur_Rajagopal.m`](Example_deform_distal_femur_Rajagopal.m)
178
* [`Example_deform_distal_femur_Rajagopal.m`](Example_deform_distal_femur_Rajagopal.m)
183
* [`Example_deform_distal_tibia_gait2392.m`](Example_deform_distal_tibia_gait2392.m)
179
* [`Example_deform_distal_tibia_gait2392.m`](Example_deform_distal_tibia_gait2392.m)
184
* [`Example_deform_distal_tibia_Rajagopal.m`](Example_deform_distal_tibia_Rajagopal.m)
180
* [`Example_deform_distal_tibia_Rajagopal.m`](Example_deform_distal_tibia_Rajagopal.m)
185
181
186
The models resulting from these scripts, together with the bone geometries for visualizing the Rajagopal model, are available in the [`examples'](./examples) folder.
182
The models resulting from these scripts, together with the bone geometries for visualizing the Rajagopal model, are available in the [`examples'](./examples) folder.
187
183
188
# Video summary of the associated publication
184
# Video summary of the associated publication
189
185
190
Luca gave a talk at the [26th Congress of the European Society of Biomechanics](https://bit.ly/3yU6EwB) presenting the paper associated with the bone deformation tool. Click on the image below to see the recorded:
186
Luca gave a talk at the [26th Congress of the European Society of Biomechanics](https://bit.ly/3yU6EwB) presenting the paper associated with the bone deformation tool. Click on the image below to see the recorded:
191
187
192
[![Alt text](images/ESB2021_youtube_thumbnail.png)](https://www.youtube.com/watch?v=jq2S2tRGsm0)
188
193
189
194
195
# How to contribute
190
# How to contribute
196
We welcome any contribution from the biomechanical and open source community, in any form. Few tips for contributing:
191
We welcome any contribution from the biomechanical and open source community, in any form. Few tips for contributing:
197
192
198
* To report a bug, or anomalous behaviour of the toolbox, please open an issue on this page. Ideally, if you could make the issue reproducile with some data that you can share with us.
193
* To report a bug, or anomalous behaviour of the toolbox, please open an issue on this page. Ideally, if you could make the issue reproducile with some data that you can share with us.
199
* To contributing to the project with new code please use a standard GitHub workflow: a) fork this repository, b) create your own branch, where you make your modifications and improvements, c)  once you are happy with the new feature that you have implemented you can create a pull request. We will review your code and potentially include it in the main repository.
194
* To contributing to the project with new code please use a standard GitHub workflow: a) fork this repository, b) create your own branch, where you make your modifications and improvements, c)  once you are happy with the new feature that you have implemented you can create a pull request. We will review your code and potentially include it in the main repository.
200
* To propose feature requests, please open an issue [on this page](https://github.com/modenaxe/msk-bone-deformation/issues), label it as feature request using the Labels panel on the right and describe your desired new feature. We will review the proposal regularly but work on them depending on the planned development.
195
* To propose feature requests, please open an issue [on this page](https://github.com/modenaxe/msk-bone-deformation/issues), label it as feature request using the Labels panel on the right and describe your desired new feature. We will review the proposal regularly but work on them depending on the planned development.
201
196
202
# Contributors
197
# Contributors
203
Many thanks to **Axel Koussou** and **Emmanuelle Renoul** from Fondation Ellen Poidatz (St-Fargeau-Ponthierry, France) for helping with the tool upgrade to OpenSim 4.1.
198
Many thanks to **Axel Koussou** and **Emmanuelle Renoul** from Fondation Ellen Poidatz (St-Fargeau-Ponthierry, France) for helping with the tool upgrade to OpenSim 4.1.