Algorithm behind reference mesh

I have tried using the Shapeworks Python library to develop the SSM. It seems that it tries to find the reference mesh using the function

ref_index = sw.find_reference_mesh_index(mesh_list)

Can you please let me know how it finds the reference mesh? What algorithm goes behind it? And also how to find which mesh is the reference mesh in the Shapeworks software?

This method performs pairwise ICP registrations between shapes and computes the average surface to surface distance. Then it picks the mesh that had the minimal distance to all other shapes.

It returns the index of this mesh, which should be the index into mesh_list for the reference.

Thank you for your reply.
Can you please let me know how we can get the reference geometry file name using Shapeworks software?

ref_index = sw.find_reference_mesh_index(mesh_list)
mesh = mesh_list[ref_index]

mesh should contain the geometry of the reference mesh.

Thank you for your reply.

Is the same reference mesh used in the software to generate the final SSM meshes using the particle information?

No, the mesh used for the reference for mesh warping (reconstruction) is the median shape based on the particle system.

Is the same reference mesh (obtained from the median mesh) used to generate all mode meshes?

Also, how to get the median mesh based on the particle system?
It is possible to get the median of all particles (shown as median_particle) but how to get the median geometry using the below python code?

warper = MeshWarper()
warper.generateWarp(reference_mesh, median_particle)
median_mesh = warper.buildMesh(median_particle)

What is the reference_mesh to get the median mesh?

Yes, the same reference/template mesh is used to generate all reconstructions. In principle it can be any shape from the model, but we chose the median shape.

The Python API seems to be missing a method to query the median shape. I’ve created an issue to add it here:

Briefly, it is identified by finding the shape that is closest to all other shapes (in the global space). This is done by adding up the particle-particle distance for each shape and finding the shape that has the minimum sum of particle-particle distances (L1 Norm).

I am not sure what the median position of each particle would define, but any set of particles can be used with the MeshWarper.

Thank you for your reply.

I hope the median shape API get updated soon.