spectralbrain.wesd#

spectralbrain.wesd(dna_a, dna_b, *, p=2.0, normalize=True)[source]#

Weighted Spectral Distance between two ShapeDNA vectors.

A pseudometric with convergence guarantees — the series converges for p > d/2 where d is the dimension of the manifold (d = 2 for surfaces, so p > 1 suffices).

\[\text{WESD}^p(\Omega_1, \Omega_2) = \left( \sum_{i=1}^{k} \frac{|\lambda_i^{(1)} - \lambda_i^{(2)}|} {\lambda_i^{(1)} \cdot \lambda_i^{(2)}} \right)^{1/p}\]
Parameters:
  • dna_a (ndarray, shape (d,)) – ShapeDNA eigenvalue sequences (skip λ₀).

  • dna_b (ndarray, shape (d,)) – ShapeDNA eigenvalue sequences (skip λ₀).

  • p (float) – Exponent (must be > 1 for 2D surfaces).

  • normalize (bool) – Map to [0, 1) via WESD / (1 + WESD).

Returns:

float – WESD distance.

Return type:

float

References

Konukoglu E, Glocker B, Criminisi A, Pohl KM. WESD — Weighted Spectral Distance for measuring shape dissimilarity. IEEE TPAMI 35(9):2284–2297, 2013.