Speed up calculation of specificity using kd-trees

11 views
Skip to first unread message

Max

unread,
Jan 22, 2021, 2:42:46 PMJan 22
to scalismo
Hi,

I have some performance issues when calculating the specificity of a model. The problem is the linear search for the closest mesh in the data set:

data.map { m =>
    MeshMetrics.avgDistance(m, sample)
}.min

My data set contains 100 meshes and I want to sample 10,000 times. This is simply not doable when using the above code.
So, my idea was to use a kd-tree instead. I already found an implementation of kd-trees in scalismo (scalismo.mesh.kdtree). However, I cannot find any documentation. How can I add a custom metric in order to compare two vectorized triangle meshes (i.e. vectors of dimension 3n, where n is the number of vertices)? And how to properly instantiate a kd-tree using KDTree.fromSeq(...)?

Thank you.
Max
Reply all
Reply to author
Forward
0 new messages