# Calculating the average deformations from Model to Model Distance

**URL:** https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539
**Category:** Support
**Tags:** deformation
**Created:** [April 19, 2019, 1:29am UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539 "2019-04-19T01:29:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![stevenagl12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stevenagl12/32/3391_2.png) [@stevenagl12](https://discourse.slicer.org/u/stevenagl12)
#### Post date: [April 19, 2019, 1:29am UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/1 "2019-04-19T01:29:46Z")

</div>

Is there a way to compute the average Hausdorf distances between models so that you can show the average displacement? Also, can you create an average model, or a minimum/maximum model given specified points such as a statistical shape model?

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [April 19, 2019, 4:49pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/2 "2019-04-19T16:49:38Z")

</div>

You can use the Segment Comparison module in the SlicerRT extension. To compare the models, you first need to convert them to segmentations. You can do it in the Data module by right-clicking the models and choosing “Convert model to segmentation node”.

I think an average model can best be created from the labelmap representations (then converted back to surface). You can export the segments to labelmaps and sum them together (Add Scalar Volumes or Simple Filters module) to get a probabilistic-like image. Or you can create then manipulate distance maps to get the average model. The best way depends on what you want exactly.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 19, 2019, 6:00pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/3 "2019-04-19T18:00:02Z")

</div>

> [@stevenagl12](#):
>
> Also, can you create an average model, or a minimum/maximum model given specified points such as a statistical shape model?

[SlicerSALT extension](http://salt.slicer.org/) should be able to provide these. @muratmaga’s morphometry extension may be usable for this, too.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 19, 2019, 6:14pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/4 "2019-04-19T18:14:25Z")

</div>

I think SPharm is probably your best bet. We currently do not have tools to generate average models directly from meshes. If you have landmarks that go with the models, SlicerMorph can do it.

Outside of Slicer, you can also try Shape Works Studio from Utah ([https://www.sci.utah.edu/software/shapeworks.html](https://www.sci.utah.edu/software/shapeworks.html)), but you will need to provide labelmaps already aligned in a common coordinate system as your input.

---

<div class="post-metadata">

### Author: ![stevenagl12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stevenagl12/32/3391_2.png) [@stevenagl12](https://discourse.slicer.org/u/stevenagl12)
#### Post date: [April 26, 2019, 3:40pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/5 "2019-04-26T15:40:25Z")

</div>

With my models, I am trying to avoid doing landmark based Procrustes to align them. How do you build an average model in SPharm?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 26, 2019, 5:40pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/6 "2019-04-26T17:40:05Z")

</div>

> [@stevenagl12](#):
>
> With my models, I am trying to avoid doing landmark based Procrustes to align them.

No matter what you do, probably landmarks are still the best option for initial alignment (moments-based alignment is not accurate enough, ICP is not robust enough, etc.). Parametric models then help you getting correspondence between all the points (not just the landmarks).

> [@stevenagl12](#):
>
> How do you build an average model in SPharm?

See [Documentation • SlicerSALT](http://salt.slicer.org/documentation/). Tutorials are in a very well hidden section near the bottom right of the page.

@bpaniagua If you want to people to find these tutorials, make them much more visible (for example, add green buttons to that section as well, or move tutorials section into a new row).

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [February 28, 2021, 1:37pm UTC](https://discourse.slicer.org/t/calculating-the-average-deformations-from-model-to-model-distance/6539/7 "2021-02-28T13:37:16Z")

</div>

A post was split to a new topic: [Get average deformation from model to model](https://discourse.slicer.org/t/get-average-deformation-from-model-to-model/16271)
