


\subsection{Atlas Estimation Using the Fréchet Lie Group Structure}\label{atlas_est_algo}

This algorithm utilizes the Lie group structure in the latent space of the trained \model to achieve a geometrically consistent and computationally efficient framework for atlas estimation. The objective is to iteratively refine the atlas while ensuring its validity as a reference in the deformation space.

\begin{enumerate}
    \item \textbf{Initialize the Atlas:} Randomly select an image from the input set \( \{ \bsymb{I}_1, \bsymb{I}_2, \dots, \bsymb{I}_N \} \) as the initial atlas \( \bsymb{A}^{(k)} \) for \(k = 0\).

    \item \textbf{Estimate Deformation Fields and Latent Representations:} For each input image \( \bsymb{I}_i \), perform the following steps:
    \begin{enumerate}
        \item Compute the deformation field \( \bphi_{\bsymb{I}_{i}\bsymb{A}} \) that aligns the input image \( \bsymb{I}_i \) to the current atlas \( \bsymb{A}^{(k)} \) using the registration module of the \model~framework. Similarly, compute \( \bphi_{\bsymb{A}\bsymb{I}_{i}} \), which aligns \( \bsymb{A}^{(k)} \) to \( \bsymb{I}_i \).
        \item Extract the latent representations \( \z_{\bsymb{I}_{i}\bsymb{A}} \) and \( \z_{\bsymb{A}\bsymb{I}_{i}} \) corresponding to the deformation fields \( \bphi_{\bsymb{I}_{i}\bsymb{A}} \) and \( \bphi_{\bsymb{A}\bsymb{I}_{i}} \), respectively, using the LEDA module of the trained \model~framework.
    \end{enumerate}

    \item \textbf{Calculate the Mean Deformation Field:} Compute the mean of the latent representations \( \{\z_{\bsymb{A}\bsymb{I}_{1}}, \z_{\bsymb{A}\bsymb{I}_{2}}, \dots, \z_{\bsymb{A}\bsymb{I}_{N}}\} \) corresponding to the deformation fields:
    \[
    \z^k = \frac{1}{N} \sum_{i=1}^N \z_{\bsymb{A}\bsymb{I}_{i}}.
    \]
    Use the LEDA module to map the mean latent representation \( \z^k \) to the corresponding mean deformation field \( \overline{\bphi}^{k} \) and negate \(\z^k\) and decode it to get the inverse of the mean deformation field \(\overline{\phi}_{inv}^{k}\). 

    \item \textbf{Update the Atlas:} Warp the current atlas \( \bsymb{A}^{(k)} \) using \(\overline{\phi}_{inv}^{k}\) deformation field that brings the current atlas \(\bsymb{A}^{k}\) closer to the mean of the population of images. The updated atlas is computed as:
    \[
    \bsymb{A}^{(k+1)}(\x) = \bsymb{A}^{(k)}(\overline{\bphi}^{k}_{\alpha}(\x)). = \overline{\phi}_{inv}^{k} ( \bsymb{A}^{k})
    \]

    \item \textbf{Convergence Check:} Compute the change in the atlas between iterations:
    \[
    \Delta = \frac{\|\bsymb{A}^{(k+1)} - \bsymb{A}^{(k)}\|}{\|\bsymb{A}^{(k)}\|}.
    \]
    If the \(\Delta\) is below a predefined threshold \( \epsilon \), terminate the algorithm. Otherwise, increment the iteration index \( k \leftarrow k + 1 \) and repeat from Step 2.
\end{enumerate}

