# Riemannian metric and Lie bracket in computational anatomy

Computational anatomy (CA) is the study of shape and form in medical imaging. The study of deformable shapes in CA rely on high-dimensional diffeomorphism groups $\operatorname {Diff} _{V}$ which generate orbits of the form ${\mathcal {M}}\doteq \{\varphi \cdot m\mid \varphi \in \operatorname {Diff} _{V}\}$. In CA, this orbit is in general considered a smooth Riemannian manifold since at every point of the manifold $m\in {\mathcal {M}}$ there is an inner product inducing the norm $\|\cdot \|_{m}$ on the tangent space that varies smoothly from point to point in the manifold of shapes $m\in {\mathcal {M}}$. This is generated by viewing the group of diffeomorphisms $\varphi \in \operatorname {Diff} _{V}$ as a Riemannian manifold with $\|\cdot \|_{\varphi }$, associated to the tangent space at $\varphi \in \operatorname {Diff} _{V}$ . This induces the norm and metric on the orbit $m\in {\mathcal {M}}$ under the action from the group of diffeomorphisms.

## The diffeomorphisms group generated as Lagrangian and Eulerian flows

The diffeomorphisms in computational anatomy are generated to satisfy the Lagrangian and Eulerian specification of the flow fields, $\varphi _{t},t\in [0,1]$, generated via the ordinary differential equation
| ${\frac {d}{dt}}\varphi _{t}=v_{t}\circ \varphi _{t},\ \varphi _{0}=\operatorname {id} ;$ | (Lagrangian flow) |
with the Eulerian vector fields $v\doteq (v_{1},v_{2},v_{3})$ in ${\mathbb {R} }^{3}$ for $v_{t}={\dot {\varphi }}_{t}\circ \varphi _{t}^{-1},t\in [0,1]$, with the inverse for the flow given by
| ${\frac {d}{dt}}\varphi _{t}^{-1}=-(D\varphi _{t}^{-1})v_{t},\ \varphi _{0}^{-1}=\operatorname {id} ,$ | (Eulerianflow) |
and the $3\times 3$ Jacobian matrix for flows in $\mathbb {R} ^{3}$ given as $\ D\varphi \doteq \left({\frac {\partial \varphi _{i}}{\partial x_{j}}}\right).$
To ensure smooth flows of diffeomorphisms with inverse, the vector fields ${\mathbb {R} }^{3}$ must be at least 1-time continuously differentiable in space which are modelled as elements of the Hilbert space $(V,\|\cdot \|_{V})$ using the Sobolev embedding theorems so that each element $v_{i}\in H_{0}^{3},i=1,2,3,$ has 3-square-integrable derivatives thusly implies $(V,\|\cdot \|_{V})$ embeds smoothly in 1-time continuously differentiable functions. The diffeomorphism group are flows with vector fields absolutely integrable in Sobolev norm:
| $\operatorname {Diff} _{V}\doteq \{\varphi =\varphi _{1}:{\dot {\varphi }}_{t}=v_{t}\circ \varphi _{t},\varphi _{0}=\operatorname {id} ,\int _{0}^{1}\|v_{t}\|_{V}\,dt<\infty \}\ .$ | (Diffeomorphism Group) |

## The Riemannian orbit model

Shapes in Computational Anatomy (CA) are studied via the use of diffeomorphic mapping for establishing correspondences between anatomical coordinate systems. In this setting, 3-dimensional medical images are modelled as diffeomorphic transformations of some exemplar, termed the template $I_{temp}$, resulting in the observed images to be elements of the random orbit model of CA. For images these are defined as $I\in {\mathcal {I}}\doteq \{I=I_{temp}\circ \varphi ,\varphi \in \operatorname {Diff} _{V}\}$, with for charts representing sub-manifolds denoted as ${\mathcal {M}}\doteq \{\varphi \cdot m_{temp}:\varphi \in \operatorname {Diff} _{V}\}$.

## The Riemannian metric

The orbit of shapes and forms in Computational Anatomy are generated by the group action${\mathcal {M}}\doteq \{\varphi \cdot m:\varphi \in \operatorname {Diff} _{V}\}$. This is made into a Riemannian orbit by introducing a metric associated to each point and associated tangent space. For this a metric is defined on the group which induces the metric on the orbit. Take as the metric for Computational anatomy at each element of the tangent space $\varphi \in \operatorname {Diff} _{V}$ in the group of diffeomorphisms
    $\|{\dot {\varphi }}\|_{\varphi }\doteq \|{\dot {\varphi }}\circ \varphi ^{-1}\|_{V}=\|v\|_{V}$,
with the vector fields modelled to be in a Hilbert space with the norm in the Hilbert space $(V,\|\cdot \|_{V})$. We model $V$ as a reproducing kernel Hilbert space (RKHS) defined by a 1-1, differential operator$A:V\rightarrow V^{*}$. For $\sigma (v)\doteq Av\in V^{*}$ a distribution or generalized function, the linear form $(\sigma \mid w)\doteq \int _{\mathbb {R} ^{3}}\sum _{i}w_{i}(x)\sigma _{i}(dx)$ determines the norm:and inner product for $v\in V$ according to
    $\langle v,w\rangle _{V}\doteq \int _{X}Av\cdot w\,dx,\ \|v\|_{V}^{2}\doteq \int _{X}Av\cdot v\,dx,\ v,w\in V\ .$
where the integral is calculated by integration by parts for $Av$ a generalized function $Av\in V^{*}$ the dual-space. The differential operator is selected so that the Green's kernel associated to the inverse is sufficiently smooth so that the vector fields support 1-continuous derivative.

### The right-invariant metric on diffeomorphisms

The metric on the group of diffeomorphisms is defined by the distance as defined on pairs of elements in the group of diffeomorphisms according to
| $d_{\operatorname {Diff} _{V}}(\psi ,\varphi )=\inf _{v_{t}}\left({\frac {1}{2}}\int _{0}^{1}\int _{X}Av_{t}\cdot v_{t}\,dx\ dt:\varphi _{0}=\psi ,\varphi _{1}=\varphi ,{\dot {\varphi }}_{t}=v_{t}\circ \varphi _{t}\right)^{1/2}\ .$ | (metric-diffeomorphisms) |
This distance provides a right-invariant metric of diffeomorphometry, invariant to reparameterization of space since for all $\varphi \in \operatorname {Diff} _{V}$,
    $d_{\operatorname {Diff} _{V}}(\psi ,\varphi )=d_{\operatorname {Diff} _{V}}(\psi \circ \varphi ,\varphi \circ \varphi ).$

## The Lie bracket in the group of diffeomorphisms

The Lie bracket gives the adjustment of the velocity term resulting from a perturbation of the motion in the setting of curved spaces. Using Hamilton's principle of least-action derives the optimizing flows as a critical point for the action integral of the integral of the kinetic energy. The Lie bracket for vector fields in Computational Anatomy was first introduced in Miller, Trouve and Younes. The derivation calculates the perturbation $\delta v$ on the vector fields $v^{\varepsilon }=v+\varepsilon \delta v$ in terms of the derivative in time of the group perturbation adjusted by the correction of the Lie bracket of vector fields in this function setting involving the Jacobian matrix, unlike the matrix group case:
| $ad_{v}:V\mapsto V$ given by $ad_{v}(w)\doteq (Dv)w-(Dw)v,v,w\in V.$ | (adjoint-Lie-bracket) |
Proof: Proving Lie bracket of vector fields take a first order perturbation of the flow at point $\varphi \in \operatorname {Diff} _{V}$.
Taking the first order perturbation gives $\varphi _{t}^{\varepsilon }\doteq (\operatorname {id} +\varepsilon w)\circ \varphi =\varphi +\varepsilon w\circ \varphi$, with fixed boundary $w_{0}=w_{1}=0$, with ${\frac {d}{dt}}\varphi _{t}^{\varepsilon }=v_{t}^{\varepsilon }\circ \varphi _{t}^{\varepsilon },\varphi _{0}^{\varepsilon }=\operatorname {id} ,\varphi _{1}^{\varepsilon }=\varphi _{1}$, giving the following two Eqns:
   * ${\frac {d}{dt}}\varphi _{t}^{\varepsilon }={\frac {d}{dt}}\varphi _{t}+\varepsilon {\frac {d}{dt}}(w_{t}\circ \varphi _{t})=v_{t}\circ \varphi _{t}+(Dw_{t})\circ \varphi _{t}v_{t}\circ \varphi _{t}+o(\varepsilon )\ .$
   * ${\dot {\varphi }}_{t}^{\varepsilon }=(v_{t}+\varepsilon \delta v_{t})\circ (\varphi _{t}+\varepsilon w_{t}\circ \varphi _{t})\simeq v_{t}\circ \varphi _{t}+\varepsilon (Dv_{t})\circ \varphi _{t}w_{t}\circ \varphi _{t}+\delta v_{t}\circ \varphi _{t}+o(\varepsilon )\ .$
Equating the above two equations gives the perturbation of the vector field in terms of the Lie bracket adjustment.
The Lie bracket gives the first order variation of the vector field with respect to first order variation of the flow.
    $\delta v_{t}={\frac {d}{dt}}w_{t}-ad_{v_{t}}(w_{t})={\frac {d}{dt}}w_{t}-((Dv_{t})w_{t}-(Dw_{t})v_{t})\ .$

## The generalized Euler–Lagrange equation for the metric on diffeomorphic flows

The Euler–Lagrange equation can be used to calculate geodesic flows through the group which form the basis for the metric. The action integral for the Lagrangian of the kinetic energy for Hamilton's principle becomes
| $J(\varphi )\doteq {\frac {1}{2}}\int _{0}^{1}\|{\dot {\varphi }}_{t}\|_{\varphi _{t}}^{2}\,dt={\frac {1}{2}}\int _{0}^{1}\|{\dot {\varphi }}_{t}\circ \varphi _{t}^{-1}\|_{V}^{2}\,dt={\frac {1}{2}}\int _{0}^{1}\int _{X}A({\dot {\varphi }}_{t}\circ \varphi _{t}^{-1})\cdot ({\dot {\varphi }}_{t}\circ \varphi _{t}^{-1})\,dx\,dt\ .$ | (Hamilton's Action Integral) |
The action integral in terms of the vector field corresponds to integrating the kinetic energy
    $J(v)\doteq {\frac {1}{2}}\int _{0}^{1}\|v_{t}\|_{V}^{2}dt={\frac {1}{2}}\int _{0}^{1}\int _{X}Av_{t}\cdot v_{t}\,dx\ dt\ .$
The shortest paths geodesic connections in the orbit are defined via Hamilton's Principle of least action requires first order variations of the solutions in the orbits of Computational Anatomy which are based on computing critical points on the metric length or energy of the path. The original derivation of the Euler equation associated to the geodesic flow of diffeomorphisms exploits the was a generalized function equation when$Av\in V^{*}$ is a distribution, or generalized function, take the first order variation of the action integral using the adjoint operator for the Lie bracket (adjoint-Lie-bracket) gives for all smooth $w\in V$,
    ${\frac {d}{d\varepsilon }}J(\varphi ^{\varepsilon })|_{\varepsilon =0}=\int _{0}^{1}\int _{X}Av_{t}\cdot \delta v_{t}\,dx\,dt=\int _{0}^{1}\int _{X}Av_{t}\cdot \left({\frac {d}{dt}}w_{t}-((Dv_{t})w-(Dw)v_{t})\right)\,dx\,dt.$
Using the bracket $ad_{v}:w\in V\mapsto V$ and $ad_{v}^{*}:V^{*}\rightarrow V^{*}$ gives
| ${\frac {d}{dt}}Av_{t}+ad_{v_{t}}^{*}(Av_{t})=0\ ,\ t\in [0,1]\ ,$ | (EL-General) |
meaning for all smooth $w\in V,$
    $\int _{X}\left({\frac {d}{dt}}Av_{t}+ad_{v_{t}}^{*}(Av_{t})\right)\cdot w\,dx=\int _{X}{\frac {d}{dt}}Av_{t}\cdot w\,dx+\int _{X}Av_{t}\cdot \left((Dv_{t})w-(Dw)v_{t}\right)\,dx=0.$
Equation (Euler-general) is the Euler-equation when diffeomorphic shape momentum is a generalized function.
This equation has been called EPDiff, Euler–Poincare equation for diffeomorphisms and has been studied in the context of fluid mechanics for incompressible fluids with $L^{2}$ metric.

## Riemannian exponential for positioning

In the random orbit model of Computational anatomy, the entire flow is reduced to the initial condition which forms the coordinates encoding the diffeomorphism, as well as providing the means of positioning information in the orbit. This was first terms a geodesic positioning system in Miller, Trouve, and Younes. From the initial condition $v_{0}$ then geodesic positioning with respect to the Riemannian metric of Computational anatomy solves for the flow of the Euler–Lagrange equation. Solving the geodesic from the initial condition $v_{0}$ is termed the Riemannian-exponential, a mapping $\operatorname {Exp} _{\operatorname {id} }(\cdot ):V\to \operatorname {Diff} _{V}$ at identity to the group.
The Riemannian exponential satisfies $\operatorname {Exp} _{\operatorname {id} }(v_{0})=\varphi _{1}$ for initial condition ${\dot {\varphi }}_{0}=v_{0}$, vector field dynamics ${\dot {\varphi }}_{t}=v_{t}\circ \varphi _{t},t\in [0,1]$,
* for classical equation on the diffeomorphic shape momentum as a smooth vector $Av_{t}=\mu _{t}\,dx$ with $\int _{X}\mu _{t}\cdot w\,dx\ ,w\in V$ the Euler equation exists in the classical sense as first derived for the density:
    ${\frac {d}{dt}}\mu _{t}+(Dv_{t})^{T}\mu _{t}+(D\mu _{t})v_{t}+(\nabla \cdot v)\mu _{t}=0\ ,\ Av_{t}=\mu _{t}\,dx;$
* for generalized equation, $Av\in V^{*}$, then
    ${\frac {d}{dt}}Av_{t}+ad_{v_{t}}^{*}(Av_{t})=0\ ,\ t\in [0,1]\ .$
It is extended to the entire group, $\varphi =\operatorname {Exp} _{\varphi }(v_{0}\circ \varphi )\doteq \operatorname {Exp} _{\operatorname {id} }(v_{0})\circ \varphi$.

## The variation problem for matching or registering coordinate system information in computational anatomy

Matching information across coordinate systems is central to computational anatomy. Adding a matching term $E:\varphi \in \operatorname {Diff} _{V}\rightarrow R^{+}$ to the action integral of Equation (Hamilton's action integral) which represents the target endpoint
    $C(\varphi )\doteq \int _{0}^{1}\int _{X}Av_{t}\cdot v_{t}\,dx\,dt+E(\varphi _{1})\ .$
The endpoint term adds a boundary condition for the Euler–Lagrange equation (EL-General) which gives the Euler equation with boundary term. Taking the variation gives
* Necessary geodesic condition:
       ${\begin{cases}&{\dfrac {d}{dt}}Av_{t}+(Dv_{t})^{T}Av_{t}+(DAv_{t})v_{t}+(\nabla \cdot v)Av_{t}=0\ ;\\[4pt]&Av_{1}+{\frac {\partial E(\varphi )}{\partial \varphi _{1}}}=0\end{cases}}$
Proof: The Proof via variation calculus uses the perturbations from above and classic calculus of variation arguments.
    ${\begin{aligned}&\int _{0}^{1}\int _{X}Av_{t}\cdot \left({\frac {d}{dt}}\delta \varphi _{t}-(Dv_{t}\delta \varphi _{t}-D\delta \varphi _{t}v_{t})\right)\,dx\,dt+\int _{X}\left({\frac {\partial E(\varphi )}{\partial \varphi _{1}}}\cdot \delta \varphi _{1}\,dx\right)\\[6pt]=&-\int _{0}^{1}\int _{X}\left({\frac {dAv_{t}}{dt}}+ad_{v_{t}}^{*}(Av_{t})\right)\cdot \delta \varphi _{t}\,dx\,dt+\int _{X}\left(Av_{1}+{\frac {\partial E(\varphi )}{\partial \varphi _{1}}}\right)\cdot \delta \varphi _{1}\,dx.\end{aligned}}$

### Euler–Lagrange geodesic endpoint conditions for image matching

The earliest large deformation diffeomorphic metric mapping (LDDMM) algorithms solved matching problems associated to images and registered landmarks. are in a vector spaces. The image matching geodesic equation satisfies the classical dynamical equation with endpoint condition. The necessary conditions for the geodesic for image matching takes the form of the classic Equation (EL-Classic) of Euler–Lagrange with boundary condition:
    $\min _{\varphi :{\dot {\varphi }}=v_{t}\circ \varphi _{t}}C(\varphi )\doteq {\frac {1}{2}}\int _{0}^{1}\int _{X}Av_{t}\cdot v_{t}\,dx\,dt+{\frac {1}{2}}\int _{X}|I\circ \varphi _{1}^{-1}(x)-J(x)|^{2}\,dx$
* Necessary geodesic condition:
       ${\begin{cases}&{\dfrac {d}{dt}}Av_{t}+(Dv_{t})^{T}Av_{t}+(DAv_{t})v_{t}+(\nabla \cdot v)Av_{t}=0\ ;\\[4pt]&Av_{1}=(I\circ \varphi _{1}^{-1}-J)\nabla (I\circ \varphi _{1}^{-1})\end{cases}}$

### Euler–Lagrange geodesic endpoint conditions for landmark matching

The registered landmark matching problem satisfies the dynamical equation for generalized functions with endpoint condition:
    $\min _{\varphi :{\dot {\varphi }}=v_{t}\circ \varphi _{t}}C(\varphi )\doteq {\frac {1}{2}}\int _{0}^{1}\int _{X}Av_{t}\cdot v_{t}\,dx\,dt+{\frac {1}{2}}\sum _{i}(\varphi _{1}(x_{i})-y_{i})\cdot (\varphi _{1}(x_{i})-y_{i}).$
* Necessary geodesic conditions:
       ${\begin{cases}&{\dfrac {d}{dt}}Av_{t}+ad_{v_{t}}^{*}(Av_{t})=0\ ,\ t\in [0,1]\ ,\\[4pt]&Av_{1}=\sum _{i=1}^{n}\delta _{\varphi _{1}(x_{i})}(y_{i}-\varphi _{1}(x_{i}))\end{cases}}$
Proof:
The variation ${\frac {\partial }{\partial \varphi }}E(\varphi )$ requires variation of the inverse $\varphi ^{-1}$ generalizes the matrix perturbation of the inverse via $(\varphi +\varepsilon \delta \varphi \circ \varphi )\circ (\varphi ^{-1}+\varepsilon \delta \varphi ^{-1}\circ \varphi ^{-1})=\operatorname {id} +o(\varepsilon )$ giving
$\delta \varphi ^{-1}\circ \varphi ^{-1}=-(D\varphi _{1}^{-1})\delta \varphi$ giving
    ${\begin{aligned}&{\frac {d}{d\varepsilon }}{\frac {1}{2}}\left.\int _{X}|I\circ (\varphi ^{-1}+\varepsilon \delta \varphi ^{-1}\circ \varphi ^{-1})-J|^{2}\,dx\right|_{\varepsilon =0}\\[6pt]=&\int _{X}(I\circ \varphi ^{-1}-J)\nabla I|_{\varphi ^{-1}}(-D\varphi _{1}^{-1})\delta \varphi \,dx\\[6pt]=&-\int _{X}(I\circ \varphi _{1}^{-1}-J)\nabla (I\circ \varphi _{1}^{-1})\delta \varphi \,dx.\end{aligned}}$