# Use Shape Statistics

**URL:** <https://shapeworks.discourse.group/t/use-shape-statistics/186>\
**Category:** Uncategorized\
**Created:** [November 9, 2023, 5:20pm UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186 "2023-11-09T17:20:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMoscoloni](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@BMoscoloni](https://shapeworks.discourse.group/u/BMoscoloni)\
**Post date:** [November 9, 2023, 5:20pm UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186/1 "2023-11-09T17:20:05Z")

</div>

Hi everyone,

While reading the documentation (specifically here: [How to Optimize Your Shape Model? - ShapeWorks](https://sciinstitute.github.io/ShapeWorks/workflow/optimize.html) and in the python API), I came across the “use\_shape\_statistics\_after” and “use\_shape\_statistics\_in\_init”, which however I can’t however I cannot seem to add within the parameter dictionary. Is it a feature that is implemented automatically? Or did it ‘change name’ in the latest release?

Thanks in advance!

Best regards,

Beatrice

---

<div class="post-metadata">

**Author:** ![amorris](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@amorris](https://shapeworks.discourse.group/u/amorris)\
**Post date:** [November 9, 2023, 6:09pm UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186/2 "2023-11-09T18:09:59Z")

</div>

Yes, those were the names for the older XML projects. We need to update the docs. The parameters now are:

multiscale : true  
multiscale\_particles : 32

---

<div class="post-metadata">

**Author:** ![BMoscoloni](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@BMoscoloni](https://shapeworks.discourse.group/u/BMoscoloni)\
**Post date:** [November 9, 2023, 6:57pm UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186/3 "2023-11-09T18:57:11Z")

</div>

Hi,

Thank you very much! I have another unrelated question that I was hoping you could assist me with. I have been using the python API to speed up some analysis using the shape metrics (I have been using mostly `ComputeGeneralization()`and `ComputeSpecificity()`. However the metrics that I get in python are quite different from the ones I get once I open the project file in Studio (example: I get gen = 0.8 in Python vs. gen=3 in Studio - so quite substantial difference). What could this be due to and/or which one should I ‘trust’?

Thanks again for your help!

Beatrice

---

<div class="post-metadata">

**Author:** ![amorris](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@amorris](https://shapeworks.discourse.group/u/amorris)\
**Post date:** [November 9, 2023, 7:16pm UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186/4 "2023-11-09T19:16:45Z")

</div>

I am wondering if your usage of the Python API is perhaps using the local particles or both local+world. It should only use the world particles.

I’ve just run the ellipsoid\_evaluate python example which uses this API and the values are matching for me:

Compactness value of the 1st mode - 0.9784689807553621  
Generalization value of the 1st mode - 0.1351896290180642  
Specificity value of the 1st mode - 0.18514057769833261

In Studio, opening the plot data:

![image](https://global.discourse-cdn.com/free1/uploads/shapeworks/original/1X/cb23ff22d2d6444bba7c2ee97f8758221c47f754.png)

![image](https://global.discourse-cdn.com/free1/uploads/shapeworks/original/1X/27bf816d448c7f685896f19dcb09123608f92334.png)

![image](https://global.discourse-cdn.com/free1/uploads/shapeworks/original/1X/ad7b285911931ab6961674cb780e71764f2c1aad.png)

---

<div class="post-metadata">

**Author:** ![BMoscoloni](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@BMoscoloni](https://shapeworks.discourse.group/u/BMoscoloni)\
**Post date:** [November 10, 2023, 11:14am UTC](https://shapeworks.discourse.group/t/use-shape-statistics/186/5 "2023-11-10T11:14:08Z")

</div>

Hi,

I had a mistake in my own script indeed, now it’s working correctly and the metrics match! Thank you for the support and the prompt response, and for keeping up such a great tool!

Best regards,

Beatrice
