# How to generate a "mean model" between few amount of surface mesh?

**URL:** https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793
**Category:** Development
**Created:** [August 17, 2022, 5:30am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793 "2022-08-17T05:30:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![joanne40226](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joanne40226/32/14681_2.png) [@joanne40226](https://discourse.slicer.org/u/joanne40226)
#### Post date: [August 17, 2022, 5:30am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/1 "2022-08-17T05:30:06Z")

</div>

Hi community, i want to generate a “mean model” between few amount (i will show the schematic diagram with 2 data sets) of surface mesh as shown below.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/d/fd1d1ca013ef4a668006305123913fdb3db6db2f.jpeg)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/3/e3ee44d5c57831ce53d3b1c380a54d8b41833d67.jpeg)

Besides, the suface mesh are already aligned.  
Is there any module that i can generate a “mean model” between them? Thank you for your time.

---

<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: [August 17, 2022, 10:30am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/2 "2022-08-17T10:30:58Z")

</div>

You can use modules in [SlicerMorph](https://slicermorph.github.io/) and [SlicerSALT](https://salt.slicer.org/) extensions for this. A simple PCA (that can be computed by the GPA module of SlicerMorph) can provide you a mean shape, but there are many more tools in these extensions for shape modeling and analysis.

---

<div class="post-metadata">

### Author: ![joanne40226](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joanne40226/32/14681_2.png) [@joanne40226](https://discourse.slicer.org/u/joanne40226)
#### Post date: [August 18, 2022, 9:14am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/4 "2022-08-18T09:14:40Z")

</div>

@lassoan  
Hi, now i finished generating landmarks from the surface mesh i got.  
However, when building mean shape by them, i follow up your suggestion by using GPA  
im not sure if i did it right but i only get one slice() and the 3D visualization seem to be weird

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/e/9ec549f7e65e80ca192880413a15583737044604.png)

where red and green LMs are my two data sets and pink is the mean shape it generated.  
The mean shape it generated seem to be extremely close

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/3/738dc44ca541addc6b1f9a4beb07f17c499d8bb2.png)

Am i wrong when doing that? thank you for your help!

---

<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: [August 18, 2022, 9:52am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/5 "2022-08-18T09:52:38Z")

</div>

@muratmaga @bpaniagua can you recommend modules that can compute mean shape of already aligned models?

---

<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: [August 18, 2022, 5:04pm UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/6 "2022-08-18T17:04:15Z")

</div>

@joanne40226 please follow this tutorial to assign one of your models as a reference model.

> **[Tutorials/GPA\_2 at main · SlicerMorph/Tutorials - 3D interactive visualization and exporting animations](https://github.com/SlicerMorph/Tutorials/tree/main/GPA_2#3d-interactive-visualization-and-exporting-animations)**
>
> main/GPA\_2

The blue model you will see in the right-hand viewer (#2) will be mean model .

You can then go to the Data module, and right click on the object that says **PCA Warped Volume** and you can export it as a model. Make sure you do not touch the PC sliders (or that they are at 0,0).

If you do want to explore variation, you can use the sliders.

---

<div class="post-metadata">

### Author: ![joanne40226](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joanne40226/32/14681_2.png) [@joanne40226](https://discourse.slicer.org/u/joanne40226)
#### Post date: [August 19, 2022, 7:04am UTC](https://discourse.slicer.org/t/how-to-generate-a-mean-model-between-few-amount-of-surface-mesh/24793/7 "2022-08-19T07:04:56Z")

</div>

@muratmaga @lassoan  
Thank you both a lot!  
i just figure it out it is bcuz i did not choose the option  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/37000b5eabb1603de99c891d3d2193bcf5174e09.png)

so it would be scaled into unit.  
after i clicked it, it seems to be good.

Thank you for your time!
