MVA · Course notes

Geometry and Shape Spaces

M2 MVA · Semester 2 · Modelling · 5 ECTS

Contents

Introduction and overview

Module Geometry and Shape Spaces
Official title Géométrie et espaces de formes
Instructors A. TROUVE, J. GLAUNES (master-mva.com, 2026–2027)
Period Semester 2 · period 2 (04/01/2027 – 02/04/2027)
Credits and volume 5 ECTS · 30 h (lectures 21 h, labs 9 h) per the Université Paris-Saclay programme table
Label ModellingTrack Santé
Language not displayed on master-mva.com or on the Université Paris-Saclay course detail
Assessment Université Paris-Saclay course detail: “Evaluation Continue non Intégrale” (partial continuous assessment); master-mva.com displays no assessment section. Weights: not displayed.
Prerequisites The necessary mathematical tools, notably Riemannian geometry, Lie groups and Hamiltonian mechanics, are introduced along the way (master-mva.com)

Audience: a student with an M1 in mathematics, computer science or physics, at ease with differential calculus and linear algebra, who wants to compare, average and model shapes such as anatomical structures, curves, surfaces and images.

Empirical first: add a large smooth displacement to a grid and it folds, with a Jacobian of -1.06 in Code 3.4, while the flow of the same field never does; average two elongated diffusion tensors entry by entry and their volume grows by a factor 3.6 (Code 2.6). Linear operations fail on shapes, and this course builds the geometry that replaces them.

The course derives distances between shapes from the cost of the deformations that carry one shape to another. The induced Riemannian metrics give geodesics, exponential maps, registration algorithms (ch. 4–7) and statistical shape models (ch. 8). Related pages: Deformable Models and Geodesic Methods, Kernel Methods, Geometric Data Analysis and Medical Image Analysis.

What you will be able to do

Official objectives and syllabus (2026–2027)

The course description on master-mva.com sets the objective of an introductory exposition of a geometric viewpoint on deformable models. The viewpoint consists in building Riemannian metrics on spaces of objects, regarded as manifolds of finite or infinite dimension, from the study of the natural infinitesimal deformations acting on these objects.

The objects listed are n-tuples of points, curves, binary regions, surfaces, tensor fields, grey-level images and measures.

The themes (“Thèmes abordés”) say that building and studying these metrics, computing geodesics in shape spaces, and understanding local exponential maps matter both in theory and in practice. They name the concrete questions that this viewpoint unifies, announce medical illustrations on anatomical variability, and stress the new tools and algorithms for image processing. Each item is matched below.

Official topic Course section
Objective: Riemannian metrics on spaces of objects, built from the infinitesimal deformations acting on them ch. 2 (projected metric, Definition 2.7, Theorem 2.8) and ch. 3 (the group G_V, Theorem 3.6), then applied to each kind of object in ch. 4–7
Objects: n-tuples of points ch. 1 (Kendall’s space, Theorem 1.11, Code 1.12) and ch. 4 (landmark matching, Theorems 4.2–4.3, Code 4.7)
Objects: curves ch. 5 (currents and varifolds of curves, Definitions 5.3 and 5.6, Code 5.7); metrics defined directly on curves in ch. 9
Objects: binary regions ch. 6 (action on regions, Definition 6.1; after Proposition 6.3, the normal momentum on the boundary and the gradient of the symmetric-difference data term)
Objects: surfaces ch. 5 (currents and varifolds of triangulated surfaces, Definitions 5.3 and 5.6)
Objects: tensor fields ch. 2 (affine-invariant metric, Propositions 2.4–2.5, Code 2.6) and ch. 6 (action and reorientation, Example 6.2; tensor data terms)
Objects: grey-level images ch. 6 (LDDMM for images, Definition 6.4, Theorem 6.5, Code 6.6) and ch. 7 (metamorphosis)
Objects: measures ch. 5 (kernel norm on measures, Definition 5.1, Proposition 5.2)
Prerequisite introduced along the way: Riemannian geometry ch. 1 (metrics, geodesics, exponential map, quotients)
Prerequisite introduced along the way: Lie groups ch. 2 (matrix Lie groups, actions, Euler–Poincaré equation, Theorem 2.10)
Prerequisite introduced along the way: Hamiltonian mechanics ch. 0 (Proposition 0.5), ch. 1 (Theorem 1.4), ch. 4 (Theorem 4.3, Proposition 4.4)
Building and studying the metrics ch. 2 (Theorem 2.8, Example 2.9), ch. 3 (Theorems 3.3 and 3.6), Example 4.5, Proposition 7.4
Effective computation of geodesics in shape spaces geodesic shooting in ch. 4 (Code 4.7), image gradient in ch. 6 (Theorem 6.5, Code 6.6), discrete metamorphosis in ch. 7 (Code 7.6)
Understanding local exponential maps Definition 1.5 and Proposition 1.6; the geodesic shooting note of ch. 3; the shooting map as a chart in ch. 4; tangent coordinates in ch. 8 (Definition 8.3)
Dense matching from landmarks ch. 4 (the flow of the whole space, Code 4.7)
Dense matching from point clouds ch. 5 (point clouds as measures)
Matching of manifolds ch. 5 (curves and surfaces as currents and varifolds, Code 5.7)
Diffeomorphic matching of images with large deformations Code 3.4 and ch. 6 (Definition 6.4, Theorem 6.5, Code 6.6)
Automatic metamorphoses between images ch. 7 (Definition 7.1, Theorem 7.3, Code 7.6)
New avenues for probabilistic shape models ch. 8 (Definition 8.5, Proposition 8.6) and stochastic shape evolutions in ch. 9
Medical illustrations: analysis of anatomical variability ch. 8 (Code 8.4 and the section on medical imaging); diffusion tensors in ch. 6
Tools and concepts new to image processing, and the associated algorithms a runnable algorithm in every core chapter, from Code 1.12 to Code 8.4
“Les intervenants” (last item of the list) the heading of the instructors list, not a topic; the instructors appear in the fiche
“Presentation: here” a link to a presentation of the course, not reproduced in these notes
Université Paris-Saclay course detail: nature of the assessment Projects and assessment

The Université Paris-Saclay course detail gives the volume (21 h of lectures and 9 h of labs) and the nature of the assessment, but no programme items.

Beyond the syllabus, this page adds a review chapter (ch. 0), a research chapter for self-study (ch. 9), runnable code for every core chapter, and a written-exam proposal.

Where this course fits in the programme

Official prerequisites: master-mva.com states that the necessary mathematical tools, notably Riemannian geometry, Lie groups and Hamiltonian mechanics, are introduced along the way; no other prerequisite is listed. The instructors listed on master-mva.com are Alain Trouvé (Centre Borelli, ENS Paris-Saclay) and Joan Alexis Glaunès (Université Paris Cité). The course carries the label of the Santé track.

Course outline

Session plan

30 h in class = 10 sessions of 3 h.

The volume is the Université Paris-Saclay programme table: 21 h of lectures and 9 h of labs. master-mva.com gives no session organisation. The split into ten sessions is a proposal: session 1 is a lecture, and each later session ends with about one hour of lab on the code of the chapter.

Level 1 = foundations, 2 = core methods, 3 = advanced material close to research; the level never decreases from one session to the next.

Session Hours Level Content Practice
1 3 h 1 ch. 0 Review: gradients and inner products, Euler–Lagrange and Hamilton’s equations, flows and Grönwall, RKHS and minimal-norm interpolation (0.1–0.11) Ex. 4
2 3 h 1 ch. 1 Riemannian geometry: metrics, geodesics, exponential map, Hopf–Rinow, quotients, Kendall’s shape space (1.1–1.12) Ex. 1, 2; lab: Code 1.12
3 3 h 2 ch. 2 Lie groups and actions, affine-invariant metric, projected metrics and cometrics, Euler–Poincaré equation (2.1–2.10) Ex. 3, 5; lab: Code 2.6
4 3 h 2 ch. 3 Admissible spaces, flows, the group G_V, variations of flows, EPDiff (3.1–3.8) Ex. 8, 11; lab: Code 3.4
5 3 h 2 ch. 4.1–4.5 Reduction to landmarks, Hamiltonian equations, conservation laws, geodesic shooting, the price of tearing Ex. 7, 9, 10; lab: the shooting function of Code 4.7 run from a given momentum, with a check of the conservation of H
6 3 h 2 ch. 4.6–4.7 Inexact matching and the endpoint condition; ch. 5.1–5.2 point clouds as measures Ex. 6, 14; lab: Code 4.7
7 3 h 2 ch. 5.3–5.7 Currents, cancellation, varifolds, curve matching without correspondences Ex. 13; lab: Code 5.7
8 3 h 2 ch. 6 Actions on fields, tensor reorientation, normal momenta, LDDMM gradient for images, tensor fields (6.1–6.6) lab: Code 6.6
9 3 h 3 ch. 7 Metamorphoses of images and landmarks, discrete metamorphosis (7.1–7.6) Ex. 12, 17; lab: Code 7.6
10 3 h 3 ch. 8 Fréchet means, tangent PCA, generative deformable templates, medical illustrations (8.1–8.6) Ex. 15; lab: Code 8.4

Self-study, outside the 30 h (about 4 h in total): ch. 9 Research directions and open problems — metrics on curves, curvature and statistics, modular and stochastic deformations, data terms, computation, learning (≈ 4 h, with Ex. 16).

How to study this module

0. Review: gradients, flows and reproducing kernels

The whole course builds distances between shapes out of the cost of deforming them. Three M1 tools carry that construction: gradients, which depend on the chosen inner product; ordinary differential equations, whose flows are diffeomorphisms; and Hilbert spaces of functions with a reproducing kernel. This chapter states them in the exact form used later, with the proofs that later chapters rely on.

Gradients depend on the inner product

Definition 0.1 — Differential and gradient Let E : H \to \mathbb{R} be defined on a Hilbert space (H, \langle \cdot, \cdot \rangle_H). It is differentiable at x if there is a continuous linear form dE(x) with E(x + h) = E(x) + dE(x)\, h + o(\|h\|_H).

The gradient \nabla_H E(x) is the unique element of H such that dE(x)\, h = \langle \nabla_H E(x), h \rangle_H for every h. It exists by the Riesz theorem (Theorem 0.8).

The differential is intrinsic, but the gradient is not: it changes when the inner product changes. This simple fact explains why every algorithm of the course smooths its descent directions.

Proposition 0.2 — Changing the inner product Let V \subset L^2 carry the inner product \langle u, w \rangle_V = \langle L u, w \rangle_{L^2}, where L is symmetric and positive with inverse K. Then \nabla_V E = K\, \nabla_{L^2} E .

Proof. For every h \in V, dE(x)\, h = \langle \nabla_{L^2} E, h \rangle_{L^2} = \langle L K \nabla_{L^2} E, h \rangle_{L^2} = \langle K \nabla_{L^2} E, h \rangle_V , and the gradient is unique. ∎

In ch. 3–7, K is a smoothing kernel. The V-gradient is therefore the L^2-gradient smoothed by K, and descent along it keeps the deformations smooth. Numerically, it acts as a preconditioner.

Calculus of variations and Hamiltonian mechanics

Theorem 0.3 — Euler–Lagrange equations Let L(q, \dot q) be of class C^2 on \mathbb{R}^n \times \mathbb{R}^n. If a C^2 path q : [0, 1] \to \mathbb{R}^n with fixed endpoints minimizes A(q) = \int_0^1 L(q, \dot q)\, dt, then \frac{d}{dt} \frac{\partial L}{\partial \dot q} = \frac{\partial L}{\partial q} .

If instead q(1) is free and the cost A(q) + g(q(1)) is minimized, the same equation holds together with the endpoint condition \frac{\partial L}{\partial \dot q}(1) + \nabla g(q(1)) = 0 .

Proof. Take a perturbation h with h(0) = 0. Then \frac{d}{d\varepsilon} A(q + \varepsilon h) \Big|_{\varepsilon = 0} = \int_0^1 \Big( \frac{\partial L}{\partial q} \cdot h + \frac{\partial L}{\partial \dot q} \cdot \dot h \Big) dt .

Integrate the second term by parts. The derivative becomes \int_0^1 \Big( \frac{\partial L}{\partial q} - \frac{d}{dt} \frac{\partial L}{\partial \dot q} \Big) \cdot h\, dt + \frac{\partial L}{\partial \dot q}(1) \cdot h(1) .

With h(1) = 0 the boundary term vanishes, and the integral is zero for every h only if the bracket is zero (fundamental lemma of the calculus of variations).

With h(1) free, add \nabla g(q(1)) \cdot h(1): the bracket still vanishes, and the remaining boundary terms must cancel for every h(1). ∎

Definition 0.4 — Momentum and Hamiltonian For the kinetic Lagrangian L(q, \dot q) = \tfrac12\, \dot q^\top G(q)\, \dot q with G(q) symmetric positive definite, the momentum is p = \partial L / \partial \dot q = G(q)\, \dot q, and the Hamiltonian is the Legendre transform H(q, p) = p \cdot \dot q - L = \tfrac12\, p^\top K(q)\, p, \qquad K(q) = G(q)^{-1}.

The matrix K(q) is called the cometric.

Proposition 0.5 — Hamilton’s equations For this Lagrangian, the Euler–Lagrange equations are equivalent to \dot q = \frac{\partial H}{\partial p} = K(q)\, p, \qquad \dot p = -\frac{\partial H}{\partial q}, and H is constant along every solution.

Proof. The first equation is the definition of p.

For the second, Theorem 0.3 gives \dot p = \partial_q L = \tfrac12\, \dot q^\top (\partial_q G)\, \dot q .

Since \partial_q (G^{-1}) = -G^{-1} (\partial_q G) G^{-1}, we get -\partial_q H = \tfrac12\, p^\top G^{-1} (\partial_q G)\, G^{-1} p , which is the same quantity because G^{-1} p = \dot q.

Finally, the derivative of H along a solution vanishes: \tfrac{d}{dt} H = \partial_q H \cdot \dot q + \partial_p H \cdot \dot p = \partial_q H \cdot \partial_p H - \partial_p H \cdot \partial_q H = 0 . ∎

This is all the Hamiltonian mechanics the course needs. In ch. 4 the cometric K(q) will be a kernel matrix, and Proposition 0.5 becomes the landmark matching algorithm.

Flows of vector fields

Theorem 0.6 — Cauchy–Lipschitz and Grönwall Let v : [0, 1] \times \mathbb{R}^d \to \mathbb{R}^d be measurable in t, with |v_t(x) - v_t(y)| \leq \ell(t)\, |x - y| , where \ell and t \mapsto |v_t(0)| are integrable.

Then the equation \dot x = v_t(x), x(0) = x_0, has a unique absolutely continuous solution on [0, 1]. The flow \varphi_t(x_0) = x(t) satisfies |\varphi_t(x) - \varphi_t(y)| \leq \exp\Big( \int_0^t \ell(s)\, ds \Big)\, |x - y| .

Proof. Existence follows from Picard iterations on the integral equation (Carathéodory version, since v is only measurable in time).

For the estimate, u(t) = |\varphi_t(x) - \varphi_t(y)| satisfies u(t) \leq |x - y| + \int_0^t \ell(s)\, u(s)\, ds. Call U(t) the right-hand side.

Then U' = \ell u \leq \ell U, so U(t)\, e^{-\int_0^t \ell} is non-increasing. This gives u \leq U \leq |x - y|\, e^{\int_0^t \ell} (Grönwall’s lemma). Uniqueness is the case x = y. ∎

Proposition 0.7 — Flows are diffeomorphisms If moreover each v_t is C^1, with \|D v_t\|_\infty integrable in t, then every \varphi_t is a C^1 diffeomorphism, and \det D\varphi_t(x) = \exp\Big( \int_0^t \operatorname{div} v_s(\varphi_s(x))\, ds \Big) > 0 .

Proof. The inverse of \varphi_t is obtained by solving the equation backwards from time t to time 0.

Differentiating the flow equation in x gives the linear equation \frac{d}{dt} D\varphi_t(x) = D v_t(\varphi_t(x))\, D\varphi_t(x), \qquad D\varphi_0 = I.

Jacobi’s formula for the derivative of a determinant, \tfrac{d}{dt} \det M = \det M\, \mathrm{tr}(M^{-1} \dot M), then gives \frac{d}{dt} \det D\varphi_t(x) = \operatorname{div} v_t(\varphi_t(x))\, \det D\varphi_t(x) .

Integrate this linear equation. ∎

The Jacobian stays positive however large the velocity is. This is the root of the large deformation models of the syllabus: the flow of a smooth field never folds space (Code 3.4).

Hilbert spaces and reproducing kernels

Theorem 0.8 — Riesz representation and projection (i) Every continuous linear form \ell on a Hilbert space H is of the form \ell(h) = \langle u, h \rangle_H for a unique u \in H, and \|\ell\| = \|u\|_H.

  1. A non-empty closed affine subspace C \subset H has a unique element of minimal norm. It is the only element of C orthogonal to the direction of C.

Both are proved in the linear algebra and optimization refresher.

Definition 0.9 — Positive definite kernel, RKHS A symmetric function k : X \times X \to \mathbb{R} is positive definite if \sum_{i,j} a_i a_j\, k(x_i, x_j) \geq 0 for every finite family of points and coefficients.

A reproducing kernel Hilbert space (RKHS) is a Hilbert space H of functions on X in which every evaluation f \mapsto f(x) is continuous. By Theorem 0.8 it is represented by an element k(\cdot, x) \in H: f(x) = \langle f, k(\cdot, x) \rangle_H \qquad \text{(reproducing property)}.

The function k is positive definite, and conversely every positive definite kernel is the kernel of exactly one RKHS (Moore–Aronszajn theorem; Aronszajn, 1950).

The main example is the Gaussian kernel k(x, y) = \exp(-|x - y|^2 / \sigma^2). Its Fourier transform is a positive Gaussian, so it is positive definite (Bochner’s theorem), and even strictly: its Gram matrices at distinct points are invertible.

Proposition 0.10 — Minimal-norm interpolation Let x_1, \dots, x_n be points whose Gram matrix K = (k(x_i, x_j))_{ij} is invertible, and y \in \mathbb{R}^n. Among the f \in H with f(x_i) = y_i for all i, the one of smallest norm is f^\star = \sum_{j=1}^n k(\cdot, x_j)\, a_j, \qquad a = K^{-1} y, \qquad \|f^\star\|_H^2 = y^\top K^{-1} y .

Proof. The constraints define a closed affine subspace, because evaluations are continuous. Its direction is the set of f vanishing at all x_i, which by the reproducing property is the orthogonal of the span of the k(\cdot, x_i).

The function f^\star lies in that span and satisfies the constraints, since f^\star(x_i) = (K a)_i = y_i. By Theorem 0.8 (ii) it is the minimizer.

Finally, by the reproducing property, \|f^\star\|^2 = \sum_{i,j} a_i a_j\, k(x_i, x_j) = a^\top K a = y^\top K^{-1} y . ∎

Example 0.11 — The price of tearing two points apart Take the Gaussian kernel and two points at distance \sigma, so that k(x_1, x_2) = e^{-1} = 0.368. Ask for the values y = (1, 0).

Inverting the 2 \times 2 Gram matrix gives a = (1.156, -0.425) and \|f^\star\|_H^2 = \frac{1}{1 - e^{-2}} = 1.156 .

A single isolated constraint would cost 1: forcing different values at two close points costs 16 % more. At distance \sigma / 2 the factor becomes 1 / (1 - e^{-1/2}) = 2.541. This price of tearing nearby points apart returns in ch. 4: the kernel width \sigma is the scale below which points move together.

Key takeaways — chapter 0

  • The gradient depends on the inner product: the V-gradient is the L^2-gradient smoothed by the kernel K.
  • A kinetic Lagrangian \tfrac12 \dot q^\top G \dot q has Hamiltonian \tfrac12 p^\top K p with K = G^{-1}; Hamilton’s equations conserve H.
  • Flows of fields that are Lipschitz in space are diffeomorphisms, with a positive Jacobian whatever their size.
  • In an RKHS, the minimal-norm interpolant is a combination of kernels at the data points, with squared norm y^\top K^{-1} y.

1. Riemannian geometry and Kendall’s shape space

A space of shapes needs three things: a notion of length for a continuous change of shape, the shortest paths it defines, and a way to linearize the space around a reference shape. Riemannian geometry provides all three. This chapter sets them up in finite dimension and builds the first shape space, Kendall’s space of landmark configurations modulo translation, scale and rotation.

Manifolds, metrics and geodesics

Definition 1.1 — Submanifold and tangent space A subset M \subset \mathbb{R}^N is a smooth submanifold of dimension m if, near each of its points, it is the zero set of a smooth map F : \mathbb{R}^N \to \mathbb{R}^{N - m} whose differential is onto. The tangent space at x is T_x M = \ker DF(x), the set of velocities \gamma'(0) of smooth curves \gamma in M with \gamma(0) = x.

Examples: an open subset of \mathbb{R}^N (tangent space \mathbb{R}^N), and the unit sphere, defined by F(x) = |x|^2 - 1, with T_x S^{N-1} = x^\perp.

All finite-dimensional spaces of this course are of this kind. Spaces of diffeomorphisms, curves and images are infinite-dimensional; their geometry is built by hand in ch. 3–7.

Definition 1.2 — Riemannian metric, length, distance A Riemannian metric is a family of inner products \langle \cdot, \cdot \rangle_x on the tangent spaces T_x M that depends smoothly on x. In coordinates, |\xi|_x^2 = \xi^\top G(x)\, \xi with G(x) symmetric positive definite.

For a piecewise C^1 path \gamma : [0, 1] \to M, the length and the energy are L(\gamma) = \int_0^1 |\dot \gamma(t)|_{\gamma(t)}\, dt, \qquad E(\gamma) = \frac12 \int_0^1 |\dot \gamma(t)|_{\gamma(t)}^2\, dt .

The geodesic distance d(x, y) is the infimum of the lengths of the paths from x to y.

Proposition 1.3 — Energy versus length For every path, L(\gamma)^2 \leq 2 E(\gamma), with equality if and only if the speed |\dot \gamma| is constant. Consequently, d(x, y)^2 = \inf \{ 2 E(\gamma) : \gamma(0) = x,\ \gamma(1) = y \}, and the minimizers of the energy are the constant-speed minimizers of the length.

Proof. By the Cauchy–Schwarz inequality, \Big( \int_0^1 |\dot \gamma| \cdot 1\, dt \Big)^2 \leq \int_0^1 |\dot \gamma|^2\, dt , with equality exactly when |\dot \gamma| is constant.

Any path can be reparametrized by its normalized arc length. This keeps its length and makes its speed constant, so the infimum of 2E equals the infimum of L^2. ∎

Minimizing the energy rather than the length is the standard choice: the energy is smooth and convex in the velocity, and the parametrization comes out right automatically.

Theorem 1.4 — Geodesic equation, Lagrangian and Hamiltonian forms A critical point of the energy with fixed endpoints satisfies, in coordinates, \ddot \gamma^k + \sum_{i,j} \Gamma^k_{ij}\, \dot \gamma^i \dot \gamma^j = 0, \qquad \Gamma^k_{ij} = \frac12 \sum_l G^{kl} \big( \partial_i G_{jl} + \partial_j G_{il} - \partial_l G_{ij} \big), where G^{kl} are the entries of G^{-1}. Equivalently, with p = G(q)\, \dot q and the cometric K(q) = G(q)^{-1}, \dot q = K(q)\, p, \qquad \dot p = -\frac12\, \partial_q \big( p^\top K(q)\, p \big).

Such a curve is called a geodesic. It has constant speed.

Proof. Apply Theorem 0.3 to L = \tfrac12 \dot q^\top G(q) \dot q. The equation for the coordinate l reads \sum_j G_{lj}\, \ddot q^j + \sum_{i,j} \partial_i G_{lj}\, \dot q^i \dot q^j = \frac12 \sum_{i,j} \partial_l G_{ij}\, \dot q^i \dot q^j .

Symmetrize the second sum in (i, j) and multiply by G^{-1}: this gives the Christoffel form. The Hamiltonian form is Proposition 0.5, which also gives the conservation of H = \tfrac12 |\dot q|^2_q. ∎

Geodesics are the critical points of the energy. They minimize length between points that are close enough, but not necessarily between distant ones: on the sphere, a great circle stops minimizing after half a turn.

The exponential map

Definition 1.5 — Exponential and logarithm For v \in T_x M, let \gamma_v be the geodesic with \gamma_v(0) = x and \dot \gamma_v(0) = v. The exponential map is \exp_x(v) = \gamma_v(1).

Where it is invertible, its inverse is the logarithm \log_x. The vector \log_x(y) is the initial velocity of the geodesic that goes from x to y in unit time.

Proposition 1.6 — Local behaviour of the exponential map The differential of \exp_x at 0 is the identity. Hence \exp_x maps a small ball of T_x M diffeomorphically onto a neighbourhood of x, and inside that ball d(x, \exp_x(v)) = |v|_x .

Proof. By uniqueness of geodesics, \gamma_{tv}(1) = \gamma_v(t). So t \mapsto \exp_x(tv) is the geodesic \gamma_v, whose velocity at 0 is v: the differential at 0 is the identity. The inverse function theorem gives the local diffeomorphism.

The distance formula follows from the Gauss lemma: radial geodesics are orthogonal to the images of small spheres (do Carmo, 1992, ch. 3). ∎

The coordinates v = \log_x(y) are the normal coordinates at x. They are the linear coordinates in which shape statistics are computed (ch. 8). Two limits matter in practice.

Theorem 1.7 — Hopf–Rinow If a connected, finite-dimensional Riemannian manifold is complete as a metric space, then \exp_x is defined on the whole of T_x M, and any two points are joined by a minimizing geodesic.

This theorem fails in infinite dimension (Atkin, 1975). The existence of optimal deformations in ch. 3, 4 and 7 is therefore proved directly, by compactness arguments.

Example 1.8 — Exponential and logarithm on the sphere On the unit sphere, for v \perp x, the geodesics are great circles, and \exp_x(v) = \cos(|v|)\, x + \sin(|v|)\, \frac{v}{|v|} .

For y \neq -x, with \theta = \arccos \langle x, y \rangle, the logarithm is \log_x(y) = \theta\, \frac{y - \cos\theta\, x}{|y - \cos\theta\, x|} .

With x = (0, 0, 1) and y = (1, 0, 0): \theta = \pi / 2 and \log_x(y) = (\pi/2, 0, 0), a tangent vector of length 1.571.

Quotients by a group of isometries

A shape is what remains of a configuration once position, size and orientation are forgotten. Mathematically, this is a quotient by a group that acts by isometries.

Definition 1.9 — Quotient distance Let a group G act on a metric space (M, d) by isometries: d(g \cdot x, g \cdot y) = d(x, y). The quotient distance between the orbits [x] and [y] is \bar d([x], [y]) = \inf_{g \in G} d(x, g \cdot y).

It does not depend on the representatives, it is symmetric, and it satisfies the triangle inequality. It is a distance when the orbits are closed.

Proof. For the triangle inequality, d(x, gh \cdot z) \leq d(x, g \cdot y) + d(g \cdot y, gh \cdot z), and the last term equals d(y, h \cdot z) by isometry. Take the infimum over g, then over h.

If \bar d([x], [y]) = 0, then x is a limit of points of the orbit of y, hence belongs to it when the orbit is closed. ∎

When a Lie group acts freely and properly by isometries on a Riemannian manifold, the quotient is a manifold. Its metric is the restriction of the metric to horizontal vectors, those orthogonal to the orbit. Horizontal geodesics project onto geodesics of the quotient (a Riemannian submersion; see Lee, 2018).

Definition 1.10 — Kendall’s preshape sphere Represent k \geq 3 landmarks of the plane as a complex vector z \in \mathbb{C}^k. Removing translation (\sum_j z_j = 0) and scale (\|z\| = 1) leaves the preshape sphere \mathcal{S}_k = \Big\{ z \in \mathbb{C}^k : \sum_j z_j = 0,\ \|z\| = 1 \Big\}, a sphere of real dimension 2k - 3 with the great-circle distance \arccos \operatorname{Re} \langle z, w \rangle. Here \langle z, w \rangle = \sum_j \bar z_j w_j.

Rotations act by z \mapsto e^{i\theta} z, isometrically. Kendall’s shape space is the quotient \Sigma_2^k = \mathcal{S}_k / SO(2).

Theorem 1.11 — Kendall’s shape distance The quotient distance on \Sigma_2^k is d([z], [w]) = \arccos |\langle z, w \rangle| , and the optimal rotation of w onto z is multiplication by \langle w, z \rangle / |\langle z, w \rangle|.

Proof. Since \arccos is decreasing, we must maximize over \theta the quantity \operatorname{Re} \langle z, e^{i\theta} w \rangle = \operatorname{Re}\big( e^{i\theta} \langle z, w \rangle \big) .

Writing \langle z, w \rangle = r e^{i\alpha}, this equals r \cos(\theta + \alpha). Its maximum is r = |\langle z, w \rangle|, reached at e^{i\theta} = e^{-i\alpha}, which is the stated factor. ∎

Kendall (1984) showed that \Sigma_2^k is the complex projective space \mathbb{C}P^{k-2} with the Fubini–Study metric. Its diameter is \pi / 2.

For triangles (k = 3) it is a sphere of radius 1/2. The two mirror-image equilateral triangles are its poles, and the collinear triangles form its equator.

After the optimal rotation, \langle z, w \rangle is real and positive, and the great circle from z to the rotated w is horizontal. Its projection is therefore a geodesic of shape space.

Code 1.12 — Distances and geodesics between triangles The code computes Kendall distances between three triangles, checks the invariance under a similarity, and builds the midpoint of a shape geodesic.

import numpy as np

def preshape(X):
    """Centre and scale k planar landmarks; return them as a unit complex vector."""
    z = X[:, 0] + 1j * X[:, 1]
    z = z - z.mean()
    return z / np.linalg.norm(z)

def kendall_dist(X, Y):
    """Distance in Kendall's shape space of planar configurations (Theorem 1.11)."""
    z, w = preshape(X), preshape(Y)
    return np.arccos(min(1.0, abs(np.vdot(z, w))))

def geodesic(X, Y, t):
    """Point at time t of the shape geodesic: rotate Y onto X, then follow the great circle."""
    z, w = preshape(X), preshape(Y)
    c = np.vdot(w, z)
    w = w * c / abs(c)                       # optimal rotation of w (Procrustes)
    rho = np.arccos(min(1.0, abs(np.vdot(z, w))))
    g = (np.sin((1 - t) * rho) * z + np.sin(t * rho) * w) / np.sin(rho)
    return np.c_[g.real, g.imag]

equi = np.array([[0, 0], [1, 0], [0.5, np.sqrt(3) / 2]])
flat = np.array([[0, 0], [1, 0], [2, 0]])
right = np.array([[0, 0], [1, 0], [0, 1]])
mirror = equi * [1, -1]                      # the reflected equilateral triangle

print(f"d(equilateral, collinear)  = {kendall_dist(equi, flat):.4f}   (pi/4 = {np.pi/4:.4f})")
print(f"d(equilateral, right)      = {kendall_dist(equi, right):.4f}")
print(f"d(equilateral, mirror)     = {kendall_dist(equi, mirror):.4f}   (pi/2 = {np.pi/2:.4f})")

th = 0.7                                     # similarity invariance
Rot = np.array([[np.cos(th), -np.sin(th)], [np.sin(th), np.cos(th)]])
moved = 3.0 * right @ Rot.T + [5.0, -2.0]
print(f"d(equilateral, moved right) = {kendall_dist(equi, moved):.4f}")

mid = geodesic(equi, flat, 0.5)              # the midpoint is halfway on both sides
print(f"midpoint: d to each end = {kendall_dist(equi, mid):.4f}, {kendall_dist(mid, flat):.4f}")

The equilateral triangle is at distance \pi / 4 = 0.7854 from the collinear one (pole to equator) and at distance \pi / 2 from its mirror image (pole to pole).

The right isosceles triangle is at 0.2618 = \pi / 12, before and after a rotation, a scaling by 3 and a translation. The midpoint of the geodesic lies at 0.3927 from both ends.

In three dimensions the rotation group no longer acts freely: a collinear configuration is fixed by the rotations about its line, and the quotient has singular points. The optimal rotation is then given by the singular value decomposition (Procrustes analysis; Gower, 1975).

Key takeaways — chapter 1

  • A Riemannian metric gives lengths, a geodesic distance, and geodesics as critical points of the energy; constant-speed energy minimizers are length minimizers.
  • The geodesic equation has a Hamiltonian form with the cometric K = G^{-1}.
  • The exponential map is a local diffeomorphism at the origin; its inverse gives normal coordinates, valid up to the cut locus.
  • Shapes are orbits: quotienting by isometries gives a distance by optimal alignment. For planar landmarks, d = \arccos |\langle z, w \rangle| on centred, normalized complex vectors.

2. Lie groups, actions and metrics induced by deformations

Kendall’s space came from a group of symmetries: moves that do not change the shape. The course’s main construction uses a group differently. The group deforms the objects, the cost of an infinitesimal deformation is fixed once and for all, and the metric on objects is the cheapest way to produce a given change. This chapter carries out the construction in finite dimension, where each step can be checked by hand.

Matrix Lie groups

Definition 2.1 — Matrix Lie group and Lie algebra A closed subgroup G of GL(d) is a Lie group (Cartan’s theorem). Its Lie algebra is \mathfrak{g} = \{ \xi \in \mathbb{R}^{d \times d} : \exp(t\xi) \in G \text{ for all } t \}.

It is a vector space, closed under the bracket [\xi, \eta] = \xi\eta - \eta\xi, and the tangent space at g is T_g G = \{ \xi g : \xi \in \mathfrak{g} \}.

Examples: for SO(d) the skew-symmetric matrices, for SL(d) the matrices of zero trace, for GL(d) all matrices.

Proposition 2.2 — Paths and Eulerian velocity Every C^1 path g(t) in G with g(0) = \mathrm{id} solves \dot g = \xi(t)\, g, \qquad \xi(t) = \dot g\, g^{-1} \in \mathfrak{g}.

Conversely, every continuous \xi : [0, 1] \to \mathfrak{g} generates a unique path in G through this equation.

Proof. Sketch. For fixed t, the path s \mapsto g(t + s)\, g(t)^{-1} lies in G and passes through the identity at s = 0. Its velocity there, \dot g(t)\, g(t)^{-1}, is a tangent vector at the identity, hence an element of \mathfrak{g}.

Conversely, the linear equation has a unique solution by Theorem 0.6. It is the limit of products of exponentials \exp(\xi(t_k)\, \delta t), which lie in G, so it stays in G because G is closed. ∎

The velocity \xi = \dot g g^{-1} is the right-trivialized, or Eulerian, velocity. It is the finite-dimensional model of the flow equation \partial_t \varphi_t = v_t \circ \varphi_t of ch. 3, where v_t is the velocity field seen at the current position of the points.

Group actions

Definition 2.3 — Action, orbit, infinitesimal action A (left) action of G on a manifold Q is a map (g, q) \mapsto g \cdot q such that \mathrm{id} \cdot q = q and g \cdot (h \cdot q) = (gh) \cdot q.

The orbit of q is G \cdot q. The infinitesimal action of \xi \in \mathfrak{g} is the tangent vector \xi \cdot q = \frac{d}{dt} \exp(t\xi) \cdot q \Big|_{t=0} \in T_q Q, which is linear in \xi.

Group Objects q Action g \cdot q Infinitesimal action \xi \cdot q
GL(d) landmarks (x_1, \dots, x_n) (A x_i)_i (\xi x_i)_i
GL(d) SPD matrices \Sigma A \Sigma A^\top \xi\Sigma + \Sigma\xi^\top
diffeomorphisms landmarks (ch. 4) (\varphi(x_i))_i (v(x_i))_i
diffeomorphisms images (ch. 6) I \circ \varphi^{-1} -\nabla I \cdot v
diffeomorphisms densities (ch. 6) \lvert\det D\varphi^{-1}\rvert\, \rho \circ \varphi^{-1} -\operatorname{div}(\rho\, v)

When the group is a symmetry: invariant metrics

A metric on Q is invariant if every map q \mapsto g \cdot q is an isometry. Kendall’s metric is invariant under rotations. The second classical example, used for diffusion tensor fields in ch. 6, lives on symmetric positive definite (SPD) matrices.

Proposition 2.4 — The affine-invariant metric On the SPD matrices, the inner product \langle \eta, \zeta \rangle_\Sigma = \operatorname{tr}\big( \Sigma^{-1} \eta\, \Sigma^{-1} \zeta \big) is invariant under \Sigma \mapsto A \Sigma A^\top for every invertible A (Pennec, Fillard and Ayache, 2006).

Proof. The tangent vectors are transported as \eta \mapsto A \eta A^\top. Then \operatorname{tr}\big( (A\Sigma A^\top)^{-1} A \eta A^\top (A\Sigma A^\top)^{-1} A \zeta A^\top \big) = \operatorname{tr}\big( A^{-\top} \Sigma^{-1} \eta\, \Sigma^{-1} \zeta A^\top \big), which equals \mathrm{tr}(\Sigma^{-1} \eta\, \Sigma^{-1} \zeta) by invariance of the trace under conjugation. ∎

Proposition 2.5 — Geodesics and distance between SPD matrices The geodesic from \Sigma_1 to \Sigma_2 is \Sigma(t) = \Sigma_1^{1/2} \big( \Sigma_1^{-1/2} \Sigma_2 \Sigma_1^{-1/2} \big)^t\, \Sigma_1^{1/2}, and the distance is d(\Sigma_1, \Sigma_2) = \big\| \log\big( \Sigma_1^{-1/2} \Sigma_2 \Sigma_1^{-1/2} \big) \big\|_F = \Big( \sum_i \log^2 \lambda_i \Big)^{1/2}, where the \lambda_i are the eigenvalues of \Sigma_1^{-1} \Sigma_2.

Proof. By invariance (take A = \Sigma_1^{-1/2}), it suffices to treat \Sigma_1 = I. Write \Sigma_2 = U \operatorname{diag}(\lambda) U^\top.

The path \Sigma(t) = U \mathrm{diag}(\lambda^t) U^\top satisfies \Sigma^{-1} \dot\Sigma = U \operatorname{diag}(\log \lambda)\, U^\top . Its speed is therefore constant, equal to \|\log \Sigma_2\|_F, and so is its length.

That no path is shorter follows from the non-positive curvature of this metric, which makes \exp_I distance non-decreasing (Bhatia, 2007, ch. 6). ∎

Code 2.6 — Averaging two diffusion tensors An elongated tensor and the same tensor turned by 60° are averaged in three ways. The code also checks the invariance of Proposition 2.4 and that the affine-invariant midpoint is at half the distance.

import numpy as np

def spd_fun(S, f):
    """Apply f to the eigenvalues of a symmetric matrix S."""
    w, U = np.linalg.eigh(S)
    return (U * f(w)) @ U.T

def dist_ai(A, B):
    """Affine-invariant distance ||log(A^{-1/2} B A^{-1/2})||_F (Proposition 2.5)."""
    Ai = spd_fun(A, lambda w: w ** -0.5)
    return np.linalg.norm(spd_fun(Ai @ B @ Ai, np.log))

def geo_ai(A, B, t):
    """Affine-invariant geodesic A^{1/2} (A^{-1/2} B A^{-1/2})^t A^{1/2}."""
    Ah, Ai = spd_fun(A, np.sqrt), spd_fun(A, lambda w: w ** -0.5)
    return Ah @ spd_fun(Ai @ B @ Ai, lambda w: w ** t) @ Ah

def rot(deg):
    a = np.radians(deg)
    return np.array([[np.cos(a), -np.sin(a)], [np.sin(a), np.cos(a)]])

A = np.diag([4.0, 0.25])                     # an elongated "diffusion tensor"
B = rot(60) @ A @ rot(60).T                  # the same tensor turned by 60 degrees

mid_euc = (A + B) / 2
mid_ai = geo_ai(A, B, 0.5)
mid_le = spd_fun((spd_fun(A, np.log) + spd_fun(B, np.log)) / 2, np.exp)
for name, M in [("Euclidean", mid_euc), ("affine-invariant", mid_ai), ("log-Euclidean", mid_le)]:
    print(f"{name:17s} midpoint: det = {np.linalg.det(M):.3f}, eigenvalues = {np.round(np.linalg.eigvalsh(M), 3)}")

rng = np.random.default_rng(0)
G = rng.standard_normal((2, 2))              # any invertible matrix acts by S -> G S G^T
print(f"d(A, B) = {dist_ai(A, B):.4f}, d(GAG^T, GBG^T) = {dist_ai(G @ A @ G.T, G @ B @ G.T):.4f}")
print(f"d(A, mid) = {dist_ai(A, mid_ai):.4f}, d(mid, B) = {dist_ai(mid_ai, B):.4f}")
Midpoint Determinant Eigenvalues
Euclidean (A + B)/2 3.637 1.187, 3.063
affine-invariant 1.000 0.623, 1.606
log-Euclidean 1.000 0.500, 2.000

Both tensors have determinant 1, yet their Euclidean average has determinant 3.64: averaging entries inflates the volume, the swelling effect. The geometric means keep the determinant. The distance is 3.5681 before and after the action of a random G, and the affine-invariant midpoint lies at 1.7841 from both tensors, half of it.

The log-Euclidean mean, \exp\big(\tfrac12 (\log A + \log B)\big), is a cheaper alternative that also avoids swelling (Arsigny, Fillard, Pennec and Ayache, 2007).

When the group deforms: projected metrics

Choose an inner product \langle \cdot, \cdot \rangle on the Lie algebra and declare the cost of a path g(t) to be \int |\dot g g^{-1}|^2 dt. This defines a right-invariant metric on G: right multiplication by a fixed element does not change the Eulerian velocity. The metric on objects follows.

Definition 2.7 — Projected metric Let G act on Q and let A_q : \mathfrak{g} \to T_q Q be the infinitesimal action, A_q \xi = \xi \cdot q. For \eta tangent to the orbit of q, |\eta|_q = \min \{ |\xi| : \xi \cdot q = \eta \}.

It is the cost of the cheapest infinitesimal deformation that produces the change \eta.

Theorem 2.8 — Structure of the projected metric Suppose \mathfrak{g} has finite dimension and A_q is onto T_q Q.

  1. The minimum is reached at a unique \xi^\star, the only solution orthogonal to \ker A_q.
  2. Writing \xi^\star = A_q^* p, the momentum p solves K(q)\, p = \eta, where K(q) = A_q A_q^*, and |\eta|_q^2 = \eta^\top K(q)^{-1} \eta = p^\top K(q)\, p .
  3. For paths, the minimal group energy \int_0^1 |\xi_t|^2\, dt needed to bring q_0 to q_1 equals the minimal energy \int_0^1 |\dot q|_q^2\, dt of paths of objects from q_0 to q_1.

Proof.

  1. The solutions form an affine subspace directed by \ker A_q: Theorem 0.8 (ii).

  2. The orthogonal of \ker A_q is the range of A_q^*. Writing \xi^\star = A_q^* p, the constraint reads A_q A_q^* p = \eta, and |\xi^\star|^2 = \langle A_q^* p, A_q^* p \rangle = p^\top K(q)\, p .

  3. A path of the group gives q(t) = g(t) \cdot q_0 with \dot q = \xi_t \cdot q, so |\dot q|_q \leq |\xi_t|.

Conversely, a path q(t) gives at each time the optimal \xi^\star_t. Solving \dot g = \xi^\star_t\, g yields g(t) \cdot q_0 = q(t), because both solve \dot q = \xi^\star_t \cdot q with the same start. ∎

Key result — geodesics of a projected metric With the cometric K(q) = A_q A_q^*, geodesics on objects solve Hamilton’s equations for H(q, p) = \frac12\, p^\top K(q)\, p, \qquad \dot q = K(q)\, p, \qquad \dot p = -\partial_q H , and the deformation that drives them is \xi_t = A_{q(t)}^*\, p(t).

Example 2.9 — The linear group is too small Let GL(2), with the Frobenius inner product on \mathfrak{gl}(2), act on n landmarks of the plane. The identity \sum_i (\xi x_i) \cdot p_i = \Big\langle \xi, \sum_i p_i x_i^\top \Big\rangle_F shows that the adjoint is A_q^* p = \sum_i p_i x_i^\top. Hence (K(q)\, p)_i = \Big( \sum_j p_j x_j^\top \Big) x_i = \sum_j (x_i \cdot x_j)\, p_j .

This is the kernel matrix of the linear kernel k(x, y) = x \cdot y. Its rank is at most 4, the dimension of the group. With n \geq 3 landmarks the orbit is a thin subset of \mathbb{R}^{2n}, and most configurations cannot be reached.

To move n points independently, the group must be infinite-dimensional, and the linear kernel must be replaced by a kernel whose Gram matrices are invertible, such as the Gaussian. This is the group of diffeomorphisms of ch. 3, and its cometric on landmarks is the Gaussian kernel matrix (ch. 4).

The Euler–Poincaré equation

Theorem 2.10 — Euler–Poincaré equation for a right-invariant metric Let \langle \xi, \eta \rangle = \langle L\xi, \eta \rangle with L symmetric positive. If g is a critical path of \tfrac12 \int_0^1 |\dot g g^{-1}|^2\, dt with fixed endpoints, then m = L\xi satisfies \dot m + \operatorname{ad}^*_\xi m = 0, \qquad \langle \operatorname{ad}^*_\xi m, \eta \rangle = \langle m, [\xi, \eta] \rangle .

Equivalently, the quantity \langle m(t), g(t)\, \eta\, g(t)^{-1} \rangle is constant in time for every \eta: the momentum is transported by the group.

Proof. Perturb the path as g_\varepsilon = (I + \varepsilon \eta)\, g, up to o(\varepsilon), where \eta(t) vanishes at t = 0 and t = 1.

A direct computation gives the variation of the velocity: \delta\xi = \dot\eta + \eta\xi - \xi\eta = \dot\eta - [\xi, \eta] .

The variation of the energy is \int_0^1 \langle m, \dot\eta - [\xi, \eta] \rangle\, dt. An integration by parts turns it into -\int_0^1 \langle \dot m + \operatorname{ad}^*_\xi m, \eta \rangle\, dt , which vanishes for every \eta.

For the conservation law, set \zeta = g \eta g^{-1}, so that \dot \zeta = [\xi, \zeta] for a fixed \eta. The derivative of \langle m, \zeta \rangle is then \langle \dot m + \operatorname{ad}^*_\xi m, \zeta \rangle = 0 . ∎

Arnold (1966) showed that the Euler equations of a perfect incompressible fluid are of this form, for the group of volume-preserving diffeomorphisms with the L^2 metric. On the group of diffeomorphisms with the metric of V, the equation is called EPDiff (ch. 3). Its conservation form says that the whole geodesic is determined by its initial momentum. This is the basis of geodesic shooting.

Key takeaways — chapter 2

  • A group can act as symmetries (invariant metrics: Kendall, affine-invariant SPD) or as deformations (projected metrics).
  • The projected metric is the cost of the cheapest infinitesimal deformation producing a given change: |\eta|_q^2 = \eta^\top K(q)^{-1} \eta with K(q) = A_q A_q^*.
  • Geodesics on objects are Hamiltonian with H = \tfrac12 p^\top K(q) p; the driving deformation is A_q^* p.
  • For a right-invariant metric, the momentum m = L\xi obeys \dot m + \operatorname{ad}^*_\xi m = 0 and is transported by the group.

3. Groups of diffeomorphisms built from kernels

To move any configuration of points, any curve or any image, the deforming group must be infinite-dimensional: it is a group of diffeomorphisms of \mathbb{R}^d. Its “Lie algebra” is a Hilbert space V of smooth vector fields, and the norm of V is the cost of an infinitesimal deformation. The construction (Trouvé, 1998; Dupuis, Grenander and Miller, 1998) follows ch. 2 step by step, but each finite-dimensional fact has to be proved again.

Admissible spaces of vector fields

Definition 3.1 — Admissible space A Hilbert space V of vector fields on \mathbb{R}^d is admissible if it is continuously embedded in C^1_0(\mathbb{R}^d, \mathbb{R}^d), the C^1 fields that vanish at infinity together with their derivative: \|v\|_{1, \infty} = \sup_x |v(x)| + \sup_x \|Dv(x)\| \leq c_V\, \|v\|_V .

Proposition 3.2 — Admissible spaces are reproducing kernel spaces If V is admissible, there is a matrix-valued kernel K(x, y) \in \mathbb{R}^{d \times d} such that, for all x, a \in \mathbb{R}^d and v \in V, K(\cdot, x)\, a \in V, \qquad \langle K(\cdot, x)\, a, v \rangle_V = a \cdot v(x).

The kernel satisfies K(y, x) = K(x, y)^\top and is positive definite: \sum_{i,j} a_i^\top K(x_i, x_j)\, a_j \geq 0.

Proof. The map v \mapsto a \cdot v(x) is linear and continuous, since |a \cdot v(x)| \leq |a|\, c_V \|v\|_V. By the Riesz theorem it is represented by an element of V, linear in a, which we write K(\cdot, x) a.

Symmetry follows from b \cdot K(y, x)\, a = \langle K(\cdot, y)\, b, K(\cdot, x)\, a \rangle_V = a \cdot K(x, y)\, b . Positivity: the double sum is the squared norm of \sum_j K(\cdot, x_j) a_j. ∎

The standard choice is K(x, y) = k(x, y)\, I_d with the Gaussian k(x, y) = \exp(-|x - y|^2 / \sigma^2). Sobolev spaces H^s with s > d/2 + 1 are also admissible, by the Sobolev embedding theorem.

In operator form, \|v\|_V^2 = \langle L v, v \rangle_{L^2}, with L the inverse of the convolution by K. For Sobolev spaces, L = (I - \alpha \Delta)^s.

The momentum of v is m = L v, so that v = K m. In ch. 4 the momentum is a sum of Dirac masses, and in ch. 6 it is concentrated on the edges of an image.

Flows and the group G_V

Theorem 3.3 — Flows of V-valued paths Let v \in L^2([0, 1], V). For every x, the equation \partial_t \varphi_t(x) = v_t(\varphi_t(x)), \varphi_0(x) = x, has a unique solution. Every \varphi_t is a C^1 diffeomorphism with a positive Jacobian, and |\varphi_t(x) - \varphi_t(y)| \leq \exp\Big( c_V \int_0^t \|v_s\|_V\, ds \Big)\, |x - y| .

Proof. The Lipschitz constant of v_t is at most \|D v_t\|_\infty \leq c_V \|v_t\|_V. It is integrable on [0, 1], by the Cauchy–Schwarz inequality.

Theorem 0.6 then gives existence, uniqueness and the estimate, and Proposition 0.7 gives the diffeomorphism property and the Jacobian. ∎

The simplest alternative to a flow is the “small deformation” model x \mapsto x + v(x). It is guaranteed to be a diffeomorphism when \|Dv\|_\infty < 1, and it folds as soon as \det(I + Dv) changes sign. The next code compares the two for a single Gaussian push.

Code 3.4 — Flow versus addition of a displacement The stationary field v(x) = s\, k(x, 0)\, e_1, with \sigma = 0.25 and s = 0.6, pushes the neighbourhood of the origin to the right. Along the axis, \det D(x + v(x)) = 1 + s\, \partial_1 k(x, 0), whose minimum is 1 - (s \sqrt 2 / \sigma)\, e^{-1/2}.

import numpy as np

sigma, s = 0.25, 0.6                         # kernel width and strength of the push

def v(x):
    """Stationary field s * k(x, 0) * (1, 0): one Gaussian kernel at the origin, pushing right."""
    k = np.exp(-(x ** 2).sum(-1, keepdims=True) / sigma ** 2)
    return s * k * np.array([1.0, 0.0])

n = 201
g = np.linspace(-1, 1, n)
X = np.stack(np.meshgrid(g, g, indexing="ij"), -1)   # grid of points, shape (n, n, 2)
h = g[1] - g[0]

def min_jacobian(Phi):
    """Smallest determinant of the finite-difference Jacobian of a map sampled on the grid."""
    dx, dy = np.gradient(Phi, h, axis=(0, 1))
    return (dx[..., 0] * dy[..., 1] - dx[..., 1] * dy[..., 0]).min()

linear = X + v(X)                            # "small deformation" model x -> x + v(x)

Phi, steps = X.copy(), 100                   # flow of v for unit time (Euler steps)
for _ in range(steps):
    Phi = Phi + v(Phi) / steps

print(f"bound 1 - s*sqrt(2)/sigma*exp(-1/2) = {1 - s * np.sqrt(2) / sigma * np.exp(-0.5):.3f}")
print(f"min det D(x + v(x)) = {min_jacobian(linear):.3f}")
print(f"min det D(phi_1)    = {min_jacobian(Phi):.3f}")
print(f"displacement of the origin: linear {linear[100, 100, 0]:.3f}, flow {Phi[100, 100, 0]:.3f}")

The added displacement folds space: its Jacobian reaches -1.056 (the prediction is -1.059). The flow of the same field has a minimal Jacobian of 0.191.

The flow moves the origin by only 0.315 instead of 0.6: a point leaving the bump of the kernel slows down. Large displacements are obtained by composing many small ones, never by adding them.

Definition 3.5 — The group G_V and its distance The group of diffeomorphisms generated by V is G_V = \{ \varphi_1^v : v \in L^2([0, 1], V) \}, where \varphi^v is the flow of v. For \varphi, \psi \in G_V, set d_V(\varphi, \psi) = \inf \Big\{ \Big( \int_0^1 \|v_t\|_V^2\, dt \Big)^{1/2} : \varphi_1^v \circ \varphi = \psi \Big\} .

Theorem 3.6 — Trouvé’s group (i) G_V is a group for composition. (ii) d_V is a distance on G_V, invariant by right composition: d_V(\varphi \circ \chi, \psi \circ \chi) = d_V(\varphi, \psi). (iii) (G_V, d_V) is complete, and for all \varphi, \psi \in G_V the infimum defining d_V(\varphi, \psi) is attained.

Proof. Sketch. (i) The composition of two flows is the flow of the concatenated velocity, run at double speed on each half of [0, 1]; the inverse of \varphi_1^v is the flow of w_t = -v_{1-t}.

  1. The identity \varphi_1^v \circ \varphi = \psi is equivalent to \varphi_1^v \circ (\varphi \circ \chi) = \psi \circ \chi, so the admissible velocities are the same. The triangle inequality follows by concatenation and Proposition 1.3.

  2. A minimizing sequence v^n is bounded in L^2([0, 1], V), so a subsequence converges weakly to some v. The key lemma is that flows depend continuously on the velocity for this weak convergence, uniformly on compact sets. The norm being weakly lower semicontinuous, v is optimal (Trouvé, 1998; Younes, 2010, ch. 8). ∎

G_V is not a Lie group in the classical sense, because composition is not smooth for the natural topology. Yet the calculus of ch. 2 goes through, with one tool: the derivative of the flow with respect to the velocity.

Variations of a flow

Proposition 3.7 — Derivative of the flow Write \varphi_{s,t} = \varphi_t \circ \varphi_s^{-1} for the flow from time s to time t. For a perturbation h \in L^2([0, 1], V), \frac{d}{d\varepsilon} \varphi_1^{v + \varepsilon h}(x) \Big|_{\varepsilon = 0} = \int_0^1 D\varphi_{t,1}(\varphi_t(x))\, h_t(\varphi_t(x))\, dt .

Proof. The derivative w_t of \varphi_t^{v + \varepsilon h}(x) with respect to \varepsilon solves the linearized equation \dot w_t = D v_t(\varphi_t(x))\, w_t + h_t(\varphi_t(x)), \qquad w_0 = 0 .

The resolvent of the homogeneous part, from time t to time 1, is D\varphi_{t,1}(\varphi_t(x)): differentiate \varphi_{t,1} \circ \varphi_t = \varphi_1. The variation of constants formula (Duhamel) gives the result. ∎

Every gradient computed in ch. 4–7 is an application of this formula, followed by Proposition 0.2 to turn an L^2-gradient into a V-gradient.

Geodesics: EPDiff and momentum conservation

For a diffeomorphism \varphi and a vector field w, write \operatorname{Ad}_\varphi w = (D\varphi\, w) \circ \varphi^{-1} , the field w transported by \varphi.

Theorem 3.8 — EPDiff and momentum transport Let v be a critical point of \int_0^1 \|v_t\|_V^2\, dt among velocities with the same endpoint \varphi_1, and let m_t = L v_t. Then for every w \in V the quantity \langle m_t, \operatorname{Ad}_{\varphi_t} w \rangle is constant in time. For a smooth momentum this means m_t = |\det D\varphi_t^{-1}|\, (D\varphi_t^{-1})^\top\, m_0 \circ \varphi_t^{-1}, and, infinitesimally (EPDiff), \partial_t m + (Dm)\, v + (Dv)^\top m + (\operatorname{div} v)\, m = 0 .

Moreover \|v_t\|_V is constant in time.

This is Theorem 2.10 for the group G_V, where \operatorname{Ad}_\varphi replaces \eta \mapsto g \eta g^{-1}. A complete proof requires care with the infinite-dimensional setting (Miller, Trouvé and Younes, 2006; Younes, 2010). For landmarks, ch. 4 checks it by a direct computation (Proposition 4.4).

Holm, Marsden and Ratiu (1998) derived the same equation as the Euler–Poincaré equation of the diffeomorphism group.

Geodesic shooting Theorem 3.8 says that the whole optimal path is encoded by the initial momentum m_0. Solve together v_t = K m_t, \partial_t \varphi_t = v_t \circ \varphi_t and the transport of m_t: the endpoint \varphi_1 is the Riemannian exponential of K m_0 at the identity.

The initial momentum is thus a linear coordinate on the space of deformations of a template. This is the “local exponential chart” of the syllabus, and the vector space in which ch. 8 does statistics.

Key takeaways — chapter 3

  • An admissible space V is an RKHS of vector fields with matrix kernel K; the Gaussian is the standard choice and \sigma sets the scale of coherent motion.
  • Flows of L^2([0, 1], V) velocities are diffeomorphisms; adding a large displacement folds space, composing small ones never does.
  • G_V carries a complete right-invariant distance whose infimum is attained.
  • Optimal velocities are v_t = K m_t with the momentum transported by the flow (EPDiff): the initial momentum determines the geodesic.

4. Landmark matching: Hamiltonian dynamics and geodesic shooting

The simplest objects that G_V deforms are n-tuples of points, the landmarks that an anatomist places on recognizable features. Matching two sets of labelled landmarks (Joshi and Miller, 2000) reduces the infinite-dimensional problem of ch. 3 to a Hamiltonian system in \mathbb{R}^{2nd}, which can be solved exactly and fast. The curve, surface and point-cloud methods of ch. 5 reuse this reduction unchanged.

From diffeomorphisms to a finite-dimensional problem

Definition 4.1 — Landmark space and exact matching The space of n distinct landmarks in \mathbb{R}^d is the open set Q_n = \{ q = (q_1, \dots, q_n) \in (\mathbb{R}^d)^n : q_i \neq q_j \text{ for } i \neq j \}.

G_V acts by \varphi \cdot q = (\varphi(q_1), \dots, \varphi(q_n)), with infinitesimal action v \cdot q = (v(q_1), \dots, v(q_n)).

Given a template x \in Q_n and a target y \in Q_n, exact matching minimizes \int_0^1 \|v_t\|_V^2\, dt subject to \varphi_1^v(x_i) = y_i for all i.

Theorem 4.2 — Reduction to the landmark trajectories Assume that the kernel of V has invertible Gram matrices at distinct points, as the Gaussian kernel does (ch. 0). Let v be optimal and q_i(t) = \varphi_t(x_i). Write K(q) for the nd \times nd block matrix with blocks K(q_i, q_j).

For almost every t there are momenta p_i(t) \in \mathbb{R}^d such that v_t(x) = \sum_{j=1}^n K(x, q_j(t))\, p_j(t), \qquad \|v_t\|_V^2 = p^\top K(q)\, p = \dot q^\top K(q)^{-1} \dot q .

Proof. Fix the trajectories q(t). Any field w_t \in V with w_t(q_j(t)) = \dot q_j(t) for every j produces the same trajectories, by uniqueness of the solutions of \dot z = w_t(z).

At each time, the minimal-norm such field is given by Proposition 0.10, in its vector form (Proposition 3.2): w_t = \sum_j K(\cdot, q_j) p_j with K(q)\, p = \dot q. The matrix K(q) is invertible by assumption, because the points stay distinct (Theorem 3.3).

If v_t differed from this field on a set of times of positive measure, replacing it would strictly lower the energy without changing the endpoint. ∎

Landmark matching is therefore a geodesic problem on the finite-dimensional manifold Q_n, with metric G(q) = K(q)^{-1}. This is exactly the projected metric of Theorem 2.8, with A_q v = v \cdot q and A_q^* p = \sum_j K(\cdot, q_j) p_j.

Theorem 4.3 — Hamiltonian equations for landmarks Optimal trajectories solve Hamilton’s equations for H(q, p) = \frac12 \sum_{i,j} p_i^\top K(q_i, q_j)\, p_j , namely \dot q_i = \sum_j K(q_i, q_j)\, p_j = v_t(q_i) and \dot p_i = -\nabla_{q_i} H. For the scalar Gaussian kernel, \dot p_i = \frac{2}{\sigma^2} \sum_j k(q_i, q_j)\, (p_i \cdot p_j)\, (q_i - q_j) .

Proof. This is Theorem 1.4 with the cometric K(q). For the formula, \nabla_x k(x, y) = -\tfrac{2}{\sigma^2} (x - y)\, k(x, y). The variable q_i appears in row i and in column i of the double sum, which cancels the factor \tfrac12. ∎

Proposition 4.4 — Conservation laws Along a solution:

  1. H is constant and equal to \tfrac12 \|v_t\|_V^2, so the length of the geodesic is (p_0^\top K(q_0)\, p_0)^{1/2}.
  2. \dot p_i = -D v_t(q_i)^\top p_i, hence p_i(t) = D\varphi_t(x_i)^{-\top} p_i(0): this is the momentum transport of Theorem 3.8.
  3. Two distinct landmarks never collide, since q_i(t) = \varphi_t(x_i) and \varphi_t is injective.

Proof.

  1. is Proposition 0.5. For (2), differentiate v_t(z) = \sum_j k(z, q_j) p_j at z = q_i: D v_t(q_i)^\top p_i = \sum_j \nabla_1 k(q_i, q_j)\, (p_j \cdot p_i) = \nabla_{q_i} H .

The function P(t) = D\varphi_t(x_i)^{-\top} p_i(0) satisfies the same linear equation, because D\varphi_t solves the linear equation of Proposition 0.7. (3) is Theorem 3.3. ∎

Geodesic shooting and the exponential map

Given an initial momentum p_0, integrating Theorem 4.3 on [0, 1] is geodesic shooting. It computes the exponential map q(1) = \exp_{q_0}\big( K(q_0)\, p_0 \big).

By Proposition 1.6, p_0 \mapsto q(1) is a local diffeomorphism near 0, with differential K(q_0): the momentum is a linear chart of landmark space around the template. Every other point z of the ambient space is carried along by \dot z = \sum_j K(z, q_j)\, p_j. This is the dense matching from landmarks of the syllabus.

For large momenta the chart can fail: the differential of the shooting map may become singular (conjugate points). Landmark space has sectional curvature of both signs (Micheli, Michor and Mumford, 2012), so no global chart should be expected.

Example 4.5 — Tearing two landmarks apart Two landmarks lie at distance r; the first must move with velocity u while the second stays still. With \kappa = k(q_1, q_2), solving K(q)\, p = (u, 0) gives p = (u, -\kappa u) / (1 - \kappa^2), and the cost is \|v\|_V^2 = p \cdot \dot q = \frac{|u|^2}{1 - \kappa^2}.

Distance r \kappa = e^{-r^2/\sigma^2} Cost factor 1 / (1 - \kappa^2)
\sigma 0.368 1.156
\sigma / 2 0.779 2.541
\sigma / 4 0.939 8.510

Below the scale \sigma, separating two points becomes very expensive: the kernel width is the resolution of the deformation model.

Inexact matching

Measured landmarks are noisy, and exact matching would follow the noise. Inexact matching trades the deformation cost against the residual. Since optimal paths are geodesics, it suffices to optimize over the initial momentum: J(p_0) = H(q_0, p_0) + \frac{1}{2\lambda^2}\, |q(1) - y|^2, \qquad q(1) = \exp_{q_0}\big( K(q_0)\, p_0 \big).

Proposition 4.6 — Endpoint condition At a minimizer of J, the final momentum is minus the gradient of the data term: p(1) = -\frac{1}{\lambda^2}\, \big( q(1) - y \big) .

Proof. Over all paths starting at q_0, minimize \int_0^1 \tfrac12\, \dot q^\top K(q)^{-1} \dot q\, dt + g(q(1)), \qquad g(z) = \frac{|z - y|^2}{2\lambda^2} .

By Theorem 0.3 the optimal path is a geodesic and satisfies the endpoint condition \partial_{\dot q} L(1) + \nabla g(q(1)) = 0. Here \partial_{\dot q} L = K(q)^{-1} \dot q = p. ∎

The gradient of J with respect to p_0 is obtained by integrating the linearized Hamiltonian system backwards in time from this endpoint condition (the adjoint method). Reverse-mode automatic differentiation through the integrator computes the same quantity, and is what the next code uses.

Code 4.7 — Matching a circle to a three-lobed shape Twenty landmarks on a circle are matched to labelled landmarks on a shifted three-lobed curve. Shooting uses the midpoint rule with 20 steps, and L-BFGS optimizes p_0. A grid of points is carried by the final flow to measure its Jacobian.

import math
import torch

torch.set_default_dtype(torch.float64)
torch.set_num_threads(1)
sigma, lam, steps = 0.25, 0.1, 20            # kernel width, data noise level, time steps

def kmat(x, y):
    return torch.exp(-((x[:, None, :] - y[None, :, :]) ** 2).sum(-1) / sigma ** 2)

def hamiltonian(q, p):
    return 0.5 * ((p @ p.T) * kmat(q, q)).sum()

def field(q, p):
    """Right-hand side of Hamilton's equations for the Gaussian kernel (Theorem 4.3)."""
    K = kmat(q, q)
    dq = K @ p
    w = K * (p @ p.T) * (2 / sigma ** 2)                 # w_ij = (2/sigma^2) k_ij <p_i, p_j>
    dp = w.sum(1, keepdim=True) * q - w @ q              # sum_j w_ij (q_i - q_j)
    return dq, dp

def shoot(q, p, extra=None):
    """Geodesic shooting with the midpoint rule; extra points are carried by the flow."""
    dt = 1.0 / steps
    for _ in range(steps):
        dq, dp = field(q, p)
        qm, pm = q + 0.5 * dt * dq, p + 0.5 * dt * dp
        if extra is not None:
            em = extra + 0.5 * dt * kmat(extra, q) @ p
            extra = extra + dt * kmat(em, qm) @ pm
        dq, dp = field(qm, pm)
        q, p = q + dt * dq, p + dt * dp
    return q, p, extra

n = 20
th = torch.linspace(0, 2 * math.pi, n + 1)[:-1]
q0 = 0.5 * torch.stack([th.cos(), th.sin()], 1)                       # template: a circle
r = 0.5 + 0.15 * torch.cos(3 * th)
y = torch.stack([r * th.cos(), r * th.sin()], 1) + torch.tensor([0.1, 0.0])   # labelled target

p0 = torch.zeros_like(q0, requires_grad=True)
opt = torch.optim.LBFGS([p0], max_iter=100, tolerance_grad=1e-10, line_search_fn="strong_wolfe")
def closure():
    opt.zero_grad()
    q1, _, _ = shoot(q0, p0)
    J = hamiltonian(q0, p0) + ((q1 - y) ** 2).sum() / (2 * lam ** 2)   # inexact matching
    J.backward()
    return J
opt.step(closure)

with torch.no_grad():
    g = torch.linspace(-1, 1, 41)
    grid = torch.stack(torch.meshgrid(g, g, indexing="ij"), -1).reshape(-1, 2)
    q1, p1, phi = shoot(q0, p0, grid)
    H0, H1 = hamiltonian(q0, p0).item(), hamiltonian(q1, p1).item()
    phi, h = phi.reshape(41, 41, 2), (g[1] - g[0]).item()
    dx = (phi[2:, 1:-1] - phi[:-2, 1:-1]) / (2 * h)
    dy = (phi[1:-1, 2:] - phi[1:-1, :-2]) / (2 * h)
    det = dx[..., 0] * dy[..., 1] - dx[..., 1] * dy[..., 0]
    res = q1 - y
    print(f"RMS landmark gap: {((q0 - y) ** 2).sum(1).mean().sqrt():.4f} -> {(res ** 2).sum(1).mean().sqrt():.4f}")
    print(f"geodesic length sqrt(2H) = {math.sqrt(2 * H0):.4f}; relative drift of H = {abs(H1 - H0) / H0:.1e}")
    K1 = kmat(q1, q1)                                  # endpoint condition, read on velocities
    print(f"endpoint condition: |K(p(1) + (q(1) - y)/lam^2)| / |K p(1)| = {(K1 @ (p1 + res / lam ** 2)).norm() / (K1 @ p1).norm():.1e}")
    print(f"Jacobian determinant of phi_1 on the grid: min {det.min():.3f}, max {det.max():.3f}")
Quantity Value
RMS landmark gap, before → after 0.1458 → 0.0011
geodesic length \sqrt{2H} 0.4782
relative drift of H along the integration 5.6 \times 10^{-6}
endpoint condition (Proposition 4.6), relative error 3.7 \times 10^{-4}
Jacobian of \varphi_1 on the grid from 0.388 to 2.404

The fit is close, H is conserved up to the integration error, and Proposition 4.6 holds at the optimum. The grid is compressed between the lobes and expanded inside them, but never folded.

The endpoint condition is checked on velocities, K(q_1)\, p(1), rather than on momenta. The Gram matrix of nearby landmarks is badly conditioned, and momentum components along its small eigenvectors move nothing; the optimizer leaves them unresolved.

Two parameters must be chosen with care. The noise level \lambda is a distance, in the units of the landmarks. The width \sigma is the scale of coherent motion (Example 4.5); anatomical data often call for a sum of Gaussians of several widths (Risser, Vialard, Wolz, Murgasova, Holm and Rueckert, 2011).

Key takeaways — chapter 4

  • Optimal velocities for landmarks are kernel combinations v_t = \sum_j K(\cdot, q_j) p_j: the problem reduces to 2nd variables.
  • Landmark matching is a geodesic problem for the cometric K(q), solved by Hamilton’s equations with H = \tfrac12 p^\top K(q) p.
  • Geodesic shooting computes the exponential map; the initial momentum is a linear chart around the template, and the whole space follows the landmarks.
  • Inexact matching optimizes p_0; at the optimum, p(1) is minus the gradient of the data term.

5. Matching without correspondences: measures, currents and varifolds

Landmarks require point-to-point correspondences. Point clouds, curves and surfaces extracted from scans have different numbers of points and no labels. The remedy is to embed every object in a Hilbert space where a deformed template and a target can be compared directly. The Hamiltonian machinery of ch. 4 is then reused, with only the data term changed.

Point clouds as measures

Definition 5.1 — Kernel norm on measures Let W be a scalar RKHS on \mathbb{R}^d with kernel k_W (a Gaussian of width \tau), continuously embedded in the continuous functions vanishing at infinity.

A finite measure \mu = \sum_i a_i \delta_{x_i} defines the continuous linear form f \mapsto \sum_i a_i f(x_i) on W. Its dual norm is \|\mu\|_{W^*}^2 = \sum_{i,j} a_i a_j\, k_W(x_i, x_j).

For two clouds \mu = \sum_i a_i \delta_{x_i} and \nu = \sum_j b_j \delta_{y_j}, expanding the square gives \|\mu - \nu\|_{W^*}^2 = \sum_{i,i'} a_i a_{i'} k_W(x_i, x_{i'}) - 2 \sum_{i,j} a_i b_j\, k_W(x_i, y_j) + \sum_{j,j'} b_j b_{j'} k_W(y_j, y_{j'}) .

Proposition 5.2 — Properties of the kernel distance

  1. The representer of \mu in W is f_\mu = \sum_i a_i k_W(\cdot, x_i), and \|\mu\|_{W^*} = \|f_\mu\|_W.
  2. For the Gaussian kernel, \|\mu\|_{W^*} > 0 for every non-zero finite signed measure, so \|\mu - \nu\|_{W^*} is a distance between measures.
  3. A deformation acts by push-forward, \varphi_* \mu = \sum_i a_i \delta_{\varphi(x_i)}, and \|\varphi_* \mu - \nu\|_{W^*}^2 is a smooth function of the moved points.

Proof.

  1. By the reproducing property, \langle f_\mu, f \rangle_W = \sum_i a_i f(x_i); the norm of a form is the norm of its representer (Theorem 0.8).

  2. By Bochner’s theorem, up to a constant, \|\mu\|_{W^*}^2 = \int |\hat\mu(\omega)|^2\, \hat k_W(\omega)\, d\omega . The Fourier transform of the Gaussian is positive everywhere, and \hat\mu is not identically zero when \mu \neq 0.

  3. The expression is a finite sum of Gaussians of the moved points. ∎

This data term was introduced for unlabelled point sets by Glaunès, Trouvé and Younes (2004). In machine learning the same quantity is the maximum mean discrepancy between two samples.

Matching a template cloud \mu to a target \nu then minimizes J(p_0) = H(q_0, p_0) + \frac{1}{2\lambda^2}\, \| \varphi_* \mu - \nu \|_{W^*}^2 , where q_0 are the points of \mu. Shooting is that of ch. 4; only the gradient of the endpoint term changes. This is the dense matching from point clouds of the syllabus.

The weights a_i matter. With a_i = 1/n the measure is a probability, and two samplings of the same shape at different densities are close. With a_i = 1, a denser cloud has more mass and the distance sees it.

Curves and surfaces as currents

A measure forgets the geometry of a curve: it sees the points, not the tangents. A curve is better described by how vector fields flow through it.

Definition 5.3 — Current of a curve or a surface Let W now be an RKHS of vector fields with kernel k_W(x, y)\, I_d. An oriented curve C defines the linear form [C](\omega) = \int_C \omega(x) \cdot \tau(x)\, ds(x), with \tau the unit tangent; an oriented surface S \subset \mathbb{R}^3 defines the flux [S](\omega) = \int_S \omega(x) \cdot n(x)\, dA(x).

A polygon with vertices x_1, \dots, x_n is discretized segment by segment: segment i has centre c_i = (x_i + x_{i+1})/2 and vector t_i = x_{i+1} - x_i, and [C] \approx \sum_i \delta_{c_i}^{t_i}, the form \omega \mapsto \sum_i \omega(c_i) \cdot t_i.

For a triangulated surface, face f has centre c_f and area-weighted normal n_f = \tfrac12 (x_2 - x_1) \times (x_3 - x_1).

Proposition 5.4 — Kernel norm of currents For a discrete current, \Big\| \sum_i \delta_{c_i}^{t_i} \Big\|_{W^*}^2 = \sum_{i,j} k_W(c_i, c_j)\; t_i \cdot t_j .

The current of a curve does not depend on its parametrization. It is additive under disjoint union, and reversing the orientation changes its sign. Deformations act by \varphi_* [C] = [\varphi(C)]; discretely, one moves the vertices and recomputes the centres and vectors.

Proof. The representer of \sum_i \delta_{c_i}^{t_i} is \sum_i k_W(\cdot, c_i)\, t_i, and its squared norm is the stated double sum, as in Proposition 5.2.

Independence of the parametrization holds because, for any parametrization \gamma of C, \int_C \omega \cdot \tau\, ds = \int_0^1 \omega(\gamma(s)) \cdot \gamma'(s)\, ds , and the right-hand side is invariant under increasing changes of variable. ∎

Currents were introduced in this setting for surfaces by Vaillant and Glaunès (2005), and for curves by Glaunès, Qiu, Miller and Younes (2008). They solve the correspondence problem and are insensitive to the sampling. Their linearity, however, has a price.

Example 5.5 — Cancellation of opposite orientations Take two parallel unit segments at distance r = \tau / 4, each summarized by one Dirac at its centre, so that k_W = e^{-1/16} = 0.939 between them.

With opposite orientations, the squared norm of the pair is 2(1 - k_W) = 0.121. With the same orientation, it is 2(1 + k_W) = 3.879.

A thin fold that goes back and forth almost vanishes as a current. Currents are blind to thin structures, and they require a consistent orientation of the data.

Varifolds: forgetting the orientation

Definition 5.6 — Discrete varifold A varifold represents a curve or a surface as a measure on positions and unoriented directions (Charon and Trouvé, 2013). Segment i of a polygon becomes the mass \ell_i = |t_i| at the point (c_i, \pm u_i), with u_i = t_i / \ell_i. Two discrete varifolds are compared through \langle \mathcal{V}, \mathcal{V}' \rangle = \sum_{i,j} \ell_i\, \ell'_j\; k_W(c_i, c'_j)\; (u_i \cdot u'_j)^2 .

The square makes the kernel indifferent to orientation. For surfaces, u_i is the unit normal of the face and \ell_i its area.

All terms of a varifold norm between nearby, nearly parallel elements are positive: there is no cancellation. In Example 5.5 the pair has the same varifold norm, 2(1 + k_W), whatever the orientations. Varifolds also handle meshes whose orientation is inconsistent or undefined.

Representation Sees Needs orientation Thin folds
measure positions no seen as mass
current positions and oriented tangents yes cancel out
varifold positions and unoriented tangents no seen

Normal cycles add curvature information (Roussillon and Glaunès, 2016), and optimal transport gives another family of data terms (ch. 9).

Code 5.7 — Matching curves without correspondences A circle with 40 vertices is matched to a flattened, two-lobed curve with 64 vertices, starting at another angle: no labels, no common sampling. The data term is the varifold distance with \tau = 0.2.

import math
import torch

torch.set_default_dtype(torch.float64)
torch.set_num_threads(1)
sigma, tau, lam, steps = 0.25, 0.2, 0.05, 20   # deformation kernel, varifold kernel, noise, steps

def kmat(x, y, s):
    return torch.exp(-((x[:, None, :] - y[None, :, :]) ** 2).sum(-1) / s ** 2)

def field(q, p):
    K = kmat(q, q, sigma)
    w = K * (p @ p.T) * (2 / sigma ** 2)
    return K @ p, w.sum(1, keepdim=True) * q - w @ q

def shoot(q, p):
    dt = 1.0 / steps
    for _ in range(steps):
        dq, dp = field(q, p)
        dq2, dp2 = field(q + 0.5 * dt * dq, p + 0.5 * dt * dp)
        q, p = q + dt * dq2, p + dt * dp2
    return q, p

def segments(x):
    """Centres, unit tangents and lengths of the segments of a closed polygon."""
    t = torch.roll(x, -1, 0) - x
    length = t.norm(dim=1, keepdim=True)
    return (x + torch.roll(x, -1, 0)) / 2, t / length, length

def vf_inner(A, B):
    """Varifold inner product (Definition 5.6): sum l_i l_j k(c_i, c_j) <u_i, u_j>^2."""
    (c1, u1, l1), (c2, u2, l2) = A, B
    return ((l1 @ l2.T) * kmat(c1, c2, tau) * (u1 @ u2.T) ** 2).sum()

def vf_dist2(x, y):
    A, B = segments(x), segments(y)
    return vf_inner(A, A) - 2 * vf_inner(A, B) + vf_inner(B, B)

def closed_curve(n, r, shift=0.0):
    th = torch.linspace(0, 2 * math.pi, n + 1)[:-1] + shift
    return torch.stack([r(th) * th.cos(), r(th) * th.sin()], 1)

x0 = closed_curve(40, lambda t: 0.5 + 0 * t)                            # template: circle, 40 points
y = closed_curve(64, lambda t: 0.45 + 0.2 * torch.cos(2 * t), shift=1.0)  # target: 64 points, no labels
y = y * torch.tensor([1.0, 0.6]) + torch.tensor([0.1, 0.05])             # flattened into a peanut-like shape

p0 = torch.zeros_like(x0, requires_grad=True)
opt = torch.optim.LBFGS([p0], max_iter=60, line_search_fn="strong_wolfe")
def closure():
    opt.zero_grad()
    x1, _ = shoot(x0, p0)
    J = 0.5 * ((p0 @ p0.T) * kmat(x0, x0, sigma)).sum() + vf_dist2(x1, y) / (2 * lam ** 2)
    J.backward()
    return J
opt.step(closure)

with torch.no_grad():
    x1, _ = shoot(x0, p0)
    def mean_gap(a, b):                                # symmetric mean distance to the nearest vertex
        D = ((a[:, None] - b[None]) ** 2).sum(-1).sqrt()
        return 0.5 * (D.min(1).values.mean() + D.min(0).values.mean())
    print(f"varifold distance^2: {vf_dist2(x0, y):.4f} -> {vf_dist2(x1, y):.5f}")
    print(f"mean gap to the nearest vertex of the other curve: {mean_gap(x0, y):.4f} -> {mean_gap(x1, y):.4f}")
    print(f"deformation cost sqrt(2H) = {math.sqrt(((p0 @ p0.T) * kmat(x0, x0, sigma)).sum()):.4f}")

The squared varifold distance falls from 1.4390 to 0.00004, for a deformation of length 0.6310.

The mean gap from each vertex to the nearest vertex of the other curve falls from 0.1824 to 0.0156. What remains is mostly the offset between two different samplings: consecutive target vertices are 0.025 to 0.06 apart.

The cost of these data terms is a double sum over the elements of the two shapes. With 10^5 triangles it is computed on a GPU without storing the kernel matrix, with libraries such as KeOps (ch. 9).

Key takeaways — chapter 5

  • Unlabelled objects are compared in the dual of an RKHS: a deformed template and a target become comparable without correspondences.
  • Point clouds are measures; curves and surfaces are currents (oriented, linear, with cancellations) or varifolds (unoriented, no cancellation).
  • All these norms are double kernel sums, smooth in the vertices, so the shooting and optimization of ch. 4 apply unchanged.
  • Kernel widths set the resolution: \sigma for the deformation, \tau for the comparison.

6. Images, binary regions and tensor fields

For grey-level images the object is a function, the group acts by composition, and many velocity fields change nothing at all: those that slide along the level lines. The structure of ch. 2 still applies. It yields the large-deformation image registration algorithm of Beg, Miller, Trouvé and Younes (2005), and explains why its momenta live on the edges of the image.

Actions of diffeomorphisms on fields

Definition 6.1 — Actions on images and fields For \varphi \in G_V and data defined on a domain \Omega \subset \mathbb{R}^d:

  • a grey-level image I is moved as \varphi \cdot I = I \circ \varphi^{-1}, with infinitesimal action v \cdot I = -\nabla I \cdot v;
  • a binary region A is moved as \varphi(A), which is the image action on the indicator, \mathbf{1}_A \circ \varphi^{-1};
  • a density \rho is moved with conservation of mass, as |\det D\varphi^{-1}|\, \rho \circ \varphi^{-1}, with infinitesimal action -\operatorname{div}(\rho v);
  • a vector field w is moved as \varphi \cdot w = (D\varphi\, w) \circ \varphi^{-1};
  • a tensor field \Sigma of SPD matrices is moved as (D\varphi\, \Sigma\, D\varphi^\top) \circ \varphi^{-1}.

Each formula is an action. For images, \varphi \cdot (\psi \cdot I) equals I \circ (\varphi \circ \psi)^{-1}; for vector and tensor fields, the chain rule D(\varphi \circ \psi) = (D\varphi \circ \psi)\, D\psi does the same job.

For diffusion tensor images, the full action also stretches the tensors. Alexander, Pierpaoli, Basser and Gee (2001) proposed instead to apply only the rotation part R = (D\varphi D\varphi^\top)^{-1/2} D\varphi of the Jacobian (finite strain), or to follow the deformed principal direction (preservation of principal direction).

Example 6.2 — Reorienting a tensor under a shear Take \Sigma = \operatorname{diag}(4, 0.25), a fibre along e_1, and the shear D\varphi = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}, which leaves the direction e_1 unchanged.

  • Full action: D\varphi\, \Sigma\, D\varphi^\top has entries 4.25, 0.25, 0.25, 0.25; its principal direction turns by 3.6°.
  • Finite strain: the rotation part of the shear is a rotation by -26.6°, and the tensor turns by -26.6°.
  • Preservation of principal direction: the new direction is D\varphi\, e_1 = e_1, a turn of 0°.

The fibre itself has not turned: the three strategies disagree, and the choice must follow the physics of the data.

Proposition 6.3 — Invisible velocities and normal momentum At an image I, every field v tangent to the level lines of I satisfies v \cdot I = 0. The minimal-norm velocity that produces a given variation \delta I lies in the closure, in V, of the fields v = K(\alpha\, \nabla I) with \alpha a scalar field: the momentum of an image is a scalar field times its gradient.

Proof. The infinitesimal action A_I v = -\nabla I \cdot v maps V to scalar functions. For L^2 functions \alpha, \langle A_I v, \alpha \rangle_{L^2} = -\int \alpha\, \nabla I \cdot v = \langle v, -K(\alpha \nabla I) \rangle_V, so A_I^* \alpha = -K(\alpha \nabla I). As in Theorem 2.8 (1), the minimal-norm solution is orthogonal to \ker A_I. In infinite dimension, the orthogonal of \ker A_I is the closure of the range of A_I^*, which gives the claim. ∎

Momenta of images are thus concentrated where the gradient is large: on the edges. For a binary region, \nabla \mathbf{1}_A = -n\, \sigma_{\partial A}, the outward normal times the surface measure of the boundary. The momentum is then normal to the boundary.

To match a region A to a region B, the natural data term is the area of the symmetric difference: \| \mathbf{1}_{\varphi(A)} - \mathbf{1}_B \|_{L^2}^2 = | \varphi(A) \,\triangle\, B | .

Write A_t = \varphi_t(A), whose boundary moves with velocity v. The area of the symmetric difference can be rewritten as | A_t \,\triangle\, B | = |B| + \int_{A_t} \big( 1 - 2\, \mathbf{1}_B \big)\, dx .

When \partial A_t meets \partial B transversally, the transport formula for a moving domain then gives \frac{d}{dt}\, | A_t \,\triangle\, B | = \int_{\partial A_t} \big( 1 - 2\, \mathbf{1}_B \big)\, (v \cdot n)\, d\sigma .

The L^2-gradient is therefore a normal vector measure carried by the boundary. By Proposition 0.2, the V-gradient is this measure smoothed by K: \nabla_V\, | A_t \,\triangle\, B | = K\big( (1 - 2\, \mathbf{1}_B)\, n\, \sigma_{\partial A_t} \big) .

A descent step pushes the boundary outwards where it lies inside B, and inwards where it lies outside B. Matching regions thus amounts to evolving their boundary curves or surfaces with normal momenta.

Check on a disk A of radius r inside a larger concentric disk B, under the dilation v(x) = x. At t = 0 both sides equal -2\pi r^2.

Large deformation matching of images

Definition 6.4 — LDDMM energy for images Given a template I_0 and a target I_1, minimize over v \in L^2([0, 1], V) E(v) = \frac12 \int_0^1 \|v_t\|_V^2\, dt + \frac{1}{2\lambda^2} \big\| I_0 \circ \varphi_1^{-1} - I_1 \big\|_{L^2}^2 .

Write J^0_t = I_0 \circ \varphi_{t,0} for the template carried to time t, and J^1_t = I_1 \circ \varphi_{t,1} for the target pulled back to time t, with \varphi_{s,t} = \varphi_t \circ \varphi_s^{-1}.

Theorem 6.5 — Gradient of the image matching energy The gradient of E in L^2([0, 1], V) is \nabla E(v)_t = v_t - \frac{1}{\lambda^2}\, K\Big( |\det D\varphi_{t,1}|\, \big( J^0_t - J^1_t \big)\, \nabla J^0_t \Big) .

Proof. Sketch. Perturb v by h near time t, during \delta t. Then \varphi_1 \approx \varphi_{t,1} \circ (\mathrm{id} + \delta t\, h_t) \circ \varphi_t , so the deformed template changes by \delta (I_0 \circ \varphi_1^{-1}) = -\delta t\, (\nabla J^0_t \cdot h_t) \circ \varphi_{1,t} .

The data term therefore changes by -\frac{\delta t}{\lambda^2} \int \big( I_0 \circ \varphi_1^{-1} - I_1 \big)(y)\, \big( \nabla J^0_t \cdot h_t \big)(\varphi_{1,t}(y))\, dy .

Change variables with y = \varphi_{t,1}(x). The Jacobian |\det D\varphi_{t,1}| appears, and the two images become I_0 \circ \varphi_1^{-1} \circ \varphi_{t,1} = J^0_t and I_1 \circ \varphi_{t,1} = J^1_t.

This gives the L^2-gradient. Apply K (Proposition 0.2) and add the gradient v_t of the first term. ∎

At a critical point, v_t = K(P_t\, \nabla J^0_t), with the scalar momentum P_t = \frac{1}{\lambda^2}\, |\det D\varphi_{t,1}|\, \big( J^0_t - J^1_t \big).

As Proposition 6.3 predicts, the momentum is a scalar times the image gradient. It is transported as a density, \partial_t P + \operatorname{div}(P v) = 0, while the image is transported, \partial_t J^0 + \nabla J^0 \cdot v = 0.

The pair (I_0, P_0) therefore determines the whole geodesic: this is geodesic shooting for images (Miller, Trouvé and Younes, 2006). Each subject of a population is then summarized by a scalar image P_0 on the template, the representation used in ch. 8.

Code 6.6 — Matching a disk to a peanut Smoothed binary images of a disk and of two overlapping disks, on a 48 \times 48 grid, are matched with 8 time steps.

The velocities are written v_t = K u_t, with K a Gaussian convolution applied by FFT, so that \|v_t\|_V^2 = \langle u_t, K u_t \rangle. Optimizing over u with an L^2 method is then the V-gradient descent of Proposition 0.2.

The inverse map is built by the semi-Lagrangian rule \varphi_{t + \delta t}^{-1} = \varphi_t^{-1} \circ (\mathrm{id} - \delta t\, v_t), and automatic differentiation provides the gradient of Theorem 6.5.

import math
import torch
import torch.nn.functional as F

torch.set_default_dtype(torch.float64)
torch.set_num_threads(1)
N, T, sig_v, sig_d = 48, 8, 0.15, 0.05       # grid size, time steps, kernel width, data noise
h = 2 / (N - 1)                               # pixel size on [-1, 1]^2
g = torch.linspace(-1, 1, N)
Y, X = torch.meshgrid(g, g, indexing="ij")
ident = torch.stack([X, Y], -1)[None]         # grid_sample convention: (x, y) in [-1, 1]

def soft(sd):                                 # smoothed indicator of {sd < 0}
    return torch.sigmoid(-sd / 0.04)

I0 = soft(torch.sqrt(X ** 2 + Y ** 2) - 0.45)                    # a disk
d1 = torch.sqrt((X - 0.3) ** 2 + Y ** 2) - 0.32
d2 = torch.sqrt((X + 0.3) ** 2 + Y ** 2) - 0.32
I1 = soft(torch.minimum(d1, d2))                                 # a peanut (union of two disks)

f = torch.fft.fftfreq(N, d=h) * 2 * math.pi
Kh = torch.exp(-(f[:, None] ** 2 + f[None, :] ** 2) * sig_v ** 2 / 4)   # Gaussian kernel, Fourier side

def smooth(u):                                # v = K * u, channel by channel
    return torch.fft.ifft2(torch.fft.fft2(u) * Kh).real

def warp(img, grid):                          # img o grid, bilinear
    return F.grid_sample(img[None, None], grid, align_corners=True, padding_mode="border")[0, 0]

def flow_inverse(u):
    """phi_1^{-1} by the semi-Lagrangian rule psi_{t+dt} = psi_t o (id - dt v_t)."""
    psi = ident.clone()
    for t in range(T):
        v = torch.stack([smooth(u[t, 0]), smooth(u[t, 1])], -1)[None]
        disp = (psi - ident).permute(0, 3, 1, 2)
        back = ident - v / T
        psi = back + F.grid_sample(disp, back, align_corners=True, padding_mode="border").permute(0, 2, 3, 1)
    return psi

def energy(u):
    reg = sum((u[t] * torch.stack([smooth(u[t, 0]), smooth(u[t, 1])])).sum() for t in range(T)) * h ** 2 / T
    J = warp(I0, flow_inverse(u))
    return 0.5 * reg + ((J - I1) ** 2).sum() * h ** 2 / (2 * sig_d ** 2)

u = torch.zeros(T, 2, N, N, requires_grad=True)   # momenta: v_t = K u_t
opt = torch.optim.LBFGS([u], max_iter=40, line_search_fn="strong_wolfe")
def closure():
    opt.zero_grad()
    E = energy(u)
    E.backward()
    return E
opt.step(closure)

with torch.no_grad():
    psi = flow_inverse(u)
    J = warp(I0, psi)
    dx = (psi[0, 1:-1, 2:] - psi[0, 1:-1, :-2]) / (2 * h)       # derivative along x (columns)
    dy = (psi[0, 2:, 1:-1] - psi[0, :-2, 1:-1]) / (2 * h)       # derivative along y (rows)
    det = dx[..., 0] * dy[..., 1] - dx[..., 1] * dy[..., 0]
    print(f"relative L2 mismatch: {((I0 - I1).norm() / (I0 - I1).norm()):.3f} -> {((J - I1).norm() / (I0 - I1).norm()):.3f}")
    print(f"Jacobian determinant of phi_1^-1: min {det.min():.3f}, max {det.max():.3f}")

After 40 L-BFGS iterations the relative mismatch falls from 1.000 to 0.045. The Jacobian of \varphi_1^{-1} stays between 0.328 and 10.2: strong local expansion and compression, but no folding.

The largest Jacobian of \varphi_1^{-1}, about 10, sits at the waist of the peanut: the centre of the disk is squeezed there by that factor. The smallest, 0.33, lies inside the lobes, which the disk fills by expansion. The Gaussian convolution by FFT treats the image as periodic, which is harmless here because the shapes stay away from the border.

Tensor fields

For a diffusion tensor image \Sigma_0 and a target \Sigma_1, the data term compares the deformed field with the target, point by point. It can use the Frobenius norm or the affine-invariant distance of Proposition 2.5: \frac{1}{2\lambda^2} \int_\Omega d\big( (\varphi_1 \cdot \Sigma_0)(x),\, \Sigma_1(x) \big)^2\, dx .

The gradient is computed as in Theorem 6.5, with the chain rule through D\varphi_1 in the action. LDDMM for vector fields was developed by Cao, Miller, Winslow and Younes (2005), with an application to cardiac fibre orientation.

Key takeaways — chapter 6

  • Diffeomorphisms act on images by composition, on regions by image, on densities with a Jacobian, on vector and tensor fields with the Jacobian matrix.
  • Velocities along level lines are invisible; image momenta are scalar fields times the image gradient, concentrated on edges.
  • The LDDMM gradient is v_t minus the kernel-smoothed image force of Theorem 6.5; at the optimum, (I_0, P_0) encodes the geodesic.
  • Tensor reorientation is a modelling choice: full action, finite strain and principal direction give different answers.

7. Metamorphoses: deforming and changing intensity

Diffeomorphisms only move what already exists. A template without a lesion can never be deformed into an image that has one, and the matching of ch. 6 then distorts the surrounding anatomy to compensate. Metamorphosis (Miller and Younes, 2001; Trouvé and Younes, 2005) lets the template itself change along the path, at a price. It defines a metric on the whole space of images, not only on the orbit of a template.

Definition and first properties

Definition 7.1 — Metamorphosis of images A metamorphosis is a pair of paths (v_t, I_t), with v_t \in V and I_t \in L^2(\Omega). In this chapter, \sigma > 0 is the weight of intensity changes, and the width of the Gaussian kernel of V is written \sigma_V. The energy of the metamorphosis is E_\sigma(v, I) = \frac12 \int_0^1 \Big( \|v_t\|_V^2 + \frac{1}{\sigma^2}\, \|Z_t\|_{L^2}^2 \Big)\, dt, \qquad Z_t = \partial_t I_t + \nabla I_t \cdot v_t .

The metamorphosis distance d_\sigma(I_0, I_1) is the square root of the infimum of 2 E_\sigma over the paths from I_0 to I_1.

The residual Z is the material derivative: the change of intensity seen by a particle that moves with the deformation. A pure deformation, I_t = I_0 \circ \varphi_t^{-1}, has Z = 0. A pure change of intensity has v = 0 and Z = \partial_t I.

In Riemannian terms, the metric on images is |\delta I|_I^2 = \min_v \Big( \|v\|_V^2 + \frac{1}{\sigma^2}\, \|\delta I + \nabla I \cdot v\|_{L^2}^2 \Big) . It is the projected metric (Theorem 2.8) of the product of the group with the flat space of images.

Proposition 7.2 — The cross-fade bound For any two images, d_\sigma(I_0, I_1) \leq \frac{1}{\sigma}\, \|I_1 - I_0\|_{L^2} .

Proof. Take v = 0 and the straight path I_t = (1 - t) I_0 + t I_1. Then Z_t = I_1 - I_0, and 2 E_\sigma = \sigma^{-2} \|I_1 - I_0\|^2. ∎

Metamorphosis distances are therefore finite between any two images, unlike the LDDMM distance, which is infinite outside the orbit of the template. When \sigma \to \infty, intensity changes cost nothing and the optimal path tends to the cross-fade. When \sigma \to 0, they are forbidden and LDDMM is recovered.

Theorem 7.3 — Existence and geodesic equations For an admissible V whose kernel is regular enough, d_\sigma is a distance on L^2(\Omega) and minimizing metamorphoses exist (Trouvé and Younes, 2005). Smooth minimizers satisfy v_t = -\frac{1}{\sigma^2}\, K\big( Z_t\, \nabla I_t \big), \qquad \partial_t Z_t + \operatorname{div}(Z_t\, v_t) = 0 .

The first equation is the optimality in v at fixed I. At time t the energy is a quadratic function of v, whose V-gradient is 2v + 2\sigma^{-2} K(Z \nabla I). The momentum is again a scalar times the image gradient (Proposition 6.3).

The second equation comes from the variations of I and says that the residual is transported as a density. Holm, Trouvé and Younes (2009) derived both equations from a general Euler–Poincaré theory of metamorphosis.

Landmark metamorphosis

For landmarks, metamorphosis lets each point drift with respect to the flow. The points obey \dot q_i = v_t(q_i) + \zeta_i, and the energy is \frac12 \int_0^1 \Big( \|v_t\|_V^2 + \frac{1}{\sigma^2}\, |\zeta|^2 \Big)\, dt .

Proposition 7.4 — Landmark metamorphosis is a geodesic problem Landmark metamorphosis is the geodesic problem of the cometric K(q) + \sigma^2 I: H_\sigma(q, p) = \frac12\, p^\top \big( K(q) + \sigma^2 I \big)\, p .

Proof. Fix the velocity \dot q and minimize \|v\|_V^2 + \sigma^{-2} |\zeta|^2 under the constraint v(q) + \zeta = \dot q.

For a fixed \zeta, Theorem 4.2 gives the minimal cost (\dot q - \zeta)^\top K^{-1} (\dot q - \zeta). Setting its gradient in \zeta to zero gives K^{-1}(\dot q - \zeta) = \zeta / \sigma^2. Call this vector p.

Then \dot q = K p + \sigma^2 p = (K + \sigma^2 I)\, p, and the minimal cost is p^\top K p + \sigma^2 |p|^2 = \dot q^\top (K + \sigma^2 I)^{-1} \dot q . ∎

The new cometric is invertible even when two landmarks coincide, so landmarks may now merge, and the space is completed. The shooting code of ch. 4 applies unchanged once \sigma^2 is added to the diagonal of the kernel matrix.

Example 7.5 — Tearing becomes affordable In Example 4.5, two landmarks at distance \sigma_V / 4 had a cost factor of 8.51 for moving one of them alone.

With metamorphosis and \sigma^2 = 0.5, the cometric is \begin{pmatrix} 1.5 & \kappa \\ \kappa & 1.5 \end{pmatrix} with \kappa = 0.939. The factor becomes \frac{1.5}{1.5^2 - \kappa^2} = 1.097 .

A single landmark moved by u costs |u|^2 / (1 + \sigma^2): part of the motion is paid as drift.

A discrete metamorphosis of signals

A path of images I_0, I_1, \dots, I_T with velocities v_0, \dots, v_{T-1} is discretized with a time step \delta t = 1/T. The residual uses the semi-Lagrangian transport of ch. 6: Z_t = \frac{I_{t+1} - I_t \circ (\mathrm{id} - \delta t\, v_t)}{\delta t} .

The intermediate images and the velocities are optimized together. This is the automatic metamorphosis between images of the syllabus.

Code 7.6 — A bump that moves while another appears In one dimension, the template has a single bump at 0.40. The target has the same bump at 0.52 and a new, smaller bump at 0.85, which no diffeomorphism can create. Three values of \sigma are compared, each starting from the cross-fade.

import torch

torch.set_default_dtype(torch.float64)
torch.set_num_threads(1)
N, T, s_v = 128, 10, 0.08                     # samples, time steps, kernel width
x = torch.linspace(0, 1, N)
h, dt = 1 / (N - 1), 1 / T
K = torch.exp(-(x[:, None] - x[None, :]) ** 2 / s_v ** 2) * h   # v = K u (discrete kernel operator)

def bump(c, a=1.0, w=0.05):
    return a * torch.exp(-(x - c) ** 2 / (2 * w ** 2))

I0 = bump(0.4, w=0.06)                        # source: one bump
I1 = bump(0.52, w=0.06) + bump(0.85, 0.5, w=0.04)   # target: it has moved, a new one appeared

def resample(I, s):
    """Linear interpolation of the samples I at the positions s (clamped to [0, 1])."""
    s = s.clamp(0, 1) / h
    i = s.floor().clamp(max=N - 2).long()
    w = s - i
    return I[i] * (1 - w) + I[i + 1] * w

def costs(u, mid, sigma):
    """Discrete metamorphosis (Definition 7.1): deformation and intensity parts of the energy."""
    imgs = [I0] + list(mid) + [I1]
    e_def = e_int = 0.0
    for t in range(T):
        v = K @ u[t]
        Z = (imgs[t + 1] - resample(imgs[t], x - dt * v)) / dt   # residual intensity change
        e_def = e_def + 0.5 * dt * h * (u[t] @ v)
        e_int = e_int + 0.5 * dt * (Z ** 2).sum() * h / sigma ** 2
    return e_def, e_int, imgs

for sigma in (0.05, 0.5, 5.0):
    u = torch.zeros(T, N, requires_grad=True)
    mid = torch.stack([(1 - k * dt) * I0 + k * dt * I1 for k in range(1, T)]).requires_grad_(True)
    opt = torch.optim.LBFGS([u, mid], max_iter=300, line_search_fn="strong_wolfe")
    def closure():
        opt.zero_grad()
        e_def, e_int, _ = costs(u, mid, sigma)
        (e_def + e_int).backward()
        return e_def + e_int
    opt.step(closure)
    with torch.no_grad():
        e_def, e_int, imgs = costs(u, mid, sigma)
        track = " ".join(f"{x[im[:90].argmax()]:.2f}/{im[:90].max():.2f}" for im in imgs[::2])
        print(f"sigma = {sigma:4}: deformation {e_def:.3f}, intensity {e_int:.3f} | "
              f"main bump (position/height) at t = 0, 0.2, ..., 1: {track}")
\sigma Deformation energy Intensity energy Main bump at t = 0.4 and 0.6 (position / height)
0.05 0.045 0.652 0.44 / 1.00 and 0.46 / 1.00
0.5 0.023 0.014 0.45 / 1.00 and 0.47 / 1.00
5 0.000 0.003 0.43 / 0.70 and 0.50 / 0.70

For \sigma = 0.05 and 0.5, the main bump travels at full height: it is transported. The new bump is created by intensity change, which dominates the cost when \sigma is small. For \sigma = 5, the path is a cross-fade: the old bump fades out while the new one fades in, and the height drops to 0.70 at times 0.4 and 0.6.

The problem is not convex. When the two positions of a feature do not overlap at all, the cross-fade initialization gives no gradient towards transport, and the optimizer stays at the cross-fade. Coarse-to-fine schemes, which start with a wide kernel and smoothed images, are the standard remedy.

Key takeaways — chapter 7

  • Metamorphosis adds an intensity residual Z = \partial_t I + \nabla I \cdot v to the deformation, weighted by 1/\sigma^2; it gives a finite distance between any two images.
  • Optimal paths satisfy v = -\sigma^{-2} K(Z \nabla I), with Z transported as a density.
  • For landmarks, metamorphosis is geodesic shooting with the cometric K(q) + \sigma^2 I.
  • \sigma interpolates between pure deformation (\sigma \to 0) and cross-fading (\sigma \to \infty).

8. Statistics on shape spaces and anatomical variability

Computational anatomy asks how an organ varies across a population, and how a disease changes it. The constructions of ch. 1–7 provide the ingredients: a mean shape, or template; linear coordinates around it, given by the initial momenta of the exponential map; and probability models on these coordinates. This chapter assembles them into the probabilistic shape models announced by the syllabus.

Fréchet means

Definition 8.1 — Fréchet mean Let x_1, \dots, x_N be points of a metric space (M, d). A Fréchet mean is a global minimizer of F(x) = \frac{1}{2N} \sum_{i=1}^N d(x, x_i)^2 , and a Karcher mean is a local minimizer. In a Euclidean space, both are the arithmetic mean.

Proposition 8.2 — Gradient of the Fréchet function On a Riemannian manifold, at a point x such that no x_i lies in the cut locus of x, \nabla F(x) = -\frac{1}{N} \sum_{i=1}^N \log_x(x_i) .

A Karcher mean therefore satisfies \sum_i \log_x(x_i) = 0, and the fixed-point iteration x \leftarrow \exp_x\Big( \frac1N \sum_i \log_x(x_i) \Big) is a gradient descent with unit step.

Proof. Sketch. Near x, the function z \mapsto \tfrac12 d(z, y)^2 is smooth when y is not in the cut locus of x, and its gradient is -\log_z(y).

Indeed, by the Gauss lemma, the gradient of the distance to y is the unit vector pointing away from y along the geodesic. Average over the data points.

In a Euclidean space, \log_x(y) = y - x, and the iteration reaches the arithmetic mean in one step. ∎

The Karcher mean is unique when the data lie in a geodesic ball that is small enough with respect to the curvature (Karcher, 1977; Afsari, 2011). In Kendall’s space this holds for populations whose shapes are not too different. In landmark spaces with curvature of both signs, uniqueness can fail for spread-out data (ch. 9).

Coordinates around the template

Definition 8.3 — Tangent representation and tangent PCA Given a template \bar q and subjects y_1, \dots, y_N, represent subject i by a vector of the single linear space T_{\bar q} M:

  • the logarithm \log_{\bar q}(y_i), in a finite-dimensional shape space such as Kendall’s;
  • the initial momentum p_0^i of the geodesic from \bar q to y_i, for LDDMM (Vaillant, Miller, Younes and Trouvé, 2004).

Tangent PCA is the principal component analysis of these vectors. For momenta, the natural inner product is \langle p, p' \rangle = p^\top K(\bar q)\, p', the V-inner product of the velocity fields they generate.

A principal mode w_k with variance \lambda_k is displayed by shooting from the template with \pm 2 \sqrt{\lambda_k}\, w_k. Principal geodesic analysis (Fletcher, Lu, Pizer and Joshi, 2004) replaces the linear subspaces of the tangent space by geodesic submanifolds; tangent PCA is its first-order approximation.

Code 8.4 — A synthetic population: generation, mean and modes Forty outlines of 24 landmarks are generated from an elongated template by LDDMM geodesic shooting (ch. 4). Their initial velocities combine a stretching mode and a bending mode with random weights, and observation noise is added.

The population is then analysed without knowing how it was made: Fréchet mean in Kendall’s space (ch. 1), then tangent PCA.

import math
import numpy as np
import torch

torch.set_default_dtype(torch.float64)
torch.set_num_threads(1)
sigma, steps, k, n_subj = 0.4, 20, 24, 40
rng = np.random.default_rng(0)

def kmat(x, y):
    return torch.exp(-((x[:, None, :] - y[None, :, :]) ** 2).sum(-1) / sigma ** 2)

def shoot(q, p):                                       # Hamiltonian geodesic shooting (ch. 4)
    dt = 1.0 / steps
    def field(q, p):
        K = kmat(q, q)
        w = K * (p @ p.T) * (2 / sigma ** 2)
        return K @ p, w.sum(1, keepdim=True) * q - w @ q
    for _ in range(steps):
        dq, dp = field(q, p)
        dq, dp = field(q + 0.5 * dt * dq, p + 0.5 * dt * dp)
        q, p = q + dt * dq, p + dt * dp
    return q

th = torch.linspace(0, 2 * math.pi, k + 1)[:-1]
q0 = torch.stack([0.6 * th.cos(), 0.25 * th.sin()], 1)          # template: an elongated outline
K0 = kmat(q0, q0)
mode1 = torch.stack([q0[:, 0], -q0[:, 1]], 1)                   # stretch along x, squeeze along y
mode2 = torch.stack([0 * q0[:, 0], q0[:, 0] ** 2 - 0.12], 1)    # bend: the ends go up
subjects, weights = [], []
for _ in range(n_subj):                                         # random initial velocities -> momenta
    a, b = rng.normal(0, 0.4), rng.normal(0, 0.25)
    weights.append((a, b))                                      # hidden from the analysis below
    p = torch.linalg.solve(K0, a * mode1 + b * mode2)          # p0 = K(q0)^{-1} u0
    subjects.append(shoot(q0, p).numpy() + 0.005 * rng.normal(size=(k, 2)))   # + observation noise

def pre(X):                                           # Kendall preshape, complex form (ch. 1)
    z = X[:, 0] + 1j * X[:, 1]
    z = z - z.mean()
    return z / np.linalg.norm(z)

def align(w, z):                                      # rotate w optimally onto z
    c = np.vdot(w, z)
    return w * c / abs(c)

def log_map(z, w):                                    # Riemannian log on the preshape sphere
    w = align(w, z)
    c = np.real(np.vdot(z, w))
    v = w - c * z
    nv = np.linalg.norm(v)
    return np.arccos(min(1.0, c)) * v / nv if nv > 1e-12 else 0 * z

def exp_map(z, v):
    t = np.linalg.norm(v)
    return np.cos(t) * z + np.sin(t) * v / t if t > 0 else z

Z = [pre(X) for X in subjects]
mu = Z[0]
for it in range(10):                                  # Fréchet mean by gradient descent (Prop. 8.2)
    step = np.mean([log_map(mu, w) for w in Z], axis=0)
    mu = exp_map(mu, step)
print(f"Frechet mean: norm of the mean log after 10 steps = {np.linalg.norm(step):.1e}")
print(f"distance from the Frechet mean to the template = {np.arccos(min(1, abs(np.vdot(mu, pre(q0.numpy()))))):.4f}")
V = np.array([log_map(mu, w) for w in Z])
V = np.c_[V.real, V.imag]                             # tangent vectors as real vectors
U, s, _ = np.linalg.svd(V - V.mean(0), full_matrices=False)
print("tangent PCA, share of variance of the first 4 modes:", np.round(s[:4] ** 2 / (s ** 2).sum(), 3))
scores = U[:, :2] * s[:2]                             # coordinates of the subjects on modes 1 and 2
corr = np.corrcoef(np.c_[scores, np.array(weights)].T)[:2, 2:]
print("|correlation| of modes 1, 2 with the hidden stretch, bend weights:", np.round(np.abs(np.diag(corr)), 3))

The Fréchet iteration converges in a few steps: the mean logarithm has norm 6.5 \times 10^{-13} after 10 steps. The mean lies at Kendall distance 0.0242 from the true template, a gap due to the nonlinearity of shooting and to the finite sample.

Tangent PCA finds two dominant modes, with 93.2\,\% and 6.0\,\% of the variance, then 0.4\,\% and 0.1\,\%.

The two generating mechanisms are recovered: the coordinates of the subjects on the first two modes correlate at 0.965 and 0.962, in absolute value, with the hidden stretching and bending weights. The ratio of the variances reflects the larger amplitude of the stretching mode.

Probabilistic deformable templates

Definition 8.5 — Generative deformable template A population of landmark sets is modelled as y_i = \exp_{\bar q}\big( K(\bar q)\, p_i \big) + \varepsilon_i, \qquad p_i \sim \mathcal{N}(0, \Gamma), \qquad \varepsilon_i \sim \mathcal{N}(0, \lambda^2 I), independently for i = 1, \dots, N. The unknowns are the template \bar q, the covariance \Gamma of the momenta and the noise level \lambda.

For images, y_i = I_0 \circ (\varphi^{p_i}_1)^{-1} plus noise, with \varphi^{p_i} the geodesic flow shot from the momentum p_i.

Proposition 8.6 — The “white” prior and the atlas criterion If \Gamma = K(\bar q)^{-1}, the initial velocities u_i = K(\bar q)\, p_i of the landmarks satisfy u_i \sim \mathcal{N}(0, K(\bar q)), and p_i^\top K(\bar q)\, p_i follows a \chi^2 law with nd degrees of freedom.

With this prior, the negative log-posterior of (\bar q, p_1, \dots, p_N) is, up to constants, \sum_{i=1}^N \Big[ H(\bar q, p_i) + \frac{1}{2\lambda^2}\, \big| \exp_{\bar q}\big( K(\bar q)\, p_i \big) - y_i \big|^2 \Big] .

Proof. The covariance of u_i is K \Gamma K = K. Next, p_i^\top K p_i = |K^{1/2} p_i|^2 and K^{1/2} p_i \sim \mathcal{N}(0, I).

For the criterion, the Gaussian prior contributes \tfrac12 p_i^\top K p_i = H(\bar q, p_i) and the noise contributes the squared residual. The normalizing constant \det \Gamma depends on \bar q, and is neglected in the atlas criterion. ∎

Under this prior, the initial velocities of the landmarks are the values at \bar q of a Gaussian random field with covariance kernel K. The whole field v_0 is the minimal-norm interpolant of these values (Proposition 0.10), that is, the conditional mean of that random field given its values at the landmarks. Minimizing the criterion alternately in the momenta (one inexact matching per subject, ch. 4) and in the template is the joint registration and template estimation of Joshi, Davis, Jomier and Gerig (2004).

Maximizing over the hidden momenta, instead of integrating them out, has a cost: the estimated template need not converge to the true one when the noise is not negligible. Allassonnière, Amit and Trouvé (2007) treat the deformations as random effects and estimate the template and the covariance by maximum likelihood, with consistency results. Allassonnière, Kuhn and Trouvé (2010) compute the estimate with a stochastic approximation EM algorithm.

Illustrations in medical imaging

These tools are used to analyse anatomical variability. Some representative studies follow.

The Medical Image Analysis course of semester 1 places these models among the other generative, geometric and biophysical approaches to medical images.

Key takeaways — chapter 8

  • A Fréchet mean satisfies \sum_i \log_x(x_i) = 0 and is computed by a fixed-point iteration of exponentials and logarithms.
  • Subjects are represented by tangent vectors at the template (logarithms or initial momenta); PCA in that space gives the modes of variation, read through the V-inner product.
  • Generative deformable templates draw random initial momenta, shoot and add noise; the white prior \Gamma = K^{-1} turns the posterior into the atlas criterion.
  • Estimating the template by maximizing over hidden deformations can be biased; random-effect models and stochastic EM give consistent estimates.

9. Research directions and open problems

This chapter is for self-study. It surveys active questions that extend the course, with entry points into the literature. Each section ends with problems that are still open or only partly solved.

Metrics directly on spaces of curves and surfaces

The course built metrics on curves from outside, through the deformations of the ambient space. One can also put a metric directly on parametrized curves, then quotient by reparametrizations. The simplest choice, the L^2 metric on velocities of curves, fails dramatically.

Michor and Mumford (2005, 2006) showed that the geodesic distance it induces on the space of unparametrized curves is identically zero: any two curves can be joined by paths of arbitrarily small length, which zigzag at high frequency. Sobolev metrics, which also penalize derivatives of the deformation along the curve, restore a positive distance.

A special first-order Sobolev metric, the elastic metric, becomes flat or spherical after a change of variables. Younes (1998) gave such a transform for plane curves. Srivastava, Klassen, Joshi and Jermyn (2011) introduced the square-root velocity transform, q = \dot c / \sqrt{|\dot c|}, under which the elastic metric becomes the L^2 metric.

Bauer, Bruveris and Michor (2014) survey these geometries and those of diffeomorphism groups. Open questions include the completeness of higher-order metrics on surfaces, the existence of optimal reparametrizations, and fast numerics for surfaces.

Curvature and the statistics of shapes

Micheli, Michor and Mumford (2012) computed the sectional curvature of landmark spaces with a kernel metric, through a formula in terms of the cometric. The curvature takes both signs. Positive curvature makes geodesics converge and Fréchet means non-unique for spread-out data.

The quotient structure creates a further bias. Devilliers, Allassonnière, Trouvé and Pennec (2017) showed that estimating a template by a Fréchet mean in a quotient space is not consistent when the noise is not negligible: the estimate moves away from the true template as the noise grows. How to correct this bias for realistic anatomical data remains open.

Constrained and modular deformations

The kernel of V encodes only smoothness. Biological growth and motion are better described by a few structured mechanisms: local scalings, rotations, growth along a direction. Gris, Durrleman and Trouvé (2018) introduced deformation modules, which build the velocity field from a small number of parametrized generators. The resulting geometry is sub-Riemannian.

Arguillère, Trélat, Trouvé and Younes (2015) recast shape deformation as optimal control, which covers constrained models and gives existence results and Pontryagin-type equations. Choosing the modules from data, rather than by hand, is an open problem.

Stochastic shape evolutions

Geodesics model smooth, deterministic evolutions; real growth is noisy. Trouvé and Vialard (2012) introduced shape splines and stochastic perturbations of the Hamiltonian dynamics of landmarks. Arnaudon, Holm and Sommer (2019) proposed a geometric framework where the noise enters the momentum equation in a way compatible with the group structure. The stochastic calculus course of semester 1 gives the tools.

Inference in these models is hard: the likelihood of observed shapes requires bridges of the stochastic dynamics, which are expensive to simulate. Estimating the noise structure from longitudinal data is an open problem.

Data attachment terms

Varifolds and currents are not the last word. Kaltenmark, Charlier and Charon (2017) unified currents and varifolds through oriented varifolds, whose kernel on directions interpolates between the two. Roussillon and Glaunès (2016) introduced kernel metrics on normal cycles, which see curvature and boundaries.

Feydy, Charlier, Vialard and Peyré (2017) used optimal transport as a data term for diffeomorphic registration. Sinkhorn divergences, introduced by Genevay, Peyré and Cuturi (2018), interpolate between optimal transport and kernel norms; Feydy and coauthors (2019) proved that they define positive, convex and smooth data terms; see the Optimal Transport for Machine Learning course. Which data term suits which anatomy, with which theoretical guarantees, is largely an empirical question today.

Computation at scale

Kernel sums dominate the cost: every shooting step and every data term is a sum over pairs of points. KeOps (Charlier, Feydy, Glaunès, Collin and Durif, 2021) computes such reductions on GPUs without storing the kernel matrix, with automatic differentiation. It makes LDDMM on meshes of 10^5 vertices practical.

Deformetrica (Bône, Louis, Martin and Durrleman, 2018) packages atlas estimation, and Geomstats (Miolane and coauthors, 2020) offers Riemannian tools, including Kendall shape spaces and SPD matrices, in Python.

Learning and shape spaces

Deep networks now predict registrations in one forward pass. Quicksilver (Yang, Kwitt, Styner and Niethammer, 2017) predicts the initial momentum of LDDMM from an image pair. VoxelMorph (Balakrishnan, Zhao, Sabuncu, Guttag and Dalca, 2019) learns a displacement field without supervision. Dalca, Balakrishnan, Guttag and Sabuncu (2019) obtain diffeomorphisms by integrating a predicted stationary velocity field.

These amortized methods are fast, but several questions remain open.

The courses on Deep Learning for Medical Imaging and Representation Learning for Computer Vision and Medical Imaging take up the learning side of these questions.

Open problems in brief

Key takeaways — chapter 9

  • Metrics put directly on curves must control derivatives: the L^2 metric gives a zero distance, Sobolev and elastic metrics do not.
  • Curvature and quotients limit the statistics: Fréchet means may be non-unique, and template estimates in quotient spaces are biased.
  • Modular, sub-Riemannian and stochastic models add structure and noise to the deformations of the course.
  • New data terms (oriented varifolds, normal cycles, optimal transport), GPU kernel libraries and learned registration are the main active fronts.

Exercises

The exercises are sorted by level: ★ applies the course, ★★ combines results or proves a short statement, ★★★ is open-ended. The session plan says which ones to do after each session.

  1. ★ Exponential and logarithm on the sphere. On the unit sphere, let x = (0, 0, 1). Compute \exp_x(v) for v = (\pi/3, 0, 0), then \log_x(y) for y = (0, 1, 0), and check that d(x, \exp_x(v)) = |v|.

    Solution: by Example 1.8, \exp_x(v) = \cos(\pi/3)\, x + \sin(\pi/3)\, e_1 = (0.866, 0, 0.5) . Its angle with x is \arccos 0.5 = \pi/3 = |v|.

    For y = (0, 1, 0), \theta = \pi/2 and y - \cos\theta\, x = y, so \log_x(y) = (0, \pi/2, 0).

  2. ★ Kendall distance by hand. Compute the Kendall distance between the equilateral triangle (0, 1, e^{i\pi/3}) and the right isosceles triangle (0, 1, i).

    Solution: after centring, the equilateral triangle already has norm 1, and the right triangle w_c = \big( -(1+i), 2-i, -1+2i \big)/3 has norm 2/\sqrt3. The Hermitian product of the centred vectors is \langle z_c, w_c \rangle = \tfrac12 + \tfrac{\sqrt3}{3} + i\, \tfrac{\sqrt3}{6}, \qquad |\langle z_c, w_c \rangle| = 1.1154 . Dividing by 2/\sqrt3 gives 0.9659 = \cos(\pi/12), so the distance is \pi/12 = 0.2618, as in Code 1.12.

  3. ★ Swelling. Let \Sigma_1 = I and \Sigma_2 = \operatorname{diag}(e^2, e^{-2}). Compute their affine-invariant distance, their Euclidean midpoint and its determinant, and their affine-invariant midpoint.

    Solution: the eigenvalues of \Sigma_1^{-1} \Sigma_2 are e^{\pm 2}, so d = \sqrt{4 + 4} = 2\sqrt2 = 2.828.

    The Euclidean midpoint is \operatorname{diag}(4.195, 0.568), with determinant 2.381, although both matrices have determinant 1. The affine-invariant midpoint is \operatorname{diag}(e, e^{-1}), with determinant 1.

  4. ★ Moving together or apart. With the Gaussian kernel and two points at distance \sigma (\kappa = e^{-1}), compute the minimal RKHS norm of a function taking the values (1, 1), then (1, -1). Compare with Example 0.11.

    Solution: by Proposition 0.10, \|f^\star\|^2 = y^\top K^{-1} y. For y = (1, 1) it is 2/(1 + \kappa) = 1.462; for y = (1, -1) it is 2/(1 - \kappa) = 3.164.

    Coherent values are cheap and opposite values expensive; the case (1, 0) of Example 0.11, 1.156, lies in between.

  5. ★ Infinitesimal actions. Compute the following infinitesimal actions (Definition 2.3 and the table that follows it).

      1. v \cdot I for the image I(x) = x_1^2 and the translation v = e_1.
      1. The action of the dilation v(x) = x on a density \rho of \mathbb{R}^d.
      1. \xi \cdot \Sigma for \Sigma = \operatorname{diag}(4, 1/4) and the rotation generator \xi with entries \xi_{12} = -1 and \xi_{21} = 1.

    Solution: (a) -\nabla I \cdot e_1 = -2 x_1. (b) -\mathrm{div}(\rho\, x) = -d\, \rho - x \cdot \nabla\rho.

    1. \xi\Sigma + \Sigma\xi^\top has zero diagonal and off-diagonal entries 4 - 1/4 = 3.75. A rotation changes an anisotropic tensor; for \Sigma = I the result would be \xi + \xi^\top = 0.
  6. ★ Inexact matching of one landmark. One landmark at q_0, target y, kernel with k(x, x) = 1. Solve the inexact matching problem of ch. 4 in closed form and check Proposition 4.6.

    Solution: H = |p|^2/2, so p is constant and q(1) = q_0 + p_0. Minimizing \tfrac12 |p_0|^2 + |q_0 + p_0 - y|^2 / (2\lambda^2) gives p_0 = \frac{y - q_0}{1 + \lambda^2} . Then q(1) - y = -\lambda^2 (y - q_0)/(1 + \lambda^2), so -(q(1) - y)/\lambda^2 = p_0 = p(1).

  7. ★ Two landmarks translated together. Two landmarks at distance r start with the same velocity u. Compute their initial momenta and the initial cost \|v_0\|_V^2. Is the momentum constant in time?

    Solution: K(q)\, p = (u, u) gives p_1 = p_2 = u/(1 + \kappa), with \kappa = e^{-r^2/\sigma^2}, and \|v_0\|_V^2 = 2|u|^2/(1 + \kappa).

    By Theorem 4.3, \dot p_1 = 2 \sigma^{-2} \kappa |p_1|^2 (q_1 - q_2) \neq 0: the momenta acquire components along q_1 - q_2, and the points drift slightly apart. The rigid translation is not a geodesic.

  8. ★★ How much can a deformation compress? Using Proposition 0.7 and Definition 3.1, show that for v \in L^2([0, 1], V) \det D\varphi_1^v(x) \geq \exp\Big( -d\, c_V\, \Big( \int_0^1 \|v_t\|_V^2\, dt \Big)^{1/2} \Big) .

    Solution: the divergence is the trace of D v_t, so |\operatorname{div} v_t| = |\operatorname{tr} D v_t| \leq d\, \|D v_t\|_\infty \leq d\, c_V \|v_t\|_V . Insert this in the formula of Proposition 0.7, then bound \int_0^1 \|v_t\|_V\, dt by the Cauchy–Schwarz inequality.

    A deformation of length \ell cannot shrink volumes by more than a factor e^{-d c_V \ell}.

  9. ★★ Noether’s theorem for landmarks. For the Gaussian kernel, show that the total momentum \sum_i p_i and, in the plane, the angular momentum \sum_i q_i \wedge p_i are conserved, where a \wedge b = a_1 b_2 - a_2 b_1.

    Solution: with w_{ij} = 2 \sigma^{-2} k(q_i, q_j)\, (p_i \cdot p_j), symmetric in (i, j), Theorem 4.3 reads \dot p_i = \sum_j w_{ij} (q_i - q_j). Summing over i, antisymmetric terms cancel, so \sum_i \dot p_i = 0.

    For the angular momentum, the derivative is \sum_{i,j} k(q_i, q_j)\, p_j \wedge p_i + \sum_{i,j} w_{ij}\, q_i \wedge (q_i - q_j) . The first sum is antisymmetric under the swap of i and j, and the second equals -\sum_{i,j} w_{ij}\, q_i \wedge q_j, also antisymmetric. Both vanish.

  10. ★★ Head-on landmarks never collide. Let q_1 = -q_2 = (a, 0) and p_1 = -p_2 = (-b, 0) with a, b > 0. Show that the configuration stays symmetric, that H = b^2 (1 - \kappa) with \kappa = e^{-4a^2/\sigma^2}, and that a(t) decreases but never reaches 0.

    Solution: the symmetry (q, p) \mapsto (-q, -p) preserves the equations, so it holds for all times, with q_i and p_i on the first axis.

    Then \dot q_1 = (1 - \kappa)\, p_1, which gives \dot a = -(1 - \kappa)\, b and H = b^2 (1 - \kappa).

    Eliminating b with the conservation of H gives \dot a = -\sqrt{H (1 - \kappa)}. For small a, 1 - \kappa \approx 4a^2/\sigma^2, hence \dot a \approx -(2\sqrt{H}/\sigma)\, a: the gap decays exponentially and never closes in finite time.

  11. ★★ EPDiff in one dimension. In dimension 1, Theorem 3.8 gives m_t = (\psi')^2\, m_0 \circ \psi with \psi = \varphi_t^{-1}. Derive the equation \partial_t m + v\, \partial_x m + 2\, (\partial_x v)\, m = 0.

    Solution: differentiating \varphi_t \circ \psi = \mathrm{id} in time gives \partial_t \psi = -v\, \psi', hence \partial_t \psi' = -v' \psi' - v\, \psi''. Then \partial_t m = 2 \psi' (\partial_t \psi')\, m_0 \circ \psi + (\psi')^2 (m_0' \circ \psi)\, \partial_t \psi = -2 v' m - v \big( 2 \psi' \psi''\, m_0 \circ \psi + (\psi')^3\, m_0' \circ \psi \big) . The bracket is exactly \partial_x m, so \partial_t m = -2 v' m - v\, \partial_x m. This is EPDiff with D v = \operatorname{div} v = v'.

  12. ★★ The cross-fade bound for landmarks. For landmark metamorphosis (Proposition 7.4), show that the distance between two configurations x and y is at most |y - x| / \sigma. For a single landmark, compute it exactly.

    Solution: take v = 0 and \zeta = y - x constant: the energy is |y - x|^2 / (2\sigma^2), so d \leq |y - x| / \sigma.

    For one landmark, the cometric is the scalar 1 + \sigma^2; the geodesic is the straight line, and d = |y - x| / \sqrt{1 + \sigma^2}, which is indeed smaller than both |y - x| and |y - x| / \sigma.

  13. ★★ The current of a small loop. Compute the squared current norm of a square of side a, discretized by its four sides, with a Gaussian kernel of width \tau. Show that it behaves like 4 a^4 / \tau^2 when a \ll \tau, and interpret.

    Solution: adjacent sides are orthogonal and contribute nothing. Each side contributes a^2 with itself, and each of the two pairs of opposite sides contributes twice -a^2 e^{-a^2/\tau^2}. The total is 4 a^2 \big( 1 - e^{-a^2/\tau^2} \big) \approx \frac{4 a^4}{\tau^2} . The norm, 2a^2/\tau, is proportional to the enclosed area: a closed loop much smaller than \tau is seen as a tiny vortex, not as a curve.

  14. ★★ Choosing the kernel width (computational). Run Code 4.7 with \sigma = 0.1, 0.25 and 0.5. Report the geodesic length, the final gap and the minimal Jacobian, and explain the trends.

    Hints and expected result: the geodesic lengths are about 0.61, 0.48 and 0.78, and the minimal Jacobians about 0.14, 0.39 and 0.39. The final gaps stay near 0.001, except 0.005 for the widest kernel.

    With a narrow kernel, landmarks move almost independently: each pays for its own displacement, and the deformation concentrates near the points (smallest Jacobian). With a wide kernel, creating three lobes requires tearing neighbours apart, which Example 4.5 shows to be expensive. The intermediate width fits the scale of the shape.

  15. ★★★ Atlas estimation (computational). Starting from the population of Code 8.4, estimate a template by alternating (a) an inexact LDDMM matching of the template to each subject (Code 4.7), and (b) an update of the template that moves it along the average momentum. Compare the estimated template with the true one and with the Kendall Fréchet mean, then perform PCA of the momenta with the inner product of Definition 8.3.

    Hints and expected result: at a stationary point the mean of the initial momenta, read as velocities, is close to zero, which is the analogue of Proposition 8.2. Report the Kendall distance of both estimates to the generating template, and how it changes with the observation noise; relate the trend to the bias discussed after Proposition 8.6. The first PCA mode should be the stretching mode.

  16. ★★★ Currents versus varifolds on a fold (computational). Add to the target of Code 5.7 a thin spike: a narrow excursion that goes out and comes back along almost the same path. Match the circle with a current data term and with a varifold data term, and compare the results as the width of the spike decreases.

    Hints and expected result: the two sides of the spike have opposite tangents. Below the kernel width \tau they cancel as a current (Example 5.5), so current matching ignores the spike, while varifold matching grows it. Report the length of the matched curve inside the spike region against the spike width, for both data terms.

  17. ★★★ Image metamorphosis in 2D. Extend Code 7.6 to two-dimensional images: a smooth disk as template, and the same disk, shifted, with a small bright spot added as target. Compare with LDDMM (Code 6.6) on the same pair.

    Hints and expected result: LDDMM cannot create the spot; it either ignores it or distorts the disk towards it, with large Jacobians. Metamorphosis transports the disk and creates the spot by intensity change. Plot the deformation and intensity parts of the energy against \sigma, and locate the value where the spot stops being produced by deformation.

Projects and assessment

The Université Paris-Saclay course detail describes the assessment as “Evaluation Continue non Intégrale” (partial continuous assessment). master-mva.com displays no assessment section, and no weights are published. The subjects below are proposals for the project part of such an assessment: each reproduces or extends a named research paper, or builds a complete pipeline on synthetic data with a measurable success criterion. The written exam is a self-assessment proposal, not an official modality.

Solo projects

  1. [Solo · ≈ 20 h] Paper study: LDDMM for images. Reimplement the gradient descent of Beg, Miller, Trouvé and Younes (2005) with the explicit gradient of Theorem 6.5, not automatic differentiation.
    • Work: forward and backward flows on a 2D grid, the fields J^0_t, J^1_t and the Jacobians |\det D\varphi_{t,1}|; the kernel applied by FFT; a disk-to-C test pair and two smoothed synthetic “brain slices” built from ellipses.
    • Success criterion: relative mismatch below 10 % on the disk-to-C pair with a positive Jacobian everywhere; agreement between the explicit gradient and an automatic-differentiation gradient (Code 6.6) to 1 % at a random point.
    • Deliverables: code, a 4–6 page report, a 10-minute talk. Chapters 3 and 6.
  2. [Solo · ≈ 20 h] Paper study: varifolds for unoriented shapes. Reproduce the main claim of Charon and Trouvé (2013): varifold matching does not need consistent orientations, while current matching does.
    • Work: extend Code 5.7 with a current data term (Proposition 5.4); flip the orientation of a random fraction of the segments of the target; repeat on a triangulated surface in 3D (a sphere matched to an ellipsoid with a bump).
    • Success criterion: a curve of final varifold distance against the fraction of flipped elements, from 0 to 50 %, flat for varifolds and degrading for currents.
    • Deliverables: code, report, talk. Chapters 4 and 5.
  3. [Solo · ≈ 20 h] Paper study: statistics via initial momenta. Reproduce the approach of Vaillant, Miller, Younes and Trouvé (2004) on synthetic data with a known answer.
    • Work: generate populations as in Code 8.4 with two or three known modes; match the true template to each subject (Code 4.7); compute the PCA of the momenta with the K(\bar q) inner product; compare with Kendall tangent PCA.
    • Success criterion: the angle between the estimated and the true two-dimensional mode subspaces below 10° at the noise level of Code 8.4; a curve of this angle against the noise.
    • Deliverables: code, report, talk. Chapters 1, 4 and 8.

Group projects

  1. [Group of 2–3 · ≈ 30 h each] A surface atlas with varifolds. Build the template-estimation pipeline of Joshi, Davis, Jomier and Gerig (2004), with the varifold data term of Charon and Trouvé (2013), for synthetic 3D surfaces.
    • Data: 20 to 40 triangulated surfaces (10^3 to 5 \times 10^3 faces) obtained by shooting a bent ellipsoid with random momenta in two or three modes, then remeshing each one differently.
    • Split: one member writes the 3D shooting and the varifold term, one the alternating atlas estimation, one the statistics (PCA of momenta) and the evaluation.
    • Success criterion: the estimated template within a varifold distance of 5 % of the population spread from the generating template; the generating modes recovered as the first principal modes.
    • Deliverables: code, a 6–8 page report, a 15-minute talk. Chapters 4, 5 and 8.
  2. [Group of 2–3 · ≈ 30 h each] Registration of diffusion tensor fields. Compare the reorientation strategies of Alexander, Pierpaoli, Basser and Gee (2001) inside an LDDMM registration.
    • Data: synthetic 2D tensor fields with curved fibre bundles (tensors elongated along the tangent of a family of curves), deformed by known diffeomorphisms; noise added on the eigenvalues.
    • Split: one member builds the phantoms and the ground truth; one implements the registration of the tensor fields with a Frobenius and an affine-invariant data term (Proposition 2.5); one implements the full action, finite strain and preservation of principal direction, and evaluates them.
    • Success criterion: a table of the mean angle between registered and true fibre directions, for the three strategies and two data terms. The best combination must bring this angle below half of its value before registration, and the ranking of the strategies must be explained on the data with Example 6.2.
    • Deliverables: code, report, talk. Chapters 2 and 6.
  3. [Group of 2–3 · ≈ 30 h each] Lesions and metamorphosis. Compare LDDMM and image metamorphosis (Trouvé and Younes, 2005) for matching a healthy template to images with a lesion.
    • Data: synthetic 2D “brain” phantoms made of nested smoothed ellipses, deformed, with a bright or dark lesion added in some of them.
    • Split: one member extends Code 6.6, one extends Code 7.6 to 2D, one builds the phantoms, chooses \sigma and runs the evaluation.
    • Success criterion: a curve of the error on the recovered deformation (known for the phantoms), measured outside the lesion, against the lesion size, for LDDMM and for metamorphosis. For lesions up to 10 % of the phantom area, metamorphosis should keep this error within 20 % of the lesion-free case.
    • Deliverables: code, report, talk. Chapters 6 and 7.

Written exam (proposal)

Format: 2 hours, one handwritten A4 sheet allowed, no electronic devices, four exercises.

  1. Question (4 points). Explain why large deformation models use the flow of a time-dependent velocity field rather than the map x \mapsto x + v(x). State the regularity of the flow and the formula for its Jacobian determinant.

    Expected: x + v(x) is a diffeomorphism when \|Dv\|_\infty < 1, but folds where \det(I + Dv) < 0; the flow of an L^2([0, 1], V) velocity with V admissible is a C^1 diffeomorphism (Theorem 3.3); the Jacobian is the exponential of the integral of the divergence along the trajectory, hence positive (Proposition 0.7).

  2. Question (6 points). Gaussian kernel of width \sigma, two landmarks at distance \sigma/2. (a) Compute the cost of moving one landmark with velocity u while the other stays still. (b) Same question for landmark metamorphosis with \sigma_{\text{meta}}^2 = 1. (c) Compute the affine-invariant distance between the identity and \operatorname{diag}(4, 1), and the determinants of their Euclidean and affine-invariant midpoints.

    Expected: (a) \kappa = e^{-1/4} = 0.779 and the cost is |u|^2 / (1 - \kappa^2) = 2.541\, |u|^2. (b) 2 / (4 - \kappa^2) = 0.589 times |u|^2. (c) The distance is \log 4 = 1.386; the determinants are 2.5 and 2.

  3. Question (5 points). Let a finite-dimensional group act on Q with infinitesimal action A_q onto T_q Q. Prove that the projected metric is |\eta|_q^2 = \eta^\top K(q)^{-1} \eta with K(q) = A_q A_q^*. Deduce the form of the optimal velocity field in landmark matching.

    Expected: the minimal-norm solution of A_q \xi = \eta lies in the orthogonal of \ker A_q, which is the range of A_q^*. Writing \xi = A_q^* p gives K p = \eta and |\xi|^2 = p^\top K p.

    For landmarks, A_q^* p = \sum_j K(\cdot, q_j) p_j: the optimal velocity is a combination of kernels at the landmarks (Theorems 2.8 and 4.2).

  4. Question (5 points). Write the LDDMM energy for images and its gradient. Explain why optimal momenta are scalar fields times the image gradient, and what goes wrong when the target contains a structure absent from the template; describe how metamorphosis fixes it.

    Expected: Definition 6.4 and Theorem 6.5; Proposition 6.3 (velocities along level lines are invisible, so the optimal momentum lies in the range of A_I^*); a new structure is out of the orbit, so the distance is infinite and the optimizer distorts the anatomy; metamorphosis adds the intensity residual Z with weight 1/\sigma^2, giving a finite distance (Proposition 7.2).

Grading rubric (proposal)

Criterion Weight What earns the marks
Understanding of the paper and the model 20 % The geometric setting (group, action, metric, data term) is stated correctly, in the student’s own notation
Mathematical correctness 15 % Gradients, Hamiltonian equations and endpoint conditions are derived or checked, for example against automatic differentiation
Implementation 20 % The method runs on the data, is checked on a case with a known answer, and conserves what it should (energy, positive Jacobians)
Experiments 20 % Clear protocol, baselines from the course, the success criterion reached or the gap explained
Analysis 10 % Influence of the kernel widths and noise levels, failure cases, at least one variant tested
Report and talk 15 % A report and a talk that a classmate can follow; figures with deformation grids, units and captions

References

Official references

Neither the master-mva.com course page nor the Université Paris-Saclay course detail lists references for this course. The textbook of Younes (2010) and the papers of the instructors below cover most of the official syllabus.

Textbooks

Foundations: kernels, Riemannian geometry, groups of diffeomorphisms (ch. 0–3)

Landmarks, point sets, curves and surfaces (ch. 4–5)

Images, tensor fields and metamorphoses (ch. 6–7)

Statistics and computational anatomy (ch. 8)

Research directions (ch. 9)