\section{Introduction}\label{Introduction}

The quantification of shapes has become an important research direction in both the applied and theoretical sciences. It has brought advances to many fields including network analysis \citep{lee2011discriminative}, geometric morphometrics \citep{boyer2011algorithms,gao2019gaussian}, biophysics and structural biology \citep{wang2021statistical}, and radiomics (i.e., the field that aims to correlate clinical imaging features and genomic assays) \citep{crawford2020predicting}. If shapes are considered random, then their corresponding quantitative summaries are also random --- implying such summaries of random shapes are statistics. The statistical inference of shapes based on these quantitative summaries has been of particular interest (e.g., the derivation of confidence sets by \cite{fasy2014confidence} and a framework for hypothesis testing by \cite{robinson2017hypothesis}).

\subsection{Overview of Topological Data Analysis}

Topological data analysis (TDA) presents a collection of statistical methods that quantitatively summarize the shapes represented in data using computational topology \citep{edelsbrunner2010computational}. One common statistical invariant in TDA is the persistent diagram (PD) \citep{edelsbrunner2000topological}). When equipped with the $p$-th Wasserstein distance for $1\le p<\infty$, the collection of PDs denoted as $\mathscr{D}$ is a Polish space  \citep{mileyko2011probability}; hence, probability measures can be applied, and the randomness of shapes can be potentially represented using the probability measures on $\mathscr{D}$. However, a single PD does not preserve all relevant information of a shape  \citep{crawford2020predicting}. Using the Euler calculus, \cite{ghrist2018persistent} (Corollary 6 therein) showed that the persistent homology transform (PHT) \citep{turner2014persistent}, motivated by integral geometry and differential topology, concisely summarizes information within shapes. The PHT takes values in $C(\mathbb{S}^{d-1};\mathscr{D}^d)=\{\mbox{all continuous maps }F:\mathbb{S}^{d-1} \rightarrow \mathscr{D}^d\}$, where $\mathbb{S}^{d-1}$ denotes the sphere $\{x\in\mathbb{R}^d:\Vert x\Vert=1\}$ and $\mathscr{D}^d$ is the $d$-fold Cartesian product of $\mathscr{D}$ (see Lemma 2.1 and Definition 2.1 of \cite{turner2014persistent}). Since $\mathscr{D}$ is not a vector space and the distances on $\mathscr{D}$ (e.g., the $p$-th Wasserstein and bottleneck distances \citep{cohen2007stability}) are very abstract, many fundamental concepts in classical statistics are not easy to implement with summaries resulting from the PHT. For example, the definition of moments corresponding to probability measures on $\mathscr{D}$ (e.g., means and variances) is highly nontrivial (see \cite{mileyko2011probability} and \cite{turner2014frechet}). The difficulty in defining these properties prevents the applications of PHT-based statistical inference methods in $C(\mathbb{S}^{d-1};\mathscr{D}^d)$.

The smooth Euler characteristic transform (SECT) proposed by \cite{crawford2020predicting} provides an alternative summary statistic for shapes. The SECT not only preserves the information of shapes of interest (see Corollary 6 of \cite{ghrist2018persistent}), but it also represents shapes using univariate continuous functions instead of PDs. Specifically, values of the SECT are maps from the sphere $\mathbb{S}^{d-1}$ to a separable Banach space --- the collection of real-valued continuous functions on a compact interval, say $C([0,T])  =  \mathcal{B}$ for some $T>0$ (values of $T$ will be given in Eq.~\eqref{eq: def of sublevel sets}). That is, for any shape $K$, its SECT, denoted as $SECT(K)  =  \{SECT(K)(\nu)\}_{\nu\in\mathbb{S}^{d-1}}$, is in $\mathcal{B}^{\mathbb{S}^{d-1}}=\{\mbox{all maps }f: \mathbb{S}^{d-1}\rightarrow\mathcal{B}\}$; specifically, $SECT(K)(\nu)\in\mathcal{B}$ for each $\nu\in\mathbb{S}^{d-1}$. Therefore, the randomness of shapes $K$ is represented via the SECT by a collection of $\mathcal{B}$-valued random variables. The probability theory on separable Banach spaces has been better developed than on $\mathscr{D}$. Specifically, a $\mathcal{B}$-valued random variable is a stochastic process with its paths in $\mathcal{B}$ (we will further show in Section \ref{The Definition of Smooth Euler Characteristic Transform} that $\mathcal{B}$ herein can be replaced with a reproducing kernel Hilbert space (RKHS)), and the theory of stochastic processes has been developed for nearly a century. Many mathematical tools are available for building the foundations of the randomness and statistical inference of shapes.

The work from \cite{crawford2020predicting} applied the SECT to magnetic resonance images taken from tumors of a cohort of glioblastoma multiforme (GBM) patients. Using summary statistics derived from the SECT as predictors of the Gaussian process regression, the authors showed that the SECT has the power to predict clinical outcomes better than existing tumor shape quantification approaches and common molecular assays. The relative performance of the SECT in the GBM study represents a promising future for the utility of SECT in medical imaging and more general statistical applications investigating shapes. Similarly, \cite{wang2021statistical} applied derivatives of the Euler characteristic transform as predictors of statistical models for subimage analysis which is related to the task of variable selection and seeks to identify physical features that are most important for differentiating between two classes of shapes. In both \cite{crawford2020predicting} and \cite{wang2021statistical}, the shapes were implemented as the predictors of regressions, and the randomness of these predictors was ignored.

\subsection{Overview of Contributions}

In this paper, we model the distributions of shapes via the SECT using RKHS-valued random fields and provide the corresponding foundations using tools in algebraic and computational topology, Sobolev spaces, and functional analysis. In contrast to work like \cite{crawford2020predicting} and \cite{wang2021statistical}, we model realizations from the SECT as the responses of an RKHS-valued random field rather than as input variables or predictors. Modeling the distributions of shapes helps answer the following statistical inference question: \textit{Is the difference between two groups of shapes significant or just random?} Based on the foundations of the randomness of shapes, we propose an approach for testing hypotheses on random shapes and answer this statistical inference question.

Using the homotopy theory and PDs, we first propose a general collection of shapes on which the SECT is well-defined. Then, we show that, for each shape in this collection, its SECT is in $C(\mathbb{S}^{d-1};\mathcal{H})=\{\mbox{all continuous maps }F: \mathbb{S}^{d-1}\rightarrow\mathcal{H}\}$, where $\mathcal{H}  =  H_0^1([0,T])$ is not only a Sobolev space (see Chapter 8.3 of \cite{brezis2011functional}) but also an RKHS$^\dagger$\footnote{$\dagger$: Strictly speaking, the functions in Sobolev space $\mathcal{H}$ are defined on the open interval $(0,T)$ instead of the closed interval $[0,T]$ (see Chapter 8.2 of \cite{brezis2011functional}). Hence, the rigorous notation of $\mathcal{H}$ should be $H_0^1((0,T))$. However, Theorem 8.8 of \cite{brezis2011functional} indicates that each function in $H_0^1((0,T))$ can be uniquely represented by a continuous function defined on $[0,T]$, which implies that functions in $H_0^1((0,T))$ can be viewed as defined on the closed interval $[0,T]$. Therefore, to implement the boundary values on $\partial (0,T)=\{0,T\}$, we use the notation $H_0^1([0,T])$ throughout this paper to indicate that all functions in $\mathcal{H}$ are viewed as defined on $[0,T]$. The same reasoning is applied for the space $W_0^{1,p}([0,T])$ implemented later in this paper (see Theorem 8.8 and the Remark 8 after Proposition 8.3 in \cite{brezis2011functional}).}. We further construct a probability space to model the distributions of shapes. This probability space makes SECT an $\mathcal{H}$-valued random field indexed by $\mathbb{S}^{d-1}$ with continuous paths, which is equivalent to that SECT being a $C(\mathbb{S}^{d-1};\mathcal{H})$-valued random variable. Additionally, the restriction of the SECT to any point on $\mathbb{S}^{d-1}$ is a real-valued stochastic process with paths in $\mathcal{H}$. Based on the proposed probability space, we provide an assumption on the moments of the SECT and define the form of its mean and covariance. Using a Sobolev embedding result and functional analysis arguments, we show some properties of the mean and covariance for the SECT. These properties allow us to develop the Karhunen–Loève expansion of the SECT, which is the key tool for our proposed hypothesis testing framework.

Traditionally, the statistical inference of shapes in TDA is conducted in persistent diagram space $\mathscr{D}$, which is not suitable for exponential family-based distributions and requires any corresponding statistical inference to be highly nonparametric. For example, \cite{fasy2014confidence} used subsampling, and \cite{robinson2017hypothesis} applied permutation tests. The PHT-based statistical inference in $C(\mathbb{S}^{d-1};\mathscr{D}^d)$ is even more difficult. With the Karhunen–Loève expansion of the SECT and the central limit theorem, some hypotheses on the distributions of shapes can be tested using the normal distribution-based methods (e.g., the adaptive Neyman test \citep{fan1996test} and the $\chi^2$-test). We will provide the details of these methods in Section \ref{section: hypothesis testing}.

One can use a morphology example from \cite{turner2014persistent} to illustrate a potential application of SECT-based hypothesis testing. The study of variation of complex traits and phenotypes is fundamental to understanding hypotheses in evolutionary biology. Suppose we observe heel bones from two groups of primates (i.e., heel bones $\{K_i^{(j)}\}_{i=1}^n$ are from the $j$-th group for $j\in\{1,2\}$). For each group $j$, suppose the underlying distribution of statistics $\{SECT(K_i^{(j)})\}_{i=1}^n$ is $\mathbf{P}^{(j)}$, and $\mathbf{P}^{(j)}$ is a probability meansure on space $C(\mathbb{S}^{d-1};\mathcal{H})$. Then, assessing the evolutionary biological question of ``whether the two groups of primates are of different species" may be boiled down to testing the hypotheses $H_0$: ``$\mathbf{P}^{(1)}$ and $\mathbf{P}^{(2)}$ have the same mean" vs. $H_1$: ``$\mathbf{P}^{(1)}$ and $\mathbf{P}^{(2)}$ do not have the same mean" (the rigorous definition of ``the mean of $\mathbf{P}^{(j)}$" and the rigorous version of the hypotheses will be provided in Section \ref{section: distributions of H-valued GP} and Eq.~\eqref{eq: the main hypotheses}, respectively, of this paper).

\subsection{Relevant Notation and Paper Organization}

Throughout this paper, a ``shape" refers to a triangulable subset of $\mathbb{R}^d$ defined as follows.
\begin{definition}\label{def: finite triangularization}
(i) Let $K$ be a subset of $\mathbb{R}^d$. If there exists a finite simplicial complex $S$ such that the corresponding polygon $\vert S\vert=\bigcup_{s\in S}s$ is homeomorphic to $K$, we say $K$ is triangulable. (ii) Let $\mathscr{S}_d$ denote the collection of all triangulable subsets of $\mathbb{R}^d$.
\end{definition}
\noindent The definitions of simplicial complexes and triangulable spaces can be found in \cite{munkres2018elements}. The triangulability assumption is standard in the TDA literature (e.g., \cite{cohen2010lipschitz} and \cite{turner2014persistent}). Throughout this paper, we apply the following:
\begin{enumerate}
\item All the linear spaces are defined with respect to field $\mathbb{R}$. For any normed space $\mathcal{V}$, let $\Vert\cdot\Vert_{\mathcal{V}}$ denote its norm. Let $\Vert x\Vert$ denote the Euclidean norm if $x$ is a finite-dimensional vector.

\item Let $X$ be a compact metric space equipped with metric $d_X$ and let $\mathcal{V}$ denote a normed space. $C(X;\mathcal{V})$ is the collection of all continuous maps from $X$ to $\mathcal{V}$. Furthermore, $C(X;\mathcal{V})$ is a normed space equipped with the norm
\begin{align*}
    \Vert f\Vert_{C(X;\mathcal{V})}  =  \sup_{x\in X}\Vert f(x)\Vert_{\mathcal{V}}.
\end{align*}
The Hölder space $C^{0,\frac{1}{2}}(X;\mathcal{V})$ is defined as
\begin{align*}
    \left\{f\in C(X;\mathcal{V}) \Bigg\vert \sup_{x,y\in X,\, x\ne y}\left(\frac{\Vert f(x)-f(y)\Vert_{\mathcal{V}}}{\sqrt{d_X(x,y)}}\right)<\infty\right\}.
\end{align*}
Here, $C^{0,\frac{1}{2}}(X;\mathcal{V})$ is a normed space equipped with the norm
\begin{align*}
    \Vert f\Vert_{C^{0,\frac{1}{2}}(X;\mathcal{V})}  =  \Vert f\Vert_{C(X;\mathcal{V})}+\sup_{x,y\in X,\, x\ne y}\left(\frac{\Vert f(x)-f(y)\Vert_{\mathcal{V}}}{\sqrt{d_X(x,y)}}\right).
\end{align*}
Obviously, $C^{0,\frac{1}{2}}(X;\mathcal{V})\subset C(X;\mathcal{V})$. For simplicity, we denote $C(X)  =  C(X;\mathbb{R})$ and $C^{0,\frac{1}{2}}(X)  =  C^{0,\frac{1}{2}}(X;\mathbb{R})$ (see Chapter 5.1 of \cite{evans2010partial}). For a given $T>0$ (see Eq.~\eqref{eq: def of sublevel sets}), we denote the separable Banach space $C([0,T])$ as $\mathcal{B}$.

\item All derivatives implemented in this paper are \textit{weak derivatives} (defined in Chapter 5.2.1 of \cite{evans2010partial}). The inner product of $\mathcal{H}  =  H_0^1([0,T])$, where $\mathcal{H}$ is a separable Hilbert space (see Chapter 8.3 of \cite{brezis2011functional}), is defined as
\begin{align*}
    \langle f, g \rangle_{\mathcal{H}} = \int_0^T f'(t) g'(t) dt.
\end{align*}
Unless otherwise stated, the inner product $\langle\cdot,\cdot\rangle$ denotes $\langle\cdot,\cdot\rangle_{\mathcal{H}}$ for simplicity.

\item Suppose $(X, d_X)$ is a metric space. $\mathscr{B}(X)$ and $\mathscr{B}(d_X)$ denote the Borel algebra generated by the metric topology corresponding to $d_X$.
\end{enumerate}
The following inequalities are also useful for deriving many results presented in this paper
\begin{align}\label{eq: Sobolev embedding from Morrey}
    \Vert f\Vert_{\mathcal{B}}\le \Vert f\Vert_{C^{0,\frac{1}{2}}([0,T])}\le \Tilde{C}_T  \Vert f\Vert_{\mathcal{H}}, \ \ \mbox{ for all }f\in\mathcal{H},
\end{align}
where $\Tilde{C}_T $ is a constant depending only on $T$. The first inequality in Eq.~\eqref{eq: Sobolev embedding from Morrey} results from the definition of $\Vert\cdot\Vert_{\mathcal{B}}$ and $\Vert\cdot\Vert_{C^{0,\frac{1}{2}}([0,T])}$, while the second inequality is from \cite{evans2010partial} (Theorem 5 of Chapter 5.6). Eq.~\eqref{eq: Sobolev embedding from Morrey} further implies the following embeddings
\begin{align}\label{eq: H, Holder, B embeddings}
    H_0^1([0,T]) = \mathcal{H} \subset C^{0,\frac{1}{2}}([0,T]) \subset \mathcal{B} = C([0,T]).
\end{align}
The algebraic topology concepts referred to in this paper (e.g., Betti numbers, homology groups, and homotopy equivalence) can be found in \cite{hatcher2002algebraic} and \cite{munkres2018elements}.

We organize this paper as follows. In Section \ref{SECTs and Their Gaussian Distributions}, we provide a collection of shapes and show that the SECT is well defined for elements in this collection. Additionally, we provide several properties of the SECT using Sobolev and Hölder spaces. These properties will be necessary, in later sections, for developing the probability theory of both the SECT and SECT-based hypothesis testing. In Section \ref{section: distributions of Gaussian bridge}, we construct a probability space for modeling the distributions of shapes. Based on this probability space, we model the SECT as a $C(\mathbb{S}^{d-1};\mathcal{H})$-valued random variable. Then, we define the mean and covariance of the SECT. In Section \ref{section: hypothesis testing}, we propose the Karhunen–Loève expansion of the SECT based on the mean and covariance defined in Section \ref{section: distributions of Gaussian bridge}, and this expansion leads to a normal distribution-based statistic for testing hypotheses on the distributions of shapes. In Section \ref{section: Simulation experiments}, we provide simulation studies showing the performance of the proposed hypothesis testing approach. In Section \ref{Conclusions and Discussions}, we conclude this paper and propose several relevant topics for future research. The Appendix in the Supplementary Material \citep{meng2022supplementary} provides the necessary mathematical tools for this paper. To avoid distraction from the main flow of the paper, unless otherwise stated, the proof of each theorem is in the Appendix.

\section{The Smooth Euler Characteristic Transform of Shapes}\label{SECTs and Their Gaussian Distributions}

In this section, we give the background on the smooth Euler characteristic transform (SECT) and propose corresponding mathematical foundations under the assumption that shapes are deterministic.

\subsection{The Definition of Smooth Euler Characteristic Transform}\label{The Definition of Smooth Euler Characteristic Transform}

We assume $K\subset \overline{B(0,R)}   =   \{x\in\mathbb{R}^d:\Vert x\Vert\le R\}$ which denotes a closed ball centered at the origin with some radius $R>0$. For each direction $\nu\in\mathbb{S}^{d-1}$, we define a collection of sublevel sets of $K$ by
\begin{align}\label{eq: def of sublevel sets}
    K_t^\nu  \overset{\operatorname{def}}{=}  \left\{x\in K\vert x\cdot\nu \le t-R \right\},\ \ \mbox{ for all } t\in[0,T],\ \ \mbox{ where }T  =  2R.
\end{align}
We then have the following Euler characteristic curve (ECC) in direction $\nu$
\begin{align}\label{Eq: first def of Euler characteristic curve}
    \chi_t^{\nu}(K)&  \overset{\operatorname{def}}{=}  \mbox{ the Euler characteristic of }K_{t}^\nu = \chi (K^\nu_t) = \sum_{k=0}^{d-1} (-1)^{k}\cdot\beta_k(K_t^\nu),
\end{align}
for $t\in[0,T]$, where $\beta_k(K_t^\nu)$ is the $k$-th Betti number of $K_t^\nu$. The Euler characteristic transform (ECT) defined as $ECT(K): \mathbb{S}^{d-1} \rightarrow \mathbb{Z}^{[0,T]}, \nu \mapsto \{\chi_{t}^\nu(K)\}_{t\in[0,T]}$ was first proposed by \cite{turner2014persistent} as an alternative to the PHT. Based on the ECT, \cite{crawford2020predicting} further proposed the SECT as follows
\begin{align}\label{Eq: definition of SECT}
\begin{aligned}
    & SECT(K): \ \ \mathbb{S}^{d-1}\rightarrow\mathbb{R}^{[0,T]},\ \ \ \nu \mapsto SECT(K)(\nu)  =  \left\{SECT(K)(\nu;t) \right\}_{t\in[0,T]}, \\
    & \mbox{ where}\ \  SECT(K)(\nu;t) \overset{\operatorname{def}}{=} \int_0^t \chi_{\tau}^\nu(K) d\tau-\frac{t}{T}\int_0^T \chi_{\tau}^\nu(K)d\tau.
\end{aligned}
\end{align}
In order for the integrals in Eq.~\eqref{Eq: definition of SECT} to be well-defined, we need to introduce additional conditions. We first propose the following concept motivated by \cite{cohen2007stability}.
\begin{definition}\label{def: HCP and tameness}
Suppose $K\in\mathscr{S}_d$ and $K\subset\overline{B(0,R)}$. (i) If $K^\nu_{t^*}$ is not homotopy equivalent to $K^\nu_{t^*-\delta}$ for any $\delta>0$, we call $t^*\in[0,T]$ a homotopy critical point (HCP) of $K$ in direction $\nu$. (ii) If $K$ has finite HCPs in every direction $\nu\in\mathbb{S}^{d-1}$, we call $K$ tame.
\end{definition}

\noindent Because the Euler characteristic is homotopy invariant, for each $\nu\in \mathbb{S}^{d-1}$, the ECC $\chi^\nu_t(K)$ is a step function of $t$ with finite discontinuities, and hence measurable, if $K$ is tame. These discontinuities are the HCPs of $K$ in direction $\nu$. We may refine the definition of the ECC $\{\chi_{t}^\nu(K)\}_{t\in[0,T]}$ in Eq.~\eqref{Eq: first def of Euler characteristic curve} as follows: for a tame $K\in\mathscr{S}_d$, define $\chi_t^\nu(K)  =  \chi(K_t^\nu)$ if $t$ is not an HCP in direction $\nu$, and $\chi_t^\nu(K)  =  \lim_{t'\rightarrow t+}\chi_{t'}^\nu(K)$ if $t$ is an HCP in direction $\nu$. Under these conditions, $\{\chi_{t}^\nu(K)\}_{t\in[0,T]}$ is a right continuous with left limits (RCLL) function and has finite discontinuities. We can define $k$-th Betti number curves $\{\beta_k(K_t^{\nu})\}_{t\in[0,T]}$ to be RCLL functions of $t\in[0,T]$ in the same way. To investigate $SECT(K)$ across shapes $K$, especially the distribution of $SECT(K)$ across $K$, we need the following condition (needed in the proofs of several theorems in this paper) for tame shapes $K\subset\overline{B(0,R)}$ to restrict our attention to a specific subset of $\mathscr{S}_d$
\begin{align}\label{Eq: topological invariants boundedness condition}
    \sup_{k\in\{0,\cdots,d-1\}}\left[\sup_{\nu\in\mathbb{S}^{d-1}}\left(\#\Big\{\xi\in \operatorname{Dgm}_k(K;\phi_{\nu}) \, \Big\vert \, \operatorname{pers}(\xi)>0\Big\}\right)\right] \le\frac{M}{d},
\end{align}
where $\operatorname{Dgm}_k(K;\phi_{\nu})$ is a PD, $\operatorname{pers}(\xi)$ is the persistence of the homology feature $\xi$, $\#\{\cdot\}$ denotes the cardinality of a multiset, and $M>0$ is allowed to be any sufficiently large fixed number. To avoid distraction from the main flow of the paper, we save the details of condition \eqref{Eq: topological invariants boundedness condition} and the definitions of $\operatorname{Dgm}_k(K;\phi_{\nu})$ and $\operatorname{pers}(\xi)$ for the Appendix \ref{The Relationship between PHT and SECT}. A heuristic interpretation of condition \eqref{Eq: topological invariants boundedness condition} is that there exists a uniform upper bound for the numbers of nontrivial homology features of shape $K$ across all levels $t$ and directions $\nu$ (see Theorem \ref{thm: boundedness topological invariants theorem} below). This condition is usually satisfied in medical imaging studies (e.g., a tumor has finitely many connected components and cavities across all levels and directions). Condition \eqref{Eq: topological invariants boundedness condition} is needed in the proofs of several theorems in this paper, particularly Theorem \ref{lemma: The continuity lemma}. Throughout this paper, we focus on shapes in the following collection
\begin{align*}
    \mathscr{S}_{R,d}^M \overset{\operatorname{def}}{=} \left\{K \in\mathscr{S}_d \big\vert K\subset\overline{B(0,R)},\ \ K \mbox{ is tame and satisfies condition (\ref{Eq: topological invariants boundedness condition}) with fixed }M>0 \right\}.
\end{align*}
Before Appendix \ref{The Relationship between PHT and SECT}, we only need the following boundedness derived from condition (\ref{Eq: topological invariants boundedness condition}).
\begin{theorem}\label{thm: boundedness topological invariants theorem}
For any $K\in\mathscr{S}_{R,d}^M$, we have the following bounds:\\ (i) $\sup_{\nu\in\mathbb{S}^{d-1}}\left[\sup_{0\le t\le T}\left(\sup_{k\in\{0,\cdots,d-1\}}\beta_k(K_t^{\nu})\right)\right] \le M/d$, and \\ (ii) $\sup_{\nu\in\mathbb{S}^{d-1}}\left(\sup_{0\le t\le T}\left\vert\chi_{t}^\nu(K)\right\vert\right) \le M$.
\end{theorem}

The tameness of $K$ and boundedness of $\chi^\nu_t(K)$ in Theorem \ref{thm: boundedness topological invariants theorem} guarantee that, for each fixed direction $\nu\in\mathbb{S}^{d-1}$, an ECC $\chi^\nu_{(\cdot)}(K)$ is a measurable and bounded function. Therefore, the integrals in Eq.~\eqref{Eq: definition of SECT} are well defined Lebesgue integrals. Since $\{\chi_{t}^\nu(K)\}_{t\in[0,T]}\in L^1([0,T])$, $SECT(K)(\nu)$ is absolutely continuous on $[0,T]$. Furthermore, we have the following regularity result of the Sobolev type on $SECT(K)(\nu)$ defined in Eq.~\eqref{Eq: definition of SECT}.
\begin{theorem}\label{thm: Sobolev function paths}
For any $K\in\mathscr{S}_{R,d}^M$ and $\nu\in\mathbb{S}^{d-1}$, we have the following:\\
(i) Function $\{\int_0^t \chi_\tau^\nu(K) d\tau\}_{t\in[0,T]}$ has its first-order weak derivative $\{ \chi_t^\nu(K) \}_{t\in[0,T]}$;\\ (ii) $SECT(K)(\nu)\in W^{1,p}_0([0,1]) \subset \mathcal{B}$ for all $p\in[1,\infty)$.
\end{theorem}
\noindent Here, $W^{1,p}_0([0,T])$ is a Sobolev space defined by the following (see the Theorem 8.12 of \cite{brezis2011functional} for this specific definition)
\begin{align*}
    W^{1,p}_0([0,T])  =  \Big\{f\in L^p([0,T]) \, \Big\vert \, \mbox{weak derivative }f' \mbox{ exists, }f'\in L^p([0,T]), \mbox{ and }f(0)=f(T)=0\Big\}
\end{align*}
The special case when $p=2$ in Theorem \ref{thm: Sobolev function paths} is of importance, as $\mathcal{H}=H_0^1([0,T])=W^{1,2}_0([0,T])$ is the RKHS reproduced by the following kernel
\begin{align}\label{Eq: kernel of the Brownian bridge}
    \kappa(s,t)  =  \min\{s,t\}-\frac{st}{T}, \ \mbox{ for all }s,t\in[0,T],
\end{align}
which is the covariance function of the Brownion bridge on $[0,T]$ (see Example 4.9 of \cite{lifshits2012lectures}). The relationship between $\mathcal{H}$ and $\kappa(s,t)$ from the RKHS perspective implies that $\langle \kappa(t,), f \rangle = f(t)$ for all $f\in\mathcal{H}$ and $t\in[0,T]$. This result plays an important role later in this paper. The case when $p=2$ in Theorem \ref{thm: Sobolev function paths} indicates that $SECT(\mathscr{S}_{R,d}^M) \subset \mathcal{H}^{\mathbb{S}^{d-1}}  =  \{\mbox{all maps }F:\mathbb{S}^{d-1}\rightarrow\mathcal{H}\}$, which is enhanced by the following theorem.
\begin{theorem}\label{lemma: The continuity lemma}
For each $K\in\mathscr{S}_{R,d}^M$, we have the following:\\
(i) There exists a constant $C^*_{M,R,d}$ depending only on $M$, $R$, and $d$ such that the following two inequalities hold for any two directions $\nu_1,\nu_2\in\mathbb{S}^{d-1}$,
\begin{align}\label{Eq: continuity inequality}
    & \left( \int_0^T \Big\vert\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\vert^2 d\tau \right)^{1/2} \le C^*_{M,R,d} \cdot \sqrt{\Vert \nu_1-\nu_2\Vert}, \\
    \notag & \Big\Vert SECT(K)(\nu_1) - SECT(K)(\nu_2)\Big\Vert_{\mathcal{H}} \le C^*_{M,R,d} \cdot \sqrt{ \Vert \nu_1 - \nu_2\Vert + \Vert
    \nu_1-\nu_2 \Vert^2 }.
\end{align}
(ii) $SECT(K) \in C^{0,\frac{1}{2}}(\mathbb{S}^{d-1};\mathcal{H})$, where $\mathbb{S}^{d-1}$ is equipped with the geodesic distance $d_{\mathbb{S}^{d-1}}$.\\
(iii) The constant $\Tilde{C}_T$ in Eq.~\eqref{eq: Sobolev embedding from Morrey} provides the following inequality
\begin{align}\label{eq: bivariate Holder continuity}
    \begin{aligned}
        & \Big\vert SECT(K)(\nu_1; t_1)-SECT(K)(\nu_2; t_2)\Big\vert\\
    & \le \Tilde{C}_T \left\{\Vert SECT\Vert_{C(\mathbb{S}^{d-1};\mathcal{H})}\cdot \sqrt{\vert t_1-t_2\vert} + C^*_{M,R,d} \cdot \sqrt{ \Vert \nu_1 - \nu_2\Vert + \Vert
    \nu_1-\nu_2 \Vert^2 } \right\},
    \end{aligned}
\end{align}
for all $\nu_1, \nu_2\in\mathbb{S}^{d-1}$ and $t_1, t_2\in[0,T]$, which implies that $(\nu,t)\mapsto SECT(K)(\nu;t)$, as a function on $\mathbb{S}^{d-1}\times[0,T]$, belongs to $C^{0,\frac{1}{2}}(\mathbb{S}^{d-1}\times[0,T];\mathbb{R})$.
\end{theorem}
\noindent Theorem \ref{lemma: The continuity lemma} (i) is a counterpart of the Lemma 2.1 in \cite{turner2014persistent} and is derived using ``bottleneck stability" (see \cite{cohen2007stability}). Additionally, Theorem \ref{lemma: The continuity lemma} (i) is implemented in the proof of Theorem \ref{lemma: The continuity lemma} (ii) and will be used in Section \ref{The Primitive Euler Characteristic Transform of Shapes}. Furthermore, Theorem \ref{lemma: The continuity lemma} (ii) guarantees that $SECT(\mathscr{S}_{R,d}^M) \subset C^{0,\frac{1}{2}}(\mathbb{S}^{d-1}; \mathcal{H}) \subset C(\mathbb{S}^{d-1}; \mathcal{H}) \subset \mathcal{H}^{\mathbb{S}^{d-1}}$. As a result, Eq.~\eqref{Eq: definition of SECT} defines the following map
\begin{align}\label{Eq: final def of SECT}
    SECT: \mathscr{S}_{R,d}^M \rightarrow C(\mathbb{S}^{d-1}; \mathcal{H}),\ \ \ K \mapsto \left\{SECT(K)(\nu)\right\}_{\nu\in\mathbb{S}^{d-1}} \overset{\operatorname{def}}{=} SECT(K).
\end{align}
Theorem \ref{lemma: The continuity lemma} (iii) will be implemented in the mathematical foundation of the hypothesis testing in Section \ref{section: hypothesis testing} (specifically, see Theorems \ref{thm: lemma for KL expansions} and \ref{thm: KL expansions of SECT}).

Corollary 6 of \cite{ghrist2018persistent} implies the following result, which shows that the map in Eq.~\eqref{Eq: final def of SECT} preserves all the information of shapes $K\in \mathscr{S}_{R,d}^M$.
\begin{theorem}\label{thm: invertibility}
The map $SECT$ defined in Eq.~\eqref{Eq: final def of SECT} is invertible for all dimensions $d$.
\end{theorem}
\noindent Together with Eq.~\eqref{Eq: final def of SECT}, Theorem \ref{thm: invertibility} enables us to view each shape $K\in\mathscr{S}_{R,d}^M$ as $SECT(K)$ which is an element of $C(\mathbb{S}^{d-1}; \mathcal{H})$. This viewpoint will help us characterize the randomness of shapes $K \in \mathscr{S}_{R,d}^M$ using probability measures on the separable Banach space $C(\mathbb{S}^{d-1}; \mathcal{H})$.

If the shapes of interest are represented as triangular meshes, their ECC defined in Eq.~\eqref{Eq: first def of Euler characteristic curve} can easily be computed (e.g., Section 2 of \cite{wang2021statistical}). The SECT is then derived directly from the computed ECC (see Eq.~\eqref{Eq: definition of SECT}). In Appendix \ref{section: Computation of SECT Using the Čech Complexes}, we briefly introduce an approach for approximating the ECC of shapes in $\mathbb{R}^d$ in scenarios where the triangular mesh representation of shapes is not available, which in turn provides a corresponding approximation to SECT. This approach applies Čech complexes and the nerve theorem (see Chapter III of \cite{edelsbrunner2010computational}), which are implemented in all proof-of-concept examples and simulations throughout this paper. In addition, an approach was studied in \cite{niyogi2008finding} for finding the Betti numbers of submanifolds of Euclidean spaces from random point clouds. For the case where a point cloud is drawn near a submanifold, this approach can be applied to estimate the SECT of the submanifold. The application of \cite{niyogi2008finding} to SECT is left for future research.

\subsection{Proof-of-Concept Simulation Examples I: Deterministic Shapes}\label{Proof-of-Concept Simulation Examples I: Deterministic Shapes}

In this subsection, we compute the SECT of two simulated shapes $K^{(1)}$ and $K^{(2)}$ of dimension $d=2$. These shapes are defined as the following and presented in Figures \ref{fig: SECT visualizations, deterministic}(a) and (g), respectively:
\begin{align}\label{eq: example shapes K1 and K2}
K^{(j)}  =  \left\{x\in\mathbb{R}^2 \,\Bigg\vert \, \inf_{y\in S^{(j)}}\Vert x-y\Vert\le \frac{1}{5}\right\},\ \ \mbox{ where }j\in\{1,2\},
\end{align}
\begin{align*}
        & S^{(1)}  =  \left\{\left(\frac{2}{5}+\cos t, \sin t\right) \,\Bigg\vert \, \frac{\pi}{5}\le t\le\frac{9\pi}{5}\right\}\bigcup\left\{\left(-\frac{2}{5}+\cos t, \sin t\right) \,\Bigg\vert \, \frac{6\pi}{5}\le t\le\frac{14\pi}{5}\right\},\\
        & S^{(2)}  =  \left\{\left(\frac{2}{5}+\cos t, \sin t\right) \,\Bigg\vert \, 0\le t\le 2\pi\right\}\bigcup\left\{\left(-\frac{2}{5}+\cos t, \sin t\right) \,\Bigg\vert \, \frac{6\pi}{5}\le t\le\frac{14\pi}{5}\right\}.
\end{align*}
We compute $SECT(K^{(j)})(\nu;t)$ across direction $\nu\in\mathbb{S}^{1}$ and sublevel set $t\in[0,3]$ with $T=3$. For the following visualization, we identify each direction $\nu\in\mathbb{S}^1$ through the parametrization $\nu=(\cos\vartheta, \sin\vartheta)$ with $\vartheta\in[0,2\pi)$.
\begin{itemize}
    \item The surfaces of the bivariate maps $(\vartheta, t)\mapsto SECT(K^{(j)})(\nu;t)$, for $j\in\{1,2\}$, are presented in Figures \ref{fig: SECT visualizations, deterministic}(b), (c), (h), and (i).
    \item The curves of the univariate maps $t\mapsto SECT(K^{(j)})\left((1,0)^\intercal;t\right)$, for $j\in\{1,2\}$, are presented by the black solid lines in Figures \ref{fig: SECT visualizations, deterministic}(d) and (j); while the curves of the univariate maps $t\mapsto SECT(K^{(j)})\left((0,1)^\intercal;t\right)$, for $j\in\{1,2\}$, are presented by the black solid lines in Figures \ref{fig: SECT visualizations, deterministic}(e) and (k).
    \item Lastly, the curves of the univariate maps $\vartheta\mapsto SECT(K^{(j)})\left((\cos\vartheta, \sin\vartheta)^\intercal;\frac{3}{2}\right)$, for $j\in\{1,2\}$, are presented by the black solid lines in Figures \ref{fig: SECT visualizations, deterministic}(f) and (l).
\end{itemize}

These figures illustrate the continuity of $(\nu,t)\mapsto SECT(K^{(j)})(\nu;t)$ stated in Theorem \ref{lemma: The continuity lemma} (iii). Specifically, the curves and surfaces in these figures look not as rough as the path of Brownian motions, while they are not differentiable everywhere. With probability one, paths of a Brownian motion are not locally $C^{0,\frac{1}{2}}$-continuous (see Remark 22.4 of \cite{klenke2013probability}). Hence, based on Figure \ref{fig: SECT visualizations, deterministic}, the regularity of $(\nu,t)\mapsto SECT(K^{(j)})(\nu;t)$ is likely to be better than that of Brownian motion paths, but worse than continuously differentiable functions. Therefore, Figure \ref{fig: SECT visualizations, deterministic} supports the $C^{0,\frac{1}{2}}$-continuity in Theorem \ref{fig: SECT visualizations, deterministic}.

The invertibility in Theorem \ref{thm: invertibility} indicates that all information of $K^{(1)}$ and $K^{(2)}$ is stored in the surfaces presented by Figures \ref{fig: SECT visualizations, deterministic}(b), (c), (h), and (i). The red dashed curves in Figures \ref{fig: SECT visualizations, deterministic}(j), (k), and (l) are the counterparts of $K^{(1)}$ (see the curves in Figures \ref{fig: SECT visualizations, deterministic}(d), (e), and (f)). The discrepancy between the solid black and dashed red curves illustrates the SECT's ability to distinguish shapes. Simulation studies in Section \ref{section: Simulation experiments} will further confirm the ability of SECT in distinguishing shapes.

\begin{figure}
    \centering
    \includegraphics[scale=0.62]{SECT_visualizations.pdf}
    \caption{Visualizations of $SECT(K^{(j)})$ for $j\in\{1,2\}$, where $K^{(1)}$ and $K^{(2)}$ are defined in Eq.~\eqref{eq: example shapes K1 and K2}. Panels (b) and (c) present the same surface from different angles. Similarly, panels (h) and (i) present the same surface. The similarity between the curves in the panel (j) partially indicates that SECT in only one direction does not preserve all the geometric information of a shape.}
    \label{fig: SECT visualizations, deterministic}
\end{figure}

\subsection{The Primitive Euler Characteristic Transform of Shapes}\label{The Primitive Euler Characteristic Transform of Shapes}

In this work, we also introduce another topological invariant --- the primitive Euler characteristic transform (PECT) --- which is related to SECT and will play an important role in defining a distance function on $\mathscr{S}_{R,d}^M$. The PECT is defined as follows
\begin{align}\label{Eq: def of PECT}
\begin{aligned}
    & PECT: \ \mathscr{S}_{R,d}^M \rightarrow C(\mathbb{S}^{d-1};\mathcal{H}_{BM}),\ \ \ K \mapsto PECT(K) \overset{\operatorname{def}}{=} \{PECT(K)(\nu)\}_{\nu\in\mathbb{S}^{d-1}}, \\
    & \mbox{where }\ PECT(K)(\nu) \overset{\operatorname{def}}{=} \left\{\int_0^t \chi_\tau^\nu(K) d\tau\right\}_{t\in[0,T]},
    \end{aligned}
\end{align}
and $\mathcal{H}_{BM} \overset{\operatorname{def}}{=} \{f\in L^2([0,T]) \,\vert\, \mbox{weak derivative }f' \mbox{ exists, }f'\in L^2([0,T]), \mbox{ and }x(0)=0 \}$ is a separable Hilbert space equipped with the inner product $\langle f, g \rangle_{\mathcal{H}_{BM}}  =  \int_0^T f'(t)g'(t) dt$. In addition, $\mathcal{H}_{BM}$ is the RKHS generated by the covariance function $(s,t)\mapsto\min\{s,t\}$ of the Brownian motion on $[0,T]$. The inequality in Eq.~\eqref{Eq: continuity inequality}, together with the weak derivative of $PECT(K)(\nu)$ being $\{\chi_t^\nu(K)\}_{t\in[0,T]}$ (see Theorem \ref{thm: Sobolev function paths}), implies that
\begin{align*}
    \left\Vert PECT(K)(\nu_1)-PECT(K)(\nu_2)\right\Vert_{\mathcal{H}_{BM}}\le C^*_{M,R,d} \cdot \sqrt{\Vert \nu_1-\nu_2\Vert}.
\end{align*}
Therefore, we have the $PECT(K)\in C(\mathbb{S}^{d-1}; \mathcal{H}_{BM})$ in Eq.~\eqref{Eq: def of PECT}. PECT relates to SECT via the following equation.
\begin{align}\label{eq: relationship between PECT and SECT}
    SECT(K)(\nu;t)=PECT(K)(\nu;t)-\frac{t}{T}PECT(K)(\nu;t),
\end{align}
for all $\nu\in\mathbb{S}^{d-1}$ and $t\in[0,T]$. Additionally, Theorem \ref{thm: invertibility}, together with Eq.~\eqref{eq: relationship between PECT and SECT}, implies that the $PECT$ in Eq.~\eqref{Eq: def of PECT} is invertible.

\section{Random Shapes and Probabilistic Distributions over the SECT}\label{section: distributions of Gaussian bridge}

In Section \ref{SECTs and Their Gaussian Distributions}, shapes $K$ were viewed as deterministic. From this section onward, we investigate the randomness of shapes. Suppose now that $\mathscr{S}_{R,d}^M$ is equipped with a $\sigma$-algebra $\mathscr{F}$ and that a distribution of shapes $K$ across $\mathscr{S}_{R,d}^M$ can be represented by a probability measure $\mathbb{P}=\mathbb{P}(dK)$ on $\mathscr{F}$. Then, $(\mathscr{S}_{R,d}^M, \mathscr{F}, \mathbb{P})$ is a probability space, and it is the underlying probability space of interest.

\subsection{Formulation of the SECT as a Random Variable}\label{Distributions of SECT in Each Direction}

For each direction $\nu\in\mathbb{S}^{d-1}$ and level $t\in[0,T]$, the integer-valued map $\chi^\nu_t: K \mapsto \chi^\nu_t(K)$ is defined on $\mathscr{S}_{R,d}^M$. We need the following assumption on the measurability of $\chi_t^\nu$.

\begin{assumption}\label{assumption: the measurability of ECC}
For each fixed $\nu\in\mathbb{S}^{d-1}$ and $t\in[0,T]$, the map
\begin{align*}
    \chi^\nu_t:\, \left(\mathscr{S}^M_{R,d},\, \mathscr{F} \right) \rightarrow \left(\mathbb{R}, \, \mathscr{B}(\mathbb{R}) \right)
\end{align*}
is a real-valued random variable --- meaning that $(\chi^{\nu}_t)^{-1}(B)  =  \{K\in\mathscr{S}_{R,d}^M \, \vert \,
\chi^{\nu}_t(K)\in B\}\in\mathscr{F}$ for all $B\in\mathscr{B}(\mathbb{R})$.
\end{assumption}

\noindent A $\sigma$-algebra $\mathscr{F}$ satisfying Assumption \ref{assumption: the measurability of ECC} does exist. Specifically, we construct a metric on $\mathscr{S}_{R,d}^M$ and show that the Borel algebra induced by this metric satisfies Assumption \ref{assumption: the measurability of ECC}. Motivated by the metric of $C(\mathbb{S}^{d-1};\mathcal{H}_{BM})$, we define the semi-distance
\begin{align}\label{Eq: distance between shapes}
\begin{aligned}
    & \rho:\ \ \mathscr{S}_{R,d}^M\times \mathscr{S}_{R,d}^M \rightarrow [0,\infty),\ \ \ \ \ (K_1, K_2)\mapsto \rho(K_1, K_2), \ \ \mbox{where} \\
& \rho(K_1, K_2) \overset{\operatorname{def}}{=}  \sup_{\nu\in\mathbb{S}^{d-1}} \left\{ \left( \int_0^T \Big\vert\chi_\tau^{\nu}(K_1)-\chi_\tau^{\nu}(K_2)\Big\vert^2 d\tau \right)^{1/2} \right\}.
\end{aligned}
\end{align}
The following theorem shows that the $\rho$ defined in Eq.~\eqref{Eq: distance between shapes} is indeed a metric on $\mathscr{S}_{R,d}^M$. Furthermore, it provides an example of a $\sigma$-algebra satisfying Assumption \ref{assumption: the measurability of ECC}.
\begin{theorem}\label{Thm: metric theorem for shapes}
(i) The map $\rho$ defined in Eq.~\eqref{Eq: distance between shapes} is a metric on $\mathscr{S}_{R,d}^M$. \\
(ii) Assumption \ref{assumption: the measurability of ECC} is satisfied if $\mathscr{F}=\mathscr{B}(\rho)$.
\end{theorem}
\noindent Additionally, this $\rho$ metric is a counterpart of the $dist_{\mathcal{M}_d}$ metric in \cite{turner2014persistent} (Eq.~(2.3) therein) and the $dist^{SECT}_{\mathcal{M}_{d-1}}$ metric in \cite{crawford2020predicting} (Eq.~(7) therein).

Under Assumption \ref{assumption: the measurability of ECC}, the ECC $\{\chi^\nu_t\}_{t\in[0,T]}$, for each fixed $\nu\in\mathbb{S}^{d-1}$, is a continuous-time stochastic process with RCLL paths defined on probability space $(\mathscr{S}_{R,d}^M, \mathscr{F}, \mathbb{P})$. Since each path $\{\chi^\nu_t(K)\}_{t\in[0,T]}$ is a step function with finitely many discontinuities, the integrals $\int_0^t \chi_\tau^\nu(K) d\tau$ for $t\in[0,T]$ are Riemann integrals of the form
\begin{align}\label{Eq: Riemann sum}
    \int_0^t \chi_\tau^\nu(K) d\tau = \lim_{n\rightarrow\infty} \left\{\frac{t}{n} \sum_{l=1}^n \chi^\nu_{\frac{tl}{n}}(K)\right\}, \ \mbox{ for all }K\in\mathscr{S}_{R,d}^M.
\end{align}
Because each $\chi^\nu_{\frac{tl}{n}}$ in Eq.~\eqref{Eq: Riemann sum} is a random variable under Assumption \ref{assumption: the measurability of ECC}, the limit in Eq.~\eqref{Eq: Riemann sum} for each fixed $t\in[0,T]$ is a random variable as well. Therefore, for each fixed $\nu\in\mathbb{S}^{d-1}$, $\{\int_0^t \chi_\tau^\nu d\tau\}_{t\in[0,T]}$ with $\int_0^t \chi_\tau^\nu d\tau: K \mapsto \int_0^t \chi_\tau^\nu(K) d\tau$ is a real-valued stochastic process with continuous paths. Then, under Assumption \ref{assumption: the measurability of ECC}, Eqs.~\eqref{Eq: definition of SECT} and \eqref{Eq: def of PECT} define the following real-valued stochastic processes on the probability space $(\mathscr{S}_{R,d}^M, \mathscr{F}, \mathbb{P})$
\begin{align}\label{Eq: def SECTs as stochastic processes}
\begin{aligned}
    & SECT(\cdot)(\nu) \overset{\operatorname{def}}{=} \left\{\int_0^t\chi_\tau^\nu d\tau - \frac{t}{T} \int_0^T \chi_\tau^\nu d\tau   \overset{\operatorname{def}}{=} SECT(\cdot)(\nu;t) \right\}_{t\in[0,T]}, \\
    & PECT(\cdot)(\nu) \overset{\operatorname{def}}{=} \left\{\int_0^t \chi_\tau^\nu d\tau \overset{\operatorname{def}}{=} PECT(\cdot)(\nu;t)\right\}_{t\in[0,T]}.
    \end {aligned}
\end{align}
Eq.~\eqref{eq: relationship between PECT and SECT} indicates that $SECT(\cdot)(\nu)$ is the ``bridge version"$^\ddagger$\footnote{$\ddagger$: Motivated by Brownian bridges, for any stochastic process $\{X_t\}_{t\in[0,T]}$ with continuous paths and $X_0=0$, we refer to $\{U_t  =  X_t-\frac{t}{T}X_T\}_{t\in[0,T]}$ as its bridge version.} of $PECT(\cdot)(\nu)$. Theorem \ref{thm: Sobolev function paths}, together with \cite{berlinet2011reproducing} (see Corollary 13 in Chapter 4 therein), directly implies the following theorem; hence, the corresponding proof is omitted.
\begin{theorem}\label{thm: SECT distribution theorem in each direction}
For each direction $\nu\in\mathbb{S}^{d-1}$, under Assumption \ref{assumption: the measurability of ECC}, $SECT(\cdot)(\nu)$ is a real-valued stochastic process with paths in $\mathcal{H}$. Equivalently, $SECT(\cdot)(\nu)$ is a random variable taking values in $(\mathcal{H}, \mathscr{B}(\mathcal{H}))$. Additionally, $SECT(\cdot)(\nu;0)=SECT(\cdot)(\nu;T)=0$.
\end{theorem}

\subsection{Mean and Covariance of the SECT}\label{section: distributions of H-valued GP}

Theorem \ref{thm: SECT distribution theorem in each direction} indicates that the SECT is an $\mathcal{H}$-valued random field on manifold $\mathbb{S}^{d-1}$. Theorem \ref{lemma: The continuity lemma} implies that the sample paths of this random field are in $C^{0,\frac{1}{2}}(\mathbb{S}^{d-1};\mathcal{H})$. To define the mean and covariance for the SECT, we need the following assumption on the second moments corresponding to the distribution $\mathbb{P}$.

\begin{assumption}\label{assumption: existence of second moments}
We have the following finite second moments for all $\nu\in\mathbb{S}^{d-1}$
\begin{align*}
    \mathbb{E}\Vert SECT(\cdot)(\nu)\Vert^2_{\mathcal{H}}=\int_{\mathscr{S}_{R,d}^M}\Vert SECT(K)(\nu)\Vert^2_{\mathcal{H}}\mathbb{P}(dK)<\infty.
\end{align*}
\end{assumption}
\noindent Together, Eq.~\eqref{eq: Sobolev embedding from Morrey} and Assumption \ref{assumption: existence of second moments} imply that
\begin{align}\label{eq: finite second moments for all v and t}
    \mathbb{E}\vert SECT(\cdot)(\nu;t)\vert^2 \le \Tilde{C}^2_T \cdot \mathbb{E}\Vert SECT(\cdot)(\nu)\Vert^2_{\mathcal{H}}<\infty,\ \ \mbox{ for all }\nu\mbox{ and }t.
\end{align}
Therefore, we may define the mean function $\{m\}_{\nu\in\mathbb{S}^{d-1}}$ as follows under Assumption \ref{assumption: existence of second moments}
\begin{align}\label{Eq: mean function of our Gaussian bridge}
    \begin{aligned}
        m_\nu(t) &  =  \mathbb{E}\left\{ SECT(\cdot)(\nu;t) \right\}\\
    & =\int_{\mathscr{S}_{R,d}^M}\left\{ \int_0^t\chi_\tau^\nu(K) d\tau - \frac{t}{T} \int_0^T \chi_\tau^\nu(K) d\tau\right\} \mathbb{P}(dK),\ \ t\in[0,T].
    \end{aligned}
\end{align}
The next theorem is crucial for defining the covariance of the SECT as well as for conducting the hypothesis testing framework that we will detail in Section \ref{section: hypothesis testing}.
\begin{theorem}\label{thm: mean is in H}
(i) For each fixed direction $\nu\in\mathbb{S}^{d-1}$, the real-valued function $m_\nu \overset{\operatorname{def}}{=} \{m_\nu(t)\}_{t\in[0,T]}$ of $t$ belongs to $\mathcal{H}$; hence, $SECT(K)(\nu)-m_\nu \in\mathcal{H}$ for all $K\in\mathscr{S}_{R,d}^M$. \\ (ii) The map $(K, t)\mapsto SECT(K)(\nu;t)$ belongs to $L^2(\mathscr{S}_{R,d}^M\times[0,T],\, \mathbb{P}(dK)\times dt)$, where $\mathbb{P}(dK)\times dt$ denotes the product measure generated by $\mathbb{P}(dK)$ and the Lebesgue measure $dt$. \\
(iii) The map $\nu\mapsto m_\nu$ belongs to $C^{0,\frac{1}{2}}(\mathbb{S}^{d-1};\mathcal{H})$; hence, this map belongs to $C(\mathbb{S}^{d-1};\mathcal{H})$.
\end{theorem}
\noindent As an analog to the covariance of Gaussian measures on separable Banach spaces (see \cite{hairer2009introduction}, Eq.~(3.1) therein), the covariance of the SECT is defined as a linear map $C(\nu_1, \nu_2):\mathcal{H}\rightarrow\mathcal{H}$ via the following equation
\begin{align}\label{eq: covariance of random field}
    \begin{aligned}
        & \Big\langle h_1, C(\nu_1, \nu_2) h_2 \Big\rangle \\
        & \overset{\operatorname{def}}{=} \mathbb{E} \left\{\Big\langle h_1, SECT(\cdot)(\nu_1)-m_{\nu_1} \Big\rangle\cdot\Big\langle h_1, SECT(\cdot)(\nu_2)-m_{\nu_2} \Big\rangle\right\},
    \end{aligned}
\end{align}
for all $h_1, h_2\in\mathcal{H}$. Eq.~\eqref{eq: covariance of random field} is well-defined because of the first statement in Theorem \ref{thm: mean is in H} and the following inequalities induced by Assumption \ref{assumption: existence of second moments}
\begin{align*}
    & \mathbb{E} \left\vert\Big\langle h_1, SECT(\cdot)(\nu_1)-m_{\nu_1} \Big\rangle\cdot\Big\langle h_1, SECT(\cdot)(\nu_2)-m_{\nu_2} \Big\rangle\right\vert \\
    & \le \Vert h_1\Vert_{\mathcal{H}}\Vert h_2\Vert_{\mathcal{H}} \cdot \Big(\mathbb{E}\Vert SECT(\cdot)(\nu_1)-m_{\nu_1}\Vert^2_{\mathcal{H}}\Big)^{1/2} \Big(\mathbb{E}\Vert SECT(\cdot)(\nu_2)-m_{\nu_2}\Vert^2_{\mathcal{H}}\Big)^{1/2} <\infty,
\end{align*}
which further indicate that $C(\nu_1, \nu_2)$ is a bounded linear operator.

Because of the finite second moments in Eq.~\eqref{eq: finite second moments for all v and t}, the covariance function
\begin{align*}
    \Xi_\nu(s,t)  =  cov\left(SECT(\cdot)(\nu;s), SECT(\cdot)(\nu;t)\right),\ \ \mbox{ for }s,t\in[0,T],
\end{align*}
is well-defined. The real-valued covariance $\Xi_\nu(s,t)$ is determined by the operator-valued covariance $C(\nu,\nu)$ via the following
\begin{align}\label{eq: relationship between operator-valued cov and real-valued cov}
    \begin{aligned}
        \Xi_\nu(s,t) &=\mathbb{E} \left\{\Big\langle \kappa(s,\cdot), SECT(\cdot)(\nu)-m_{\nu} \Big\rangle\cdot\Big\langle \kappa(t,\cdot), SECT(\cdot)(\nu)-m_{\nu} \Big\rangle\right\} \\
    & = \Big\langle \kappa(s,\cdot), C(\nu, \nu) \kappa(t,\cdot) \Big\rangle,\ \ \mbox{ for all }\nu\in\mathbb{S}^{d-1},
    \end{aligned}
\end{align}
where the first identity follows from the fact that $\kappa$ as defined in Eq.~\eqref{Eq: kernel of the Brownian bridge} is the reproducing kernel of RKHS $\mathcal{H}$. The following theorem on the covariance function $\Xi_\nu(s,t)$ will be implemented in Section \ref{section: hypothesis testing}.
\begin{theorem}\label{thm: lemma for KL expansions}
For each fixed direction $\nu\in\mathbb{S}^{d-1}$, we have the following: (i) $SECT(\cdot)(\nu)$ is mean-square continuous (i.e., $\lim_{\epsilon\rightarrow0}\mathbb{E}\vert SECT(\cdot)(\nu;t+\epsilon)-SECT(\cdot)(\nu;t)\vert^2=0$); \\
(ii) $(s,t)\mapsto\Xi_\nu(s,t)$ is continuous on $[0,T]^2$.
\end{theorem}
\noindent The first part of Theorem \ref{thm: lemma for KL expansions} directly follows from Eq.~\eqref{eq: bivariate Holder continuity}, while the second half follows from Lemma 4.2 of \cite{alexanderian2015brief}; hence, the proof of Theorem \ref{thm: lemma for KL expansions} is omitted.

In applications, we cannot reasonably sample infinitely many directions $\nu\in\mathbb{S}^{d-1}$ and levels $t\in[0,T]$. For each given shape $K$, we can only compute $SECT(K)(\nu;t)$ for finitely many directions $\{\nu_1, \cdots, \nu_\Gamma\}\subset\mathbb{S}^{d-1}$ and levels $\{t_1, \cdots, t_\Delta\}\subset[0,T]$ with $t_1<t_2<\cdots<t_\Delta$. Hence, for a collection of shapes $\{K_i\}_{i=1}^n \subset \mathscr{S}_{R,d}^M$ sampled from $\mathbb{P}$, the data we have in applications are presented by the following 3-dimensional arrays
\begin{align}\label{Eq: data matrix}
    \Big\{\ SECT(K_i)(\nu_p, t_q)\ \Big\vert\ i=1,\cdots,n,\ p=1,\cdots, \Gamma, \mbox{ and }q=1, \cdots, \Delta\ \Big\}.
\end{align}

To preserve as much information about a shape $K$ as possible, we need to make the numbers of directions and levels (i.e., $\Gamma$ and $\Delta$ in Eq.~\eqref{Eq: data matrix}) sufficiently large. \cite{curry2018many} (Theorem 7.14 therein) provided an explicit formula of the upper bound on the minimal number of directions. Levels $\{t_j\}_{j=1}^\Delta$ should be sufficiently dense such that there is at least one $t_j$ between any two consecutive HCPs in each direction.

\subsection{Proof-of-Concept Simulation Examples II: Random Shapes}

In this subsection, we compute the SECT for a collection of shapes $\{K_i\}_{i=1}^n$ of dimension $d=2$. These shapes are randomly generated as follows
\begin{align}\label{eq: randon shapes under null}
        K_i  = & \left\{x\in\mathbb{R}^2 \, \Bigg\vert\, \inf_{y\in S_i}\Vert x-y\Vert\le \frac{1}{5}\right\},\ \ \mbox{ where } \\
        \notag S_i  = & \left\{\left(\frac{2}{5}+a_{1,i}\times\cos t, b_{1,i}\times\sin t\right) \, \Bigg\vert\, \frac{\pi}{5}\le t\le\frac{9\pi}{5}\right\}\\
    \notag & \bigcup\left\{\left(-\frac{2}{5}+a_{2,i}\times\cos t, b_{2,i}\times\sin t\right) \, \Bigg\vert\, \frac{6\pi}{5}\le t\le\frac{14\pi}{5}\right\},
\end{align}
and $\{a_{1,i}, a_{2,i}, b_{1,i}, b_{2,i}\}_{i=1}^n \overset{i.i.d.}{\sim} N(1, 0.05^2)$. One element of the shape collection $\{K_i\}_{i=1}^n$ is presented in Figure \ref{fig: SECT visualizations, random}(a). The underlying distribution on $\mathscr{S}_{R,d}^M$ generating $\{K_i\}_{i=1}^n$ is denoted by $\mathbb{P}$, and the expectation associated with $\mathbb{P}$ is denoted by $\mathbb{E}$. We estimate the expected value $\mathbb{E}\{SECT(\cdot)(\nu;t)\}$ by the sample average $\frac{1}{n}\sum_{i=1}^n SECT(K_i)(\nu;t)$ with $n=100$. We identify each direction $\nu\in\mathbb{S}^1$ through the parametrization $\nu=(\cos\vartheta, \sin\vartheta)$ with some $\vartheta\in[0,2\pi)$ as we did in Section \ref{Proof-of-Concept Simulation Examples I: Deterministic Shapes}.
\begin{itemize}
    \item The surface of the map $(\vartheta,t)\mapsto \mathbb{E}\{SECT(\cdot)(\nu;t)\}$ is presented in Figures \ref{fig: SECT visualizations, random}(b) and (c).
    \item The black solid curves in Figure \ref{fig: SECT visualizations, random}(d) present the 100 paths $t\mapsto SECT(K_i)\left((1,0)^\intercal;t\right)$, the black solid curves in Figure \ref{fig: SECT visualizations, random}(e) present paths $t\mapsto SECT(K_i)\left((0,1)^\intercal;t\right)$, and the black solid curves in Figure \ref{fig: SECT visualizations, random}(f) present paths $\vartheta\mapsto SECT(K_i)\left((\cos\vartheta, \sin\vartheta)^\intercal;\frac{3}{2}\right)$, for $i\in\{1,\cdots,100\}$.
    \item The red solid curves in Figures \ref{fig: SECT visualizations, random}(d), (e), and (f) present mean curves
    $t\mapsto \mathbb{E}\{SECT(\cdot)\left((1,0)^\intercal;t\right)\}$, $t\mapsto \mathbb{E}\{SECT(\cdot)\left((0,1)^\intercal;t\right)\}$, and $\vartheta\mapsto \mathbb{E}\{SECT(\cdot)\left((\cos\vartheta, \sin\vartheta)^\intercal;\frac{3}{2}\right)\}$, respectively.
\end{itemize}
The smoothness of the red solid curves in Figures \ref{fig: SECT visualizations, random}(d) and (e) supports the regularity of $\{m_\nu(t)\}_{t\in[0,T]}$ in Theorem \ref{thm: mean is in H}. The finite variance of $SECT(\cdot)(\nu;t)$ for $\nu=(1,0)^\intercal, (0,1)^\intercal$ and $t=3/2$ visually presented in Figures \ref{fig: SECT visualizations, random}(d), (e), and (f) supports Eq.~\eqref{eq: finite second moments for all v and t}.

In addition, the blue dashed curves in Figures \ref{fig: SECT visualizations, random}(d), (e), and (f) present curves $t\mapsto SECT(K^{(1)})\left((1,0)^\intercal;t\right)$, $t\mapsto SECT(K^{(1)})\left((0,1)^\intercal;t\right)$, and $\vartheta\mapsto SECT(K^{(1)})\left((\cos\vartheta, \sin\vartheta)^\intercal;\frac{3}{2}\right)$, respectively, where shape $K^{(1)}$ is defined in Eq.~\eqref{eq: example shapes K1 and K2}. Since $\mathbb{E}\{a_{1,i}\}=\mathbb{E}\{a_{2,i}\}=\mathbb{E}\{b_{1,i}\}=\mathbb{E}\{b_{2,i}\}=1$, the shape $K^{(1)}$ defined in Eq.~\eqref{eq: example shapes K1 and K2} can be viewed as the ``mean shape" of the random collection $\{K_i\}_{i=1}^n$. The similarity between the red solid curves and blue dashed curves in \ref{fig: SECT visualizations, random}(d), (e), and (f) supports the ``mean shape" role of $K^{(1)}$. The rigorous definition of a ``mean shape" and its relationship to the mean function $\mathbb{E}\{SECT(\cdot)(\nu;t)\}$ is left for future research. A potential way of defining mean shapes is through the following Fréchet mean form \citep{frechet1948elements}
\begin{align}\label{Frechet mean shape}
    K_\oplus \overset{\operatorname{def}}{=} \arg\min_{K\in\mathscr{S}_{R,d}^M} \mathbb{E}\left[\left\{\rho(\cdot, K)\right\}^2\right] = \arg\min_{K\in\mathscr{S}_{R,d}^M} \left[ \int_{\mathscr{S}_{R,d}^M} \left\{\rho(K', K)\right\}^2 \mathbb{P}(dK') \right],
\end{align}
where $\rho$ can be either the metric on $\mathscr{S}_{R,d}^M$ defined in Eq.~\eqref{Eq: distance between shapes} or any other metrics generating $\sigma$-algebras satisfying Assumption \ref{assumption: the measurability of ECC}. The existence and uniqueness of the minimizer $K_\oplus$ in Eq.~\eqref{Frechet mean shape}, the relationship between $SECT(K_\oplus)$ and $\mathbb{E}\{SECT(\cdot)\}$, and the extension of Eq.~\eqref{Frechet mean shape} to Fréchet regression \citep{petersen2019frechet} for random shapes are left for future research. The study of the existence of $K_\oplus$ will be a counterpart of Section 4 of \cite{mileyko2011probability}.

In the scenarios where the SECT of shapes from distribution $\mathbb{P}$ are computed only in finitely many directions and at finitely many levels (see the end of Section \ref{section: distributions of H-valued GP}), the mean surface $(\vartheta, t) \mapsto \mathbb{E}\{SECT(\cdot)(\nu;t)\}$ in Figures \ref{fig: SECT visualizations, random}(b) and (c) can also be potentially estimated using manifold learning methods (e.g., \cite{yue2016parameterization}, \cite{dunson2021inferring}, and \cite{meng2021principal}).

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.7]{random_examples.pdf}
    \caption{Visualizations of $\mathbb{E}\{SECT(\cdot)(\nu;t)\}$, $\{SECT(K_i)\}_{i=1}^n$ with $n=100$, and $SECT(K^{(1)})(\nu;t)$. Panels (b) and (c) present the same surface, but from different angles.}
    \label{fig: SECT visualizations, random}
\end{figure}

\section{Testing Hypotheses on Shapes}\label{section: hypothesis testing}

In this section, we apply the probabilistic formulation proposed in Section \ref{section: distributions of Gaussian bridge} to testing statistical hypotheses on shapes. Suppose $\mathbb{P}^{(1)}$ and $\mathbb{P}^{(2)}$ are two independent distributions on $\mathscr{S}_{R,d}^M$ satisfying Assumption \ref{assumption: existence of second moments}, and $m_\nu^{(j)}(t)  =  \int_{\mathscr{S}_{R,d}^M} SECT(K)(\nu;t)\mathbb{P}^{(j)}(dK)$, for $j\in\{1,2\}$, are the mean functions corresponding to the two distributions. We are interested in testing the following hypotheses
\begin{align}\label{eq: the main hypotheses}
    \begin{aligned}
        & H_0: m_\nu^{(1)}(t)=m_\nu^{(2)}(t)\mbox{ for all }(\nu,t)\in\mathbb{S}^{d-1}\times[0,T]\\
    & vs. \ \ H_1:  m_\nu^{(1)}(t)\ne m_\nu^{(2)}(t)\mbox{ for some }(\nu,t).
    \end{aligned}
\end{align}
For example, suppose we are interested in the distributions of heel bones of two groups of primates, testing the hypotheses above helps us distinguish the two groups of primates from a morphology perspective.

The null hypothesis $H_0$ in Eq.~\eqref{eq: the main hypotheses} is equivalent to $\sup_{\nu\in\mathbb{S}^{d-1}}\{\Vert m_{\nu}^{(1)}-m_{\nu}^{(2)} \Vert_{\mathcal{B}}\}=0$. Theorem \ref{thm: mean is in H} (iii), together with Eq.~\eqref{eq: Sobolev embedding from Morrey}, indicates that the following maximizer exists
\begin{align}\label{eq: def of distinguishing direction}
    \nu^* \overset{\operatorname{def}}{=} \arg\max_{\nu\in\mathbb{S}^{d-1}} \left\{\Vert m_{\nu}^{(1)}-m_{\nu}^{(2)} \Vert_{\mathcal{B}} \right\}.
\end{align}
Therefore, $H_0$ is equivalent to assessing whether $\Vert m_{\nu^*}^{(1)}-m_{\nu^*}^{(2)} \Vert_{\mathcal{B}}=0$. The direction $\nu^*$ defined in Eq.~\eqref{eq: def of distinguishing direction} is called a \textit{distinguishing direction}, which we will focus on with the SECT. Hence, we investigate the distributions of the real-valued stochastic process $SECT(\cdot)(\nu^*)$ corresponding to $\mathbb{P}^{(1)}$ and $\mathbb{P}^{(2)}$, respectively.

\subsection{Karhunen–Loève Expansion}

Let $C^{(j)}(\nu_1,\nu_2)$ be the operator-valued covariance of $SECT(\cdot)$ corresponding to distribution $\mathbb{P}^{(j)}$ (see Eq.~\eqref{eq: covariance of random field}) and $\Xi_{\nu^*}^{(j)}(s,t)$ the real-valued covariance of process $SECT(\cdot)(\nu^*)$ corresponding to $\mathbb{P}^{(j)}$, for $j\in\{1,2\}$. Hereafter, we assume the following.
\begin{assumption}\label{assumption: equal covariance aasumption}
$C^{(1)}(\nu_1, \nu_2)=C^{(2)}(\nu_1, \nu_2)$, for all $\nu_1, \nu_2\in\mathbb{S}^{d-1}$.
\end{assumption}
\noindent Eq.~\eqref{eq: relationship between operator-valued cov and real-valued cov} and Assumption \ref{assumption: equal covariance aasumption} imply $\Xi_{\nu^*}^{(1)}=\Xi_{\nu^*}^{(2)} \overset{\operatorname{def}}{=} \Xi_{\nu^*}$. The second half of Theorem \ref{thm: lemma for KL expansions} implies $\Xi_{\nu^*}(\cdot, \cdot)\in L^2([0,T]^2)$. Hence, we may define the integral operator
\begin{align}\label{eq: def of the L2 compact operator}
    L^2([0,T])\rightarrow L^2([0,T]),\ \ \ \ f\mapsto \int_0^T f(s)\Xi_{\nu^*}(s,\cdot)ds.
\end{align}
Theorems VI.22 (e) and VI.23 of \cite{reed2012methods} indicate that the integral operator defined in Eq.~\eqref{eq: def of the L2 compact operator} is compact. It is straightforward that this integral operator is also self-adjoint. Furthermore, the Hilbert-Schmidt theorem (Theorem VI.16 of \cite{reed2012methods}) implies that this operator has countably many eigenfunctions $\{\phi_l\}_{l=1}^\infty$ and eigenvalues $\{\lambda_l\}_{l=1}^\infty$ with $\lambda_1\ge\lambda_2\ge\cdots\ge\lambda_l\ge\cdots\ge0$, and $\{\phi_l\}_{l=1}^\infty$ form an orthonormal basis of $L^2([0,T])$. Then, Theorems \ref{thm: mean is in H} and \ref{thm: lemma for KL expansions} imply the following expansions of the SECT in the distinguishing direction $\nu^*$.
\begin{theorem}\label{thm: KL expansions of SECT}
(Karhunen–Loève expansion) For each $j\in\{1,2\}$, suppose the random shapes $\{K_i^{(j)}\}_{i=1}^n\overset{i.i.d.}{\sim}\mathbb{P}^{(j)}$. We have the following expansions for each sample $K_i^{(j)}$
\begin{align}\label{eq: KL expansions of SECT}
    \begin{aligned}
        & SECT(K_i^{(j)})(\nu^*;t)= m^{(j)}_{\nu^*}(t) +\sum_{l=1}^\infty \sqrt{\lambda_l} \cdot Z_{l,i}^{(j)} \cdot \phi_l(t) \ \mbox{ for all }t\in[0,T], \\
    & \mbox{ where } Z_{l,i}^{(j)}  =  \frac{1}{\sqrt{\lambda_l}}\int_0^T \left\{SECT(K_i^{(j)})(\nu^*;t)-m_{\nu^*}^{(j)}(t) \right\} \phi_l(t)dt,
    \end{aligned}
\end{align}
for all $l=1,2,\ldots$, and the infinite series converges in the $L^2(\mathscr{S}_{R,d}^M,\mathbb{P}^{(j)})$ sense. For each fixed $j\in\{1,2\}$ and $i\in\{1,\cdots,n\}$, random variables $\{Z_{l,i}^{(j)}\}_{l=1}^\infty$ are defined on the probability space $(\mathscr{S}_{R,d}^M, \mathscr{F}, \mathbb{P}^{(j)})$, mutually uncorrelated, and have mean 0 and variance 1. Furthermore, since $\mathbb{P}^{(1)}$ and $\mathbb{P}^{(2)}$ are independent, the two collections $\{(Z_{l,1}^{(1)}, \cdots, Z_{l,n}^{(1)})\}_{l=1}^\infty$ and $\{(Z_{l,1}^{(2)},\cdots, Z_{l,n}^{(2)})\}_{l=1}^\infty$ are independent.
\end{theorem}
\noindent We omit the proof of Theorem \ref{thm: KL expansions of SECT} as it follows directly from Corollary 5.5 of \cite{alexanderian2015brief}. The uncorrelation of $\{Z_{l,i}^{(j)}\}_{l=1}^\infty$ across $l$ in Theorem \ref{thm: KL expansions of SECT} plays an important role in our hypothesis testing framework.

\subsection{The Theoretical Foundation for Hypothesis Testing}\label{The Theoretical foundation for Hypothesis Testing}

Suppose we have two collections of random samples $\{K_i^{(j)}\}_{i=1}^n\overset{i.i.d.}{\sim}\mathbb{P}^{(j)}$, for $j\in\{1,2\}$. In this subsection, we provide the theoretical foundation of using $K_i^{(j)}$ to test the hypotheses in Eq.~\eqref{eq: the main hypotheses}.

The Karhunen–Loève expansions in Eq.~\eqref{eq: KL expansions of SECT} provide the following
\begin{align*}
    X_i(t) & \overset{\operatorname{def}}{=} SECT(K_i^{(1)})(\nu^*;t) - SECT(K_i^{(2)})(\nu^*;t)\\
    & = \left\{ m_{\nu^*}^{(1)}(t) - m_{\nu^*}^{(2)}(t) \right\} + \sum_{l=1}^\infty \sqrt{2\lambda_l} \cdot \left( \frac{Z_{l,i}^{(1)}-Z_{l,i}^{(2)}}{\sqrt{2}} \right) \cdot \phi_l(t).
\end{align*}
We further define the random variables $\{(\xi_{l,1}, \cdots, \xi_{l,n})\}_{l=1}^\infty$ as follows
\begin{align}\label{eq: def of the xi statistic}
    \begin{aligned}
        & \xi_{l,i} \overset{\operatorname{def}}{=} \frac{1}{\sqrt{2\lambda_l}}\cdot \int_0^T X_i(t) \phi_l(t) dt \overset{(1)}{=} \theta_l + \left( \frac{Z_{l,i}^{(1)}-Z_{l,i}^{(2)}}{\sqrt{2}} \right), \\ & \mbox{ where }\ \theta_l   =   \frac{1}{\sqrt{2 \lambda_l}} \int_0^T \left\{ m_{\nu^*}^{(1)}(t) - m_{\nu^*}^{(2)}(t) \right\} \phi_l(t) dt
    \end{aligned}
\end{align}
and $\overset{(1)}{=}$ follows from that $\{\phi_l\}_{l=1}^\infty$ is an orthonormal basis of $L^2([0,T])$. Then, each $\xi_{l,i}$ has mean $\theta_l$ and variance 1. The following theorem transforms the null $H_0$ in Eq.~\eqref{eq: the main hypotheses} using the means $\{\theta_l\}_{l=1}^\infty$.
\begin{theorem}
The null $H_0$ in Eq.~\eqref{eq: the main hypotheses} is equivalent to $\theta_l=0$ for all $l=1, 2, 3, \cdots$.
\end{theorem}
\begin{proof}
We have shown that the null $H_0$ is equivalent to $m_{\nu^*}^{(1)}(t)=m_{\nu^*}^{(2)}(t)$ for all $t\in[0,T]$, where $\nu^*$ is defined in Eq.~\eqref{eq: def of distinguishing direction}. The null $H_0$ directly implies that $\theta_l=0$ for all $l$. On the other hand, if $\theta_l=0$ for all $l$, that $\{\phi_l\}_l$ is an orthonormal basis of $L^2([0,T])$ indicates that $m_{\nu^*}^{(1)}=m_{\nu^*}^{(2)}$ almost everywhere with respect to the Lebesgue measure $dt$. Theorem \ref{thm: mean is in H} (i) and the embedding $\mathcal{H}\subset\mathcal{B}$ in Eq.~\eqref{eq: H, Holder, B embeddings} imply that $m_{\nu^*}^{(1)}$ and $m_{\nu^*}^{(2)}$ are continuous functions. Then, $m_{\nu^*}^{(1)}(t)=m_{\nu^*}^{(2)}(t)$ for all $t\in[0,T]$, which is equivalent to the null $H_0$ in Eq.~\eqref{eq: the main hypotheses}.
\end{proof}

When eigenvalues $\lambda_l$ in the denominators of Eq.~\eqref{eq: def of the xi statistic} are close to zero for large $l$, the estimated $\theta_l$ corresponding to the small eigenvalues can be unstable. Specifically, even if $ m_{\nu^*}^{(1)}(t) \approx m_{\nu^*}^{(2)}(t)$ for all $t$, an extremely small $\lambda_l$ can move the corresponding $\theta_l$ far away from zero. Motivated by the cumulative variance $\int_0^T \mathbb{V}\{X_i(t)\}dt=2(\sum_{l=1}^\infty \lambda_l)$ and the standard approach in principal component analysis, we focus on $\{\theta_l\}_{l=1}^L$ with
\begin{align}\label{eq: def of L}
    L \overset{\operatorname{def}}{=} \min \left\{ l\in\mathbb{N}\, \bigg\vert\, \frac{\sum_{l'=1}^l \lambda_{l'}}{\sum_{l^{''}=1}^\infty \lambda_{l^{''}}} >0.95\right\}.
\end{align}
Hence, to test the null and alternative hypotheses in Eq.~\eqref{eq: the main hypotheses}, we test the following
\begin{align}\label{eq: approximate hypotheses}
    \begin{aligned}
        & \widehat{H}_0: \theta_1=\theta_2=\cdots=\theta_L=0,\ \ vs. \\
    & \widehat{H}_1: \mbox{ there exists } l'\in\{1,\cdots,L\} \mbox{ such that }\theta_{l'}\ne0.
    \end{aligned}
\end{align}
To test the hypotheses in Eq.~\eqref{eq: approximate hypotheses}, we need the following independence assumption.
\begin{assumption}\label{assumption: independence one}
$\{(Z_{l,i}^{(1)}-Z_{l,i}^{(2)})/\sqrt{2}\}_{i=1}^n$ is independent of $\{(Z_{l',i}^{(1)}-Z_{l',i}^{(2)})/\sqrt{2}\}_{i=1}^n$ for any $l,l'\in\{1,\cdots,L\}$ with $l\ne l'$.
\end{assumption}
\noindent Assumption \ref{assumption: independence one} is satisfied under some conditions. The following theorem gives an example.
\begin{theorem}\label{thm: independence implies Gaussianity}
For any partition of $[0,T]$, say $0=t_0<t_1<\cdots<t_l=T$, the stochastic processes $\{\chi^{\nu^*}_t:t_0\le t \le t_1\}, \cdots, \{\chi^{\nu^*}_t:t_{l-1}\le t \le t_l\}$ are independent according to $\mathbb{P}^{(j)}$.
\end{theorem}
\begin{proof}
The continuity of the paths of $PECT(\cdot)(\nu^*)=\{\int_0^t \chi_\tau^{\nu^*} d\tau\}_{t\in[0,T]}$, together with $\int_0^0 \chi_\tau^{\nu^*} d\tau=0$, implies that $PECT(\cdot)(\nu^*)$ is a Gaussian process according to $\mathbb{P}^{(j)}$ (see Theorem 14.4 of \cite{kallenberg2021foundations}). Eq.~\eqref{eq: relationship between PECT and SECT} implies that $SECT(\cdot)(\nu^*)$ is a Gaussian process according to $\mathbb{P}^{(j)}$ as well. Then, for each fixed $i\in\{1,\cdots,n\}$ and $j\in\{1,2\}$, the $\{Z_{l,i}^{(j)}\}_{l=1}^\infty$ in Eq.~\eqref{thm: KL expansions of SECT} are i.i.d. standard normal random variables (see the discussion after Corollary 5.5 in \cite{alexanderian2015brief}). Therefore, Assumption \ref{assumption: independence one} is satisfied.
\end{proof}

Here, we provide simulations supporting Assumption \ref{assumption: independence one}. Suppose that $\mathbb{P}^{(1)}$ and $\mathbb{P}^{(2)}$ are equal to the distribution generating the random shapes defined in Eq.~\eqref{eq: randon shapes under null}. We generate $\{K_i^{(j)}\}_{i=1}^n\overset{i.i.d.}{\sim} \mathbb{P}^{(j)}$ with $n=100$ and $300$, for $j\in\{1,2\}$. Using the numerical method proposed in Section \ref{The Numerical foundation for Hypothesis Testing}, we approximately compute $\{\xi_{l,i}\}_{i=1}^n$, for $l\in\{1,2\}$ (the $L$ defined in Eq.~\eqref{eq: def of L} throughout all our simulations are 2 or 3). The mean functions $m_{\nu^*}^{(j)}$, for $j\in\{1,2\}$, and the histograms of $\{\xi_{l,i}\}_{i=1}^n$ are presented in Figure \ref{fig: size_indep_type1error}. The overlapping curves of mean functions (blue solid and orange dashed curves in Figure \ref{fig: size_indep_type1error}) indicate that the null $H_0$ in Eq.~\eqref{eq: the main hypotheses} is true; hence, $\xi_{l,i}=(Z_{l,i}^{(1)}-Z_{l,i}^{(2)})/\sqrt{2}$ for $l\in\{1,2\}$. More importantly, the normality of $\{\xi_{l,i}\}_{i=1}^n$ presented by the histograms in Figure \ref{fig: size_indep_type1error} indicates that $\{\xi_{1,i}\}_{i=1}^n=\{(Z_{1,i}^{(1)}-Z_{1,i}^{(2)})/\sqrt{2}\}_{i=1}^n$ and $\{\xi_{2,i}\}_{i=1}^n=\{(Z_{2,i}^{(1)}-Z_{2,i}^{(2)})/\sqrt{2}\}_{i=1}^n$ are independent, instead of just uncorrelated (see Theorem \ref{thm: KL expansions of SECT}). Furthermore, the simulation with $n=300$ presents better normality and weaker correlation than the one with $n=100$.

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.76]{size_indep_type1error.pdf}
    \caption{The first row presents the simulation results with $n=100$ and the second row presents the simulation results with $n=300$. In the left panel of each row, the back and red solid curves present the sample paths of $\{SECT(K_i^{(1)})(\nu^*)\}$ and $\{SECT(K_i^{(2)})(\nu^*)\}$, respectively, in the distinguishing direction $\nu^*$ (the red curves are thinner than the black ones and drawn on top of the black curves); the blue solid and red dashed curves present mean functions $m_{\nu^*}^{(1)}$ and $m_{\nu^*}^{(2)}$, respectively. The histograms of $\{\xi_{l,i}\}_{i=1}^n$, for $l\in\{1,2\}$, in the middle and right panels are presented with the $N(0,1)$-density curve (red) overlaid on top of them. When $n=100$, the sample correlation between $\{\xi_{1,i}\}_{i=1}^n$ and $\{\xi_{2,i}\}_{i=1}^n$ across $i\in\{1,\cdots,n\}$ is 0.0907; when $n=300$, this correlation is 0.00903.}
    \label{fig: size_indep_type1error}
\end{figure}

When $L$ is very large, we may implement the following adaptive Neyman test statistic proposed in \cite{fan1996test} to test the hypotheses in Eq.~\eqref{eq: approximate hypotheses}
\begin{align}\label{eq: adaptive Neyman statistic}
    \begin{aligned}
        T_{L,i}^{(AN)}  =  &\sqrt{2\log\log L}\cdot\max_{1\le l\le L}\left\{\frac{1}{\sqrt{2l}}\sum_{l'=1}^l(\xi_{l',i}^2-1)\right\}\\
    & -\left\{2\log\log L+\frac{1}{2}\log\log\log L-\frac{1}{2}\log(4\pi)\right\}.
    \end{aligned}
\end{align}
Theorem 1 of \cite{darling1956limit} implies that $\lim_{L\rightarrow\infty}\mathbb{P}(T^{(AN)}_{L,i}<t)=\exp\{-\exp(-t)\}$ under the null hypothesis and Assumption \ref{assumption: independence one} (also see the discussions right after the Theorem 2.1 in \cite{fan1996test}). Then $\widehat{H}_0$ in Eq.~\eqref{eq: approximate hypotheses} is rejected if $\{T_{L,i}^{(AN)}\}_{i=1}^n$ deviates from the distribution with the cumulative density function $\exp\{-\exp(-t)\}$. However, the number $L$ definend in Eq.~\eqref{eq: def of L} is usually small. For example, if $\mathbb{P}^{(1)}$ and $\mathbb{P}^{(2)}$ are equal to the distribution generating random shapes defined in Eq.~\eqref{eq: randon shapes under null}, then the $L$ is equal to $2$ or $3$ across thousands of simulations. Hence, we implement a simple testing approach when $L$ is not large, and we will focus on the simple testing approach for small $L$ scenarios.

For each $l\in\{1,\cdots,L\}$, the central limit theorem indicates that $\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i}$ asymptotically follows a $N(\theta_l,1)$ distribution as $n\rightarrow\infty$. Under Assumption \ref{assumption: independence one}, $\{\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i}\}_{l=1}^L$ are independent across $l$. Even if Assumption \ref{assumption: independence one} is violated, the uncorrelation property from Theorem \ref{thm: KL expansions of SECT} and the asymptotic normality of $\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i}$ provide the asymptotic independence of $\{\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i}\}_{l=1}^L$ across $l$. In either case, $\sum_{l=1}^L (\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i})^2$ is asymptotically $\chi_L^2$ distributed under the null $\widehat{H}_0$ in Eq.~\eqref{eq: approximate hypotheses} as $n\rightarrow\infty$. Therefore, at the asymptotic confidence level $1-\alpha$ for $\alpha\in(0,1)$, we reject $\widehat{H}_0$ if
\begin{align}\label{eq: rejection region}
    \sum_{l=1}^L \left(\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i}\right)^2 > \chi^2_{L, 1-\alpha} = \mbox{ the $1-\alpha$ lower quantile of the $\chi^2_L$ distribution}.
\end{align}
In Section \ref{section: Simulation experiments}, we will provide simulation studies for this testing procedure.

\subsection{The Numerical foundation for Hypothesis Testing}\label{The Numerical foundation for Hypothesis Testing}

In Section \ref{The Theoretical foundation for Hypothesis Testing}, we proposed an approach to testing the hypotheses in Eq.~\eqref{eq: the main hypotheses} based on $\{\xi_{l,i}\}_{l}$ defined in Eq.~\eqref{eq: def of the xi statistic}. In applications, neither the mean function $m_{\nu}^{(j)}(t)$ nor the covariance function $\Xi_{\nu}(t',t)$ is known. Hence, the corresponding Karhunen–Loève expansions in Eq.~\eqref{eq: KL expansions of SECT} are not available, and the proposed hypothesis testing approach is not directly applicable. In this subsection, motivated by Chapter 4.3.2 of \cite{williams2006gaussian}, we propose a method for estimating the $\{\xi_{l,i}\}_{l}$ in Eq.~\eqref{eq: def of the xi statistic}, which enables us to conduct statistical inference.

For random shapes $\{K_i^{(j)}\}_{i=1}^n\overset{i.i.d.}{\sim}\mathbb{P}^{(j)}$ coming from the two distributions $j\in\{1,2\}$, we compute each of their SECT in finitely many directions and at finitely many levels as discussed in Section \ref{section: distributions of H-valued GP} and get $\{SECT(K_i^{(j)})(\nu_p;t_q)\,|\, p=1,\cdots, \Gamma \mbox{ and }q=1,\cdots,\Delta\}_{i=1}^n$ for $j\in\{1,2\}$, where $t_q  =  \frac{T}{\Delta}q$. We want to emphasize that the SECT of all shapes $K_i^{(j)}$ in the two collections are computed in the same collection of directions $\{\nu_p\}_{p=1}^\Gamma$ and at the same collection of levels $\{t_q\}_{q=1}^\Delta$. We estimate the mean $m_{\nu_p}^{(j)}(t_q)$ at level $t_q$ by $\widehat{m}_{\nu_p}^{(j)}(t_q)  =  $ the sample mean of $\{SECT(K_i^{(j)})(\nu_p;t_q)\}_{i=1}^n$ across $i\in\{1,\cdots,n\}$. Then, we estimate the distinguishing direction $\nu^*$ by
\begin{align}\label{eq: estimated distinguishing direction}
    \widehat{\nu}^* \overset{\operatorname{def}}{=} \arg\max_{\nu_p} \left[ \max_{t_q} \left\{\left\vert \widehat{m}_{\nu_p}^{(1)}(t_q) - \widehat{m}_{\nu_p}^{(2)}(t_q) \right\vert \right\} \right].
\end{align}
Based on Assumption \ref{assumption: equal covariance aasumption}, we estimate the covariance matrix $\left(\Xi_{\nu^*}(t_{q'},t_{q})\right)_{q,q'=1,\cdots,\Delta}$ by the sample covariance matrix $\pmb{C}  =  (\widehat{\Xi}_{\nu^*}(t_{q'},t_{q}))_{q,q'=1,\cdots,\Delta}$ derived from the following centered sample vectors across $i\in\{1,\cdots,n\}$ and $j\in\{1,2\}$
\begin{align}\label{eq: centered sample vectors}
    \left\{ \left( SECT(K_i^{(j)})(\widehat{\nu}^*;t_1) - \widehat{m}_{\widehat{\nu}^*}^{(j)}(t_1), \cdots, SECT(K_i^{(j)})(\widehat{\nu}^*;t_\Delta)- \widehat{m}_{\widehat{\nu}^*}^{(j)}(t_\Delta) \right)^\intercal\Big\vert j=1,2 \right\}_{i=1}^n.
\end{align}

Since the eigenfunctions $\{\phi_l\}_{l=1}^\infty$ and eigenvalues $\{\lambda_l\}_{l=1}^\infty$ satisfy $\lambda_l\phi_l=\int_0^T \phi_l(s)\Xi_{\nu^*}(s,\cdot)ds$, we have the following approximation
\begin{align*}
    \lambda_l\phi_l(t_q)=\int_0^T \phi_l(s)\Xi_{\nu^*}(s,t_q)ds\approx\frac{T}{\Delta}\sum_{q'=1}^\Delta \phi_l(t_{q'})\Xi_{\nu^*}(t_{q'}, t_q) \approx \frac{T}{\Delta}\sum_{q'=1}^\Delta \phi_l(t_{q'})\widehat{\Xi}_{\nu^*}(t_{q'}, t_q),
\end{align*}
which is represented in the following matrix form
\begin{align}\label{eq: matrix form, approximate integrals by riemann sums}
    &\lambda_l\begin{pmatrix}
    \phi_l(t_1)\\
    \vdots \\
    \phi_l(t_\Delta)
    \end{pmatrix}\approx\frac{T}{\Delta}
    \begin{pmatrix}
   \widehat{\Xi}_{\nu^*}(t_{1}, t_1) & \ldots & \widehat{\Xi}_{\nu^*}(t_\Delta, t_1) \\
    \vdots & \ddots & \vdots \\
    \widehat{\Xi}_{\nu^*}(t_\Delta, t_2) & \ldots & \widehat{\Xi}_{\nu^*}(t_\Delta, t_\Delta)
    \end{pmatrix}
    \begin{pmatrix}
    \phi_l(t_1)\\
    \vdots \\
    \phi_l(t_\Delta)
    \end{pmatrix}.
\end{align}
We denote the eigenvectors and eigenvalues of $\pmb{C}$ as $\{\pmb{v}_l=(v_{l,1}, \cdots, v_{l,\Delta})^\intercal\}_{l=1}^\Delta$ and $\{\Lambda_l\}_{l=1}^\Delta$, respectively. The following equation motivates the estimate $\phi_l(t_q)\approx \widehat{\phi}_l(t_q) \overset{\operatorname{def}}{=} \sqrt{\frac{\Delta}{T}} \cdot v_{l,q}$, for all $l\in\{1,\cdots,\Delta\}$
\begin{align*}
    \sum_{q=1}^\Delta v_{l,q}^2 = \Vert \pmb{v}_l \Vert^2 = 1 = \int_0^T\vert \phi_l(t)\vert^2 dt \approx \frac{T}{\Delta}\sum_{q=1}^\Delta \left(\phi_l(t_q)\right)^2 = \sum_{q=1}^\Delta \left(\sqrt{\frac{T}{\Delta}}\cdot\phi_l(t_q)\right)^2.
\end{align*}
The following equation motivates the estimate $\lambda_l\approx\widehat{\lambda}_l \overset{\operatorname{def}}{=} \frac{T}{\Delta}\Lambda_l$, for all $l\in\{1,\cdots,\Delta\}$
\begin{align*}
    \lambda_l \left(\widehat{\phi}_l(t_1), \cdots, \widehat{\phi}_l(t_\Delta)\right)^\intercal &\approx \frac{T}{\Delta}\pmb{C}\left(\widehat{\phi}_l(t_1), \cdots, \widehat{\phi}_l(t_\Delta)\right)^\intercal \\
    & = \sqrt{\frac{T}{\Delta}} \pmb{C} \pmb{v}_l = \sqrt{\frac{T}{\Delta}} \Lambda_l \pmb{v}_l = \left(\frac{T}{\Delta}\Lambda_l\right) \left(\widehat{\phi}_l(t_1), \cdots, \widehat{\phi}_l(t_\Delta)\right)^\intercal.
\end{align*}
Additionally, we estimate the $L$ defined in Eq.~\eqref{eq: def of L} by the following
\begin{align}\label{eq: estimated L}
    L\approx \widehat{L} \overset{\operatorname{def}}{=} \min \left\{ l=1,\cdots, \Delta \,\Bigg\vert\, \frac{\sum_{l'=1}^l \vert \widehat{\lambda}_{l'}\vert}{\sum_{l^{''}=1}^\Delta \vert \widehat{\lambda}_{l^{''}}\vert} >0.95\right\};
\end{align}
we take the absolute values of the estimated eigenvalues in computing $\widehat{L}$ because the estimated eigenvalues may be numerically negative in applications.

We estimate the random variables $\xi_{l,i}$ defined in Eq.~\eqref{eq: def of the xi statistic} by the following
\begin{align}\label{eq: def of xi_hat}
    \xi_{l,i} \approx \widehat{\xi}_{l,i} = \frac{1}{\sqrt{2\widehat{\lambda}_l}} \cdot \frac{T}{\Delta} \sum_{q=1}^\Delta \left\{ SECT(K_i^{(1)})(\widehat{\nu}^*;t_q) - SECT(K_i^{(2)})(\widehat{\nu}^*;t_q) \right\} \widehat{\phi}_l(t_q),
\end{align}
for $l=1,\ldots,\widehat{L}$ and $i=1,\ldots,n$. Then, when $\widehat{L}$ is large (e.g., several hundreds; see Section 3 of \cite{fan1996test}), we implement the adaptive Neyman test by replacing the $\xi_{l,i}$ and $L$ in Eq.~\eqref{eq: adaptive Neyman statistic} with $\widehat{\xi}_{l,i}$ and $\widehat{L}$, respectively. When $\widehat{L}$ is moderate, which is true in all our simulations, we can implement the $\chi^2$-test in Eq.~\eqref{eq: rejection region} as follows
\begin{align}\label{eq: numerical chisq rejection region}
    \sum_{l=1}^{ \widehat{L}}\left(\frac{1}{\sqrt{n}}\sum_{i=1}^n \widehat{\xi}_{l,i}\right)^2 > \chi^2_{\widehat{L}, 1-\alpha} = \mbox{ the $1-\alpha$ lower quantile of the $\chi^2_{\widehat{L}}$ distribution}.
\end{align}
A complete outline of this $\chi^2$-hypothesis testing procedure is given in Algorithm \ref{algorithm: testing hypotheses on mean functions}.
\begin{algorithm}[h]
	\caption{: ($\chi^2$-based) Testing the hypotheses in Eq.~\eqref{eq: the main hypotheses}}\label{algorithm: testing hypotheses on mean functions}
	\begin{algorithmic}[1]
		\INPUT
        \noindent (i) SECT of two collection of shapes $\{SECT(K_i^{(j)})(\nu_p;t_q):p=1,\cdots,\Gamma \mbox{ and } q=1,\cdots,\Delta\}_{i=1}^n$ for $j\in\{1,2\}$;
        (ii) desired confidence level $1-\alpha$ with $\alpha\in(0,1)$.
		\OUTPUT \texttt{Accept} or \texttt{Reject} the null hypothesis $H_0$ in Eq.~\eqref{eq: the main hypotheses}.
		\STATE For $j\in\{1,2\}$, compute $\widehat{m}_{\nu_p}^{(j)}(t_q) \overset{\operatorname{def}}{=}$ sample mean of $\{SECT(K_i^{(j)})(\nu_p;t_q)\}_{i=1}^n$ across $i\in\{1,\cdots,n\}$.
		\STATE Compute the estimated distinguishing direction $\widehat{\nu}^*$ using Eq.~\eqref{eq: estimated distinguishing direction}.
		\STATE Compute $\pmb{C}=(\widehat{\Xi}_{\nu^*}(t_{q'},t_{q}))_{q,q'=1,\cdots,\Delta} \overset{\operatorname{def}}{=} $ the sample covariance matrix derived from the centered sample vectors in Eq.~\eqref{eq: centered sample vectors} across $i\in\{1,\cdots,n\}$ and $j\in\{1,2\}$.
		\STATE Compute the eigenvectors $\{\pmb{v}_l\}_{l=1}^\Delta$ and eigenvalues $\{\Lambda_l\}_{l=1}^\Delta$ of the sample covariance matrix $\pmb{C}$.
		\STATE Compute $\widehat{\phi}_l(t_q) \overset{\operatorname{def}}{=}  \sqrt{\frac{\Delta}{T}} v_{l,q}$ and $\widehat{\lambda}_l \overset{\operatorname{def}}{=}  \frac{T}{\Delta}\Lambda_l$ for all $l=1,\cdots,\Delta$.
		\STATE Compute $\widehat{L}$ using Eq.~\eqref{eq: estimated L}.
		\STATE Compute $\{\xi_{l,i}:l=1,\cdots,\widehat{L}\}_{i=1}^n$ using Eq.~\eqref{eq: def of xi_hat}, test null $H_0$ using Eq.~\eqref{eq: numerical chisq rejection region}, and report the output.
		\end{algorithmic}
\end{algorithm}

In addition to the $\chi^2$-test detailed in Algorithm \ref{algorithm: testing hypotheses on mean functions}, we also propose a permutation test as an alternative approach for assessing the statistical hypotheses in Eq.~\eqref{eq: the main hypotheses}. The main idea behind the permutation test is that, under the null hypothesis, shuffling (or permuting) the group labels of shapes should not heavily change the test statistic of interest. To perform the permutation test, we first apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to our original data and then repeatedly re-apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to shapes with shuffled labels.$^\S$\footnote{$\S$: When we apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to the original SECT, the result of Eq.~\eqref{eq: estimated L} is denoted as $\widehat{L}_0$. When we apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to the shuffled SECT, the $\widehat{L}$ resulting from Eq.~\eqref{eq: estimated L} may differ from $\widehat{L}_0$. To make the comparison between $\mathfrak{S}_0$ and $\mathfrak{S}_{k^*}$ fair (see the last step of Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions}), we set $\widehat{L}$ to be $\widehat{L}_0$.} We then compare how the test statistics derived from the original differ from those computed on the shuffled data. The details of this permutation-based approach are provided in Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions}. Simulation studies in Section \ref{section: Simulation experiments} show that Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions} can eliminate the moderate type I error inflation of Algorithm \ref{algorithm: testing hypotheses on mean functions}; however, the power under the alternative for Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions} is moderately weaker than that of Algorithm \ref{algorithm: testing hypotheses on mean functions}.

\begin{algorithm}[h]
	\caption{: (Permutation-based) Testing the hypotheses in Eq.~\eqref{eq: the main hypotheses}}\label{algorithm: permutation-based testing hypotheses on mean functions}
	\begin{algorithmic}[1]
		\INPUT
        \noindent (i) SECT of two collection of shapes $\{SECT(K_i^{(j)})(\nu_p;t_q):p=1,\cdots,\Gamma \mbox{ and } q=1,\cdots,\Delta\}_{i=1}^n$ for $j\in\{1,2\}$;
        (ii) desired confidence level $1-\alpha$ with $\alpha\in(0,1)$; (iii) the number of permutations $\Pi$.
		\OUTPUT \texttt{Accept} or \texttt{Reject} the null hypothesis $H_0$ in Eq.~\eqref{eq: the main hypotheses}.
		\STATE Apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to the original input SECT data, compute $\widehat{L}_0$ using Eq.~\eqref{eq: estimated L} (see footnote $\S$), and compute the $\chi^2$-test statistic denoted as $\mathfrak{S}_0$ using Eq.~\eqref{eq: numerical chisq rejection region}.
		\FORALL{$k=1,\cdots,\Pi$, }
		\STATE Randomly permute the group labels $j\in\{1,2\}$ of the input SECT data.
		\STATE Apply Algorithm \ref{algorithm: testing hypotheses on mean functions} to the permuted SECT data while setting $\widehat{L}$ to be the $\widehat{L}_0$, instead of using Eq.~\eqref{eq: estimated L}, and compute a $\chi^2$-test statistic $\mathfrak{S}_k$ using Eq.~\eqref{eq: numerical chisq rejection region}.
		\ENDFOR
		\STATE Compute $k^* \overset{\operatorname{def}}{=}[(1-\alpha)\cdot\Pi]\overset{\operatorname{def}}{=}$ the largest integer smaller than $(1-\alpha)\cdot\Pi$.
		\STATE \texttt{Reject} the null hypothesis $H_0$ if $\mathfrak{S}_0>\mathfrak{S}_{k^*}$ and report the output.
		\end{algorithmic}
\end{algorithm}

\section{Experiments Using Simulations}\label{section: Simulation experiments}

In this section, we present proof-of-concept simulation studies showing the performance of the hypothesis testing framework outlined in Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions}. We focus on a family of distributions $\{\mathbb{P}^{(\varepsilon)}\}_{0\le\varepsilon\le0.1}$ on $\mathscr{S}_{R,d}^M$. For each $\varepsilon$, a collection of shapes $\{K_i^{(\varepsilon)}\}_{i=1}^n$ are i.i.d. generated from distribution $\mathbb{P}^{(\varepsilon)}$ via the following
\begin{align}\label{eq: explicit P varepsilon}
        K_i^{(\varepsilon)}  = & \left\{x\in\mathbb{R}^2 \, \Bigg\vert\, \inf_{y\in S_i^{(\varepsilon)}}\Vert x-y\Vert\le \frac{1}{5}\right\},\ \ \mbox{ where} \\
        \notag S_i^{(\varepsilon)}  =   & \left\{\left(\frac{2}{5}+a_{1,i}\cdot\cos t, b_{1,i}\cdot\sin t\right) \, \Bigg\vert\, \frac{1-\varepsilon}{5}\pi\le t\le\frac{9+\varepsilon}{5}\pi\right\}\\
\notag &\bigcup\left\{\left(-\frac{2}{5}+a_{2,i}\cdot\cos t, b_{2,i}\cdot\sin t\right) \, \Bigg\vert\, \frac{6\pi}{5}\le t\le\frac{14\pi}{5}\right\},
\end{align}
where $\{a_{1,i}, a_{2,i}, b_{1,i}, b_{2,i}\}_{i=1}^n \overset{i.i.d.}{\sim} N(1, 0.05^2)$, and the index $\varepsilon$ denotes the dissimilarity between the distributions $\mathbb{P}^{(\varepsilon)}$ and $\mathbb{P}^{(0)}$. For each $\varepsilon\in[0,0.1]$, we test the following hypotheses using the scheme described in Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions}
\begin{align}\label{eq: null in the simulation section}
    \begin{aligned}
        & H_0: m_\nu^{(0)}(t)=m_\nu^{(\varepsilon)}(t)\mbox{ for all }(\nu,t)\in\mathbb{S}^{d-1}\times[0,T],\\
    & vs. \ \ H_1:  m_\nu^{(0)}(t)\ne m_\nu^{(\varepsilon)}(t)\mbox{ for some }(\nu,t),
    \end{aligned}
\end{align}
where the mean $m_\nu^{(\varepsilon)}(t) \overset{\operatorname{def}}{=} \int_{\mathscr{S}_{R,d}^M} SECT(K)(\nu;t) \mathbb{P}^{(\varepsilon)}(dK)$, and the null hypothesis $H_0$ is true when $\varepsilon=0$.

We set $T=3$, directions $\nu_p=(\cos\frac{p-1}{4}\pi, \sin\frac{p-1}{4}\pi)^\intercal$ for $p\in\{1,2,3,4\}$, levels $t_q=\frac{T}{50}q=0.06q$ for $q\in\{1,\cdots,50\}$, the confidence level $95\%$ (i.e., $\alpha=0.05$ in Eq.~\eqref{eq: numerical chisq rejection region}), and the number of permutations $\Pi=1000$. For each $\varepsilon\in\{0,\, 0.0125,\, 0.025,\, 0.0375,\, 0.05,\, 0.075,\, 0.1\}$, we independently generate two collection of shapes: $\{K_i^{(0)}\}_{i=1}^n\overset{i.i.d.}{\sim} \mathbb{P}^{(0)}$ and $\{K_i^{(\varepsilon)}\}_{i=1}^n\overset{i.i.d.}{\sim} \mathbb{P}^{(\varepsilon)}$ through Eq~\eqref{eq: explicit P varepsilon} with $n=100$, and we compute the SECT of each generated shape in directions $\{\nu_p\}_{p=1}^4$ and at levels $\{t_q\}_{q=1}^{50}$. Then, we implement Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions} to these computed SECT variables and get the corresponding \texttt{Accept}/\texttt{Reject} output. We repeat this procedure for 100 times, and the rejection rates across all replicates for each $\varepsilon$ are presented in Figure \ref{fig: simulation visualizations} and Table \ref{table: epsilon vs. rejection rates}.

\begin{figure}
    \centering
    \includegraphics[scale=0.7]{Simulation_visualizations.pdf}
    \caption{The ``\texttt{rejection rates} vs.~\texttt{epsilon}" plot in the first panel presents the relationship between the indices $\varepsilon$ and the rejection rates computed via Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions} throughout all simulations. This relationship is presented in Table \ref{table: epsilon vs. rejection rates} as well. The red squares and orange dots present the rejection rates corresponding to values $\varepsilon\in\{0,\, 0.0125,\, 0.025,\, 0.0375,\, 0.05,\, 0.075,\, 0.1\}$. The black dashed and blue dotted straight lines present 0.05 and 1, respectively. In the last two panels of the first row, the gray and green solid curves present sample path collections $\{SECT(K_i^{(0)})(\widehat{\nu}^*)\}_{i=1}^{100}$ and $\{SECT(K_i^{(\varepsilon)})(\widehat{\nu}^*)\}_{i=1}^{100}$, respectively; the blue solid and red dashed curves present $\widehat{m}_{\widehat{\nu}^*}^{(0)}$ and $\widehat{m}_{\widehat{\nu}^*}^{(\varepsilon)}$, respectively, for $\varepsilon\in\{0,\, 0.075\}$. The blue shape in the second row is generated from $\mathbb{P}^{(0)}$, and the two pink shapes are generated from $\mathbb{P}^{(0.075)}$.}
    \label{fig: simulation visualizations}
\end{figure}

\setlength{\extrarowheight}{2pt}
\begin{table}[h]
\centering
\caption{Indices $\varepsilon$ and the rejection rates of Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions}.}
    \label{table: epsilon vs. rejection rates}
    \vspace*{0.5em}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
Indices $\varepsilon$  & 0.000  & 0.0125  & 0.0250  & 0.0375 & 0.0500 & 0.0750 & 0.100  \\ [2pt]\hline\hline
Rejection rates of Algorithm \ref{algorithm: testing hypotheses on mean functions} & 0.15 & 0.16 & 0.32 & 0.67   & 0.92 & 0.98 & 1.00 \\ [2pt]\hline\hline
Rejection rates of Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions} & 0.03 & 0.14 & 0.22 & 0.47  & 0.74 & 1.00 & 1.00 \\ [2pt]\hline
\end{tabular}
\end{table}

The presented simulation studies show that our Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions} are extremely powerful in detecting the difference between $\mathbb{P}^{(\varepsilon)}$ and $\mathbb{P}^{(0)}$ in terms of the discrepancy between the corresponding mean functions. The estimated mean functions $\widehat{m}_{\widehat{\nu}^*}^{(0)}$ and $\widehat{m}_{\widehat{\nu}^*}^{(\varepsilon)}$ in direction $\widehat{\nu}^*$ are presented by the blue solid and red dashed curves, respectively, in Figure \ref{fig: simulation visualizations}. The discrepancy between the two estimated mean functions is presented therein. As $\varepsilon$ increases, $\mathbb{P}^{(\varepsilon)}$ deviates from $\mathbb{P}^{(0)}$, and the power of Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions} --- rejection rates under the alternative hypothesis --- in detecting the deviation increases. When $\varepsilon>0.075$, the power of Algorithms \ref{algorithm: testing hypotheses on mean functions} and \ref{algorithm: permutation-based testing hypotheses on mean functions} exceeds 0.95. For all values of $\varepsilon$, it is hard to tell the deviation of $\mathbb{P}^{(\varepsilon)}$ from $\mathbb{P}^{(0)}$ by eye. For example, by just visualizing the shapes in Figure \ref{fig: simulation visualizations}, it is difficult to distinguish between the shape collections generated by $\mathbb{P}^{(0)}$ (blue) and $\mathbb{P}^{(0.075)}$ (pink), while our hypothesis testing framework detected the difference between the two shape collections in more than $95\%$ of the simulations.

Despite the strong ability of Algorithm \ref{algorithm: testing hypotheses on mean functions} to detect the true discrepancy between mean functions, its type I error rate --- rejection rate under the null model --- is moderately inflated. Specifically, the type I error rate of Algorithm \ref{algorithm: testing hypotheses on mean functions} is 0.15, while the expected error rate is 0.05 (see Table \ref{table: epsilon vs. rejection rates}). In contrast, Algorithm \ref{algorithm: permutation-based testing hypotheses on mean functions} does not suffer from the type I error inflation under the null, while its power under the alternative is moderately weaker than that of Algorithm \ref{algorithm: testing hypotheses on mean functions}.

\section{Conclusions and Discussions}\label{Conclusions and Discussions}

In this paper, we provided the mathematical foundations for the randomness of shapes and the distributions of the smooth Euler characteristic transform (SECT). The $(\mathscr{S}_{R,d}^M, \mathscr{B}(\rho), \mathbb{P})$ was constructed as an underlying probability space for modeling the randomness of shapes, and the SECT was modeled as a $C(\mathbb{S}^{d-1};\mathcal{H})$-valued random variable defined on this probability space. We showed several properties of the SECT ensuring its Karhunen–Loève expansion, which led to normal distribution-based statistics $\sum_{l=1}^L (\frac{1}{\sqrt{n}}\sum_{i=1}^n \xi_{l,i})^2$ and $\{T_{L,i}^{(AN)}\}_{i=1}^n$ for testing the hypotheses on random shapes. Simulation studies were provided to support our mathematical derivations and show the performance of the proposed hypothesis testing framework. Our approach was shown to be extremely powerful in detecting the difference between the mean functions corresponding to two distributions of shapes. We list several potential future research areas that we believe are related to our work.

\paragraph*{Definition of Mean Shapes and Fréchet/Wasserstein Regression} The existence and uniqueness of the mean shapes $K_\oplus$ as defined in Eq.~\eqref{Frechet mean shape} are still unknown. If mean shapes $K_\oplus$ do exist, the relationship between $SECT(K_\oplus)$ and $\mathbb{E}\{SECT(\cdot)\}$ is of particular interest. The Fréchet mean in Eq.~\eqref{Frechet mean shape} may be extended to the conditional Fréchet mean and implemented in the Fréchet regression --- predicting shapes $K$ using multiple scalar predictors \citep{petersen2019frechet}. For example, predicting molecular shapes and structures from scalar-valued indicators or sequences has become of high interest in systems biology \citep{jumper2021highly, yang2020improved}. As an example of the other way around, predicting clinical outcomes from the tumors is also of interest \citep{moon2020predicting, somasundaram2021persistent, vipond2021multiparameter}. \cite{crawford2020predicting} conducted this prediction using Gaussian process regression. Another possible way of making these types of predictions is via Wasserstein regression \citep{chen2021wasserstein}. The Wasserstein regression framework also allows both predictors and responses to be random shapes. For example, both the treatment of interest and the shapes of tumors pre-treatment can play the role of predictors, while tumor shapes after treatment can be used as the responses of a Wasserstein regression model. The combination of Wasserstein regression and the random shape framework proposed herein is left for future research.

\paragraph*{Investigating the Gaussianity of the SECT} Both the proof of Theorem \ref{thm: independence implies Gaussianity} and the simulation results presented in Figure \ref{fig: size_indep_type1error} indicate that modeling the real-valued stochastic process $SECT(\cdot)(\nu)$, for each $\nu\in\mathbb{S}^{d-1}$, as a Gaussian process is suitable for some underlying distributions $\mathbb{P}$ of shapes $K$. If $SECT(\cdot)(\nu)$ are Gaussian processes, we may further model the distributions of $SECT(\cdot)(\nu)$ using parametric covariance functions. Finding the proper assumptions making each $SECT(\cdot)(\nu)$ a Gaussian process is of both theoretical and applied modeling interest.

\paragraph*{Generative Models for Complex Shapes} The foundations for the randomness of shapes and the distributions of the SECT allow for the generative modeling of complex shapes. Suppose we are interested in a collection of shapes $\{K_i\}_{i=1}^n\subset\mathscr{S}_{R,d}^M$ (e.g., heel bones or tumors), and the underlying distribution of $\{SECT(K_i)\}_{i=1}^n$ is $\mathbf{P}$, where $\mathbf{P}$ is a probability measure on $C(\mathbb{S}^{d-1};\mathcal{H})$. Suppose $\mathbf{P}$ is known or accurately estimated. We can then simulate $\{SECT_{i'}\}_{i'=1}^{n'} \overset{i.i.d.}{\sim} \mathbf{P}$. Since the shape-to-SECT map $K\mapsto SECT(K)$ is invertible (see Theorem \ref{thm: invertibility}), for each $i'\in\{1,\cdots,n'\}$, there exists a unique shape $K_{i'}$ whose SECT is $SECT_{i'}$. Then the simulated $\{K_{i'}\}_{i'=1}^{n'}$ and the shapes of interest share the same distribution $\mathbf{P}$. The estimation of the underlying distribution $\mathbf{P}$ from $\{K_i\}_{i=1}^n$ is left for future research. The shape reconstruction step (i.e., constructing an (approximate) inverse map $SECT_i\mapsto K_i$) is outside the scope of the current paper; however, when shapes $K$ are 3-dimensional ``meshes," a shape reconstruction approach can be applied (see Section 2.4 of \cite{wang2021statistical}).

\paragraph*{Lifted Euler Characteristic
Transform} \cite{kirveslahti2021representing} generalized the Euler characteristic transform to field type data using a lifting argument and proposed the lifted Euler characteristic transform (LECT). The randomness and distributions of the LECT and corresponding hypothesis testing framework extensions are left for future research.

\section*{Software Availability}

Source code for implementing the simulation studies in Section \ref{section: Simulation experiments} is publicly available online at
\begin{center}
    \small{\url{https://github.com/KMengBrown/Randomness-Inference-via-SECT.git}}.
\end{center}

\section*{Acknowledgments}

We want to thank Dr. Matthew T.~Harrison in the Division of Applied Mathematics at Brown University for useful comments and suggestions on previous versions of the manuscript.

\section*{Competing Interests}

The authors declare no competing interests.

\clearpage
\newpage

\begin{center}
    \Large{\textbf{Appendix}}
\end{center}

\begin{appendix}

\section{Overview of Persistent Diagrams}\label{The Relationship between PHT and SECT}

\noindent This subsection gives an overview of PDs in the literature. The overview is provided for the following purposes:
\begin{itemize}
    \item we provide the details for the definition of $\mathscr{S}_{R,d}^M$, particularly the condition in Eq.~\eqref{Eq: topological invariants boundedness condition};
    \item the PD framework is the necessary tool for proving several theorems in this paper (see Appendix \ref{section: appendix, proofs}).
\end{itemize}
Most of the materials in the overview come from or are modified from \cite{mileyko2011probability} and \cite{turner2013means}.

Let $\mathbb{K}$ be a compact topological space and $\varphi$ be a real-valued continuous function defined on $\mathbb{K}$. Because of the compactness of $\mathbb{K}$ and continuity of $\varphi$, we assume $\varphi(\mathbb{K})\subset[0,T]$ without loss of generality. For each $t\in [0,T]$, denote
\begin{align*}
    \mathbb{K}^\varphi_t \overset{\operatorname{def} }{=} \{x\in\mathbb{K} \,\vert \, \varphi(x)\le t\}.
\end{align*}
Then $\mathbb{K}^\varphi_{t_1} \subset\mathbb{K}^\varphi_{t_2}$ for all $0\le t_1\le t_2 \le T$, and $i_{t_1 \rightarrow t_2}$ denotes the corresponding inclusion map. Definition \ref{def: HCP and tameness} is an analogue to the following concepts:
\begin{enumerate}
    \item \textit{$t^*$ is a homotopy critical point (HCP) of $\mathbb{K}$ with respect to $\varphi$ if $\mathbb{K}^\varphi_{t^*}$ is not homotopy equivalent to $\mathbb{K}^\varphi_{t^*-\delta}$ for any $\delta>0$;}
    \item \textit{$\mathbb{K}$ is called tame with respect to $\varphi$ if $\mathbb{K}$ has finitely many HCP with respect to $\varphi$.}
\end{enumerate}
If we take $\mathbb{K}=K\in\mathscr{S}_{R,d}^M$ and
\begin{align}\label{Eq: Morse function 1}
    \varphi(x)=x\cdot \nu+R \overset{\operatorname{def}}{=} \phi_\nu(x),\ \ \ x\in K,\ \ \nu\in\mathbb{S}^{d-1},
\end{align}
we have the scenario discussed in Section \ref{The Definition of Smooth Euler Characteristic Transform}. The definition of $\mathscr{S}_{R,d}^M$ provides the tameness of $K$ with respect to $\phi_\nu$ and $\phi_\nu(K)\subset[0,T]$, for any fixed $\nu\in\mathbb{S}^{d-1}$.

The inclusion maps $i_{t_1 \rightarrow t_2}: \mathbb{K}_{t_1}^\varphi \rightarrow \mathbb{K}_{t_2}^\varphi$ induces the group homomorphisms
\begin{align*}
    i^{\#}_{t_1 \rightarrow t_2}: H_k(\mathbb{K}_{t_1}^\varphi) \rightarrow H_k(\mathbb{K}_{t_2}^\varphi), \ \ \mbox{ for all }k\in\mathbb{Z},
\end{align*}
where $H_k(\cdot)=H_k(\cdot;\mathbb{Z}_2)$ denotes the $k$-th homology group with respect to field $\mathbb{Z}_2$, and $\mathbb{Z}_2$ is omitted for simplicity. Because of the tameness of $\mathbb{K}$ with respect to $\varphi$, for any $t_1 \le t_2$, we have that the image
\begin{align*}
    im \left(i^{\#}_{(t_1-\delta) \rightarrow t_2} \right)=im \left(i^{\#}_{(t_1-\delta) \rightarrow t_1} \circ i^{\#}_{t_1 \rightarrow t_2} \right)
\end{align*}
does not depend on $\delta>0$ when $\delta$ is sufficiently small, and then this constant image is denoted as $im(i^{\#}_{(t_1-) \rightarrow t_2})$. For any $t$, the $k$-th birth group at $t$ is defined as the quotient group
\begin{align*}
    B_k^{t} \overset{\operatorname{def}}{=} H_k(\mathbb{K}_t^\varphi)/im(i^{\#}_{(t-)\rightarrow t}),
\end{align*}
and $\pi_{B_k^t}: H_k(\mathbb{K}_t^\varphi) \rightarrow B_k^{t}$ denotes the corresponding quotient map. For any $\alpha\in H_k(\mathbb{K}_t^\varphi)$, we say $\alpha$ is born at $t$ if $\pi_{B_k^t}(\alpha)\ne 0$ in $B_k^t$. The tameness implies that $B_k^t$ is a nontrivial group only for finitely many $t$. For any $t_1<t_2$, we denote the quotient group
\begin{align*}
    E_k^{t_1, t_2} \overset{\operatorname{def}}{=} H_k(\mathbb{K}_{t_2}^\varphi)/im(i^{\#}_{(t_1-)\rightarrow t_2})
\end{align*}
and the corresponding quotient map $\pi_{E_k^{t_1, t_2}}: H_k(\mathbb{K}_{t_2}^\varphi) \rightarrow E_k^{t_1, t_2}$. Furthermore, we define the following map
\begin{align*}
    g_k^{t_1, t_2}:\ \  B_k^{t_1} \rightarrow E_k^{t_1, t_2},\ \ \ \ \pi_{B_k^{t_1}}(\alpha) \mapsto \pi_{E_k^{t_1, t_2}}\left(i^{\#}_{t_1 \rightarrow t_2}(\alpha)\right),
\end{align*}
for all $\alpha \in H_k(\mathbb{K}_{t_1}^\varphi)$. Then we define the death group
\begin{align*}
    D_k^{t_1, t_2} \overset{\operatorname{def}}{=} ker(g_k^{t_1, t_2}).
\end{align*}
We say a homology class $\alpha\in H_k(\mathbb{K}_{t_1}^\varphi)$ is born at $t_1$ and dies at $t_2$ if (i) $\pi_{B_k^{t_1}}(\alpha)\ne 0$, (ii) $\pi_{B_k^{t_1}}(\alpha)\in D_{k}^{t_1, t_2}$, and (iii) $\pi_{B_k^{t_1}}(\alpha)\notin D_{k}^{t_1, t_2-\delta}$ for any $\delta\in(0, t_2-t_1)$. If $\alpha$ does not die, we artificially say that it dies at $T$ as $K_T^\varphi=\mathbb{K}$. Then we denote $\operatorname{birth}(\alpha)=t_1$ and $\operatorname{death}(\alpha)=t_2$, and the persistence of $\alpha$ is defined as
\begin{align*}
    \operatorname{pers}(\alpha) \overset{\operatorname{def}}{=} \operatorname{death}(\alpha) - \operatorname{birth}(\alpha).
\end{align*}

With the notions of $\operatorname{death}(\alpha)$ and $\operatorname{birth}(\alpha)$, the $k$-th PD of $\mathbb{K}$ with respect to $\varphi$ is defined as the following multiset of 2-dimensional points (see Definition 2 of \cite{mileyko2011probability}).
\begin{align}\label{Eq: def of PD}
    \operatorname{Dgm}_k(\mathbb{K};\varphi) \overset{\operatorname{def}}{=} \bigg\{\big( \operatorname{birth}(\alpha), \operatorname{death}(\alpha)\big) \,\bigg\vert\, \alpha\in H_k(\mathbb{K}_t) \mbox{ for some }t\in[0,T] \mbox{ with }\operatorname{pers}(\alpha)>0 \bigg\}\bigcup \mathfrak{D},
\end{align}
where $\big( \operatorname{birth}(\alpha_1), \operatorname{death}(\alpha_1) \big)$ and $\big( \operatorname{birth}(\alpha_2), \operatorname{death}(\alpha_2) \big)$ for $\alpha_1\ne\alpha_2$ are counted as two points even if $\alpha_1$ and $\alpha_2$ are born and die at the same times, respectively; that is, the multiplicity of the point $\big( \operatorname{birth}(\alpha_1), \operatorname{death}(\alpha_1) \big) = \big( \operatorname{birth}(\alpha_2), \operatorname{death}(\alpha_2) \big)$ is at least $2$; $\mathfrak{D}$ denotes the diagonal $\{(t,t)\,|\, t\in\mathbb{R}\}$ with the multiplicity of each point on this diagnal is the cardinality of $\mathbb{Z}$. Since $\operatorname{birth}(\alpha)$ is no later than $\operatorname{death}(\alpha)$, the PD $\operatorname{Dgm}_k(\mathbb{K};\varphi)$ is contained in the triangular region $\{(s,t)\in\mathbb{R}^2: 0\le s\le t\le T\}$.

\paragraph*{Condition (\ref{Eq: topological invariants boundedness condition}) in the definition of $\mathscr{S}_{R,d}^M$} \textit{The function $\phi_\nu$ defined in Eq.~\eqref{Eq: Morse function 1}, the corresponding PDs defined by Eq.~\eqref{Eq: def of PD}, and the definition of $\operatorname{pers}(\cdot)$ provide the details of condition (\ref{Eq: topological invariants boundedness condition}). The notation $\#\{\cdot\}$ counts the multiplicity of the corresponding multiset.}

Generally, a persistence diagram is a countable multiset of points in triangular region $\{(s,t)\in\mathbb{R}^2: 0\le s, t\le T \mbox{ and }s\le t\}$ along with $\mathfrak{D}$ (see Definition 2 of \cite{mileyko2011probability}). The collection of all persistence diagrams is denoted as $\mathscr{D}$. Obviously, all the $\operatorname{Dgm}_k(\mathbb{K};\varphi)$ defined in Eq.~\eqref{Eq: def of PD} is in $\mathscr{D}$. The following definition and stability result of the \textit{bottleneck distance} are from \cite{cohen2007stability}, and they will play important roles in the proof of Theorem \ref{lemma: The continuity lemma}.
\begin{definition}\label{def: bottleneck distance}
Let $\mathbb{K}$ be a compact topological space. $\varphi_1$ and $\varphi_2$ are two continuous real-valued functions on $\mathbb{K}$ such that $\mathbb{K}$ is tame with respect to both  $\varphi_1$ and $\varphi_2$. The bottleneck distance between PDs $\operatorname{Dgm}_k(\mathbb{K};\varphi_1)$ and $\operatorname{Dgm}_k(\mathbb{K};\varphi_2)$ is defined as
\begin{align*}
    W_\infty \Big(\operatorname{Dgm}_k(\mathbb{K};\varphi_1), \operatorname{Dgm}_k(\mathbb{K};\varphi_2) \Big) \overset{\operatorname{def}}{=} \inf_{\gamma} \Big(\sup \left\{\Vert \xi - \gamma(\xi) \Vert_{l^\infty} \, \Big\vert \, \xi\in \operatorname{Dgm}_k(\mathbb{K};\varphi_1)\right\} \Big),
\end{align*}
where $\gamma$ ranges over bijections from $\operatorname{Dgm}_k(\mathbb{K};\varphi_1)$ to $\operatorname{Dgm}_k(\mathbb{K};\varphi_2)$, and
\begin{align}\label{eq: def of l infinity norm}
    \Vert \xi\Vert_{l^\infty} \overset{\operatorname{def}}{=} \max\{\vert \xi_1\vert , \vert \xi_2\vert\},\ \ \mbox{ for all }\xi=(\xi_1, \xi_2)^\intercal\in\mathbb{R}^2.
\end{align}
\end{definition}
\begin{theorem}\label{thm: bottleneck stability}
Let $\mathbb{K}$ be a compact and triangulable topological space. $\varphi_1$ and $\varphi_2$ are two continuous real-valued functions on $\mathbb{K}$ such that $\mathbb{K}$ is tame with respect to both  $\varphi_1$ and $\varphi_2$. Then, we have the bottleneck distance as follows
\begin{align*}
    W_\infty \Big(\operatorname{Dgm}_k(\mathbb{K};\varphi_1), \operatorname{Dgm}_k(\mathbb{K};\varphi_2) \Big) \le \sup_{x\in\mathbb{K}} \left\vert \varphi_1(x) - \varphi_2(x) \right\vert.
\end{align*}
\end{theorem}

\section{Computation of SECT}\label{section: Computation of SECT Using the Čech Complexes}

\noindent Let $K \subset\mathbb{R}^d$ be a shape of interest. Suppose a finite set of points $\{x_i\}_{i=1}^I\subset K$ and a radius $r>0$ are properly chosen such that
\begin{align}\label{eq: ball unions approx shapes}
    \begin{aligned}
        & K_t^\nu = \left\{x\in K \, \vert \, x\cdot\nu \le t-R \right\} \approx \bigcup_{i\in \mathfrak{I}_t^\nu} \overline{B(x_i,r)},\ \ \mbox{ for all }t\in[0,T]\mbox{ and }\nu\in\mathbb{S}^{d-1},\\
    & \mbox{ where }\, \mathfrak{I}_t^\nu \overset{\operatorname{def}}{=} \left\{i\in\mathbb{N} \, \Big\vert \, 1\le i\le I \, \mbox{ and }\, x_i\cdot\nu\le t-R\right\},
    \end{aligned}
\end{align}
and $\overline{B(x_i,r)} := \{x\in\mathbb{R}^d:\Vert x-x_i\Vert\le r\}$ denotes a closed ball centered at $x_i$ with radius $r$. For example, when $d=2$, centers $x_i$ may be chosen as a subset of the grid points
\begin{align*}
    \left\{y_{j,j'} \overset{\operatorname{def}}{=} \left (-R+j\cdot\delta, \, -R+j'\cdot\delta \right)^\intercal \right\}_{j,j'=1}^J
\end{align*}
of the square $[-R,R]^2$ containing shape $K$, where $\delta=\frac{2R}{J}$ and radius $r=\delta$. Specifically,
\begin{align}\label{eq: approximation using grid points}
    K_t^\nu \approx \bigcup_{y_{j,j'}\in K_t^\nu} \overline{B\left(y_{j,j'}, \, \delta\right)}\ \ \mbox{ for all }t\in[0,T]\mbox{ and }\nu\in\mathbb{S}^{d-1},
\end{align}
which is a special case of Eq.~\eqref{eq: ball unions approx shapes}. The shape approximation in Eq.~\eqref{eq: approximation using grid points} is illustrated by Figures \ref{fig: Computing_SECT}(a) and (b).

\paragraph*{Čech complexes} The Čech Complex determined by the point set $\{x_i\}_{i\in \mathfrak{I}_t^\nu}$ and radius $r$ in Eq.~\eqref{eq: ball unions approx shapes} is defined as the following simplicial complex
\begin{align*
    \check{C}_r\left( \{x_i\}_{i\in \mathfrak{I}_t^\nu} \right) \overset{\operatorname{def}}{=} \left\{ \operatorname{conv}\left(\{x_i\}_{i\in s}\right) \, \Bigg\vert \, s\in 2^{\mathfrak{I}_t^\nu} \mbox{ and } \bigcap_{i\in s}\overline{B(x_i,r)}\ne\emptyset\right\},
\end{align*}
where $\operatorname{conv}\left(\{x_i\}_{i\in s}\right)$ denotes the convex hull generated by points $\{x_i\}_{i\in s}$. The nerve theorem (see Chapter III of \cite{edelsbrunner2010computational}) indicates that the Čech Complex $\check{C}_r\left( \{x_i\}_{i\in \mathfrak{I}_t^\nu} \right)$ and the union $\bigcup_{i\in \mathfrak{I}_t^\nu} \overline{B(x_i,r)}$ have the same homotopy type. Hence, they share the same Betti numbers, i.e.,
\begin{align*}
    \beta_k\Big(\check{C}_r\left( \{x_i\}_{i\in \mathfrak{I}_t^\nu} \right)\Big) = \beta_k\left(\bigcup_{i\in \mathfrak{I}_t^\nu} \overline{B(x_i,r)}\right),\ \ \mbox{ for all }k\in\mathbb{Z}.
\end{align*}
Using the shape approximation in Eq.~\eqref{eq: ball unions approx shapes}, we have the following approximation for ECC
\begin{align}\label{eq: ECC approximation using Cech complexes}
    \chi_t^{\nu}(K) \approx \sum_{k=0}^{d-1} (-1)^{k} \cdot \beta_k\Big(\check{C}_r\left( \{x_i\}_{i\in \mathfrak{I}_t^\nu} \right)\Big),\ \ \ t\in[0,T].
\end{align}
The method of computing the Betti numbers of simplicial complexes in Eq.~\eqref{eq: ECC approximation using Cech complexes} is standard and can be found in the literature (e.g., Chapter IV of \cite{edelsbrunner2010computational} and Section 3.1 of \cite{niyogi2008finding}). Then, the SECT of $K$ is estimated using Eq.~\eqref{Eq: definition of SECT}. The smoothing effect of the integrals in Eq.~\eqref{Eq: definition of SECT} reduces the estimation error.

\paragraph*{Computing the SECT for our proof-of-concept and simulation examples} For the shape $K^{(1)}$ defined in Eq. \eqref{eq: example shapes K1 and K2} of Section \ref{Proof-of-Concept Simulation Examples I: Deterministic Shapes}, we estimate the SECT of $K^{(1)}$ using the aforementioned Čech complex approach with the following setup: $R=\frac{3}{2}$, $r=\frac{1}{5}$, and the point set $\{x_i\}_i$ is equal to the following collection
\begin{align}\label{eq: the centers of our shape approximation}
     \left\{\left(\frac{2}{5}+\cos t_j, \sin t_j\right) \,\Bigg\vert\, t_j=\frac{\pi}{5}+\frac{j}{J}\cdot\frac{8\pi}{5}\right\}_{j=1}^J\bigcup\left\{\left(-\frac{2}{5}+\cos t_j, \sin t_j\right) \,\Bigg\vert\, \frac{6\pi}{5}+\frac{j}{J}\cdot\frac{8\pi}{5}\right\}_{j=1}^J,
\end{align}
where $J$ is a sufficiently large integer. We implement $J=100$ in our proof-of-concept example. Figure \ref{fig: Computing_SECT}(c) illustrates the shape approximation using this setup. The SECT for other shapes in our proof-of-concept/simulation examples is estimated in the similar way.

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.63]{Computing_SECT.pdf}
    \caption{Illustrations of the shape approximation in Eq.~\eqref{eq: ball unions approx shapes}. The shape $K$ of interest herein is equal to the $K^{(1)}$ defined in Eq.~\eqref{eq: example shapes K1 and K2} (see Figure \ref{fig: SECT visualizations, deterministic}(a) and the blue shape in the panel (c) herein). We set $R=\frac{3}{2}$, $t=1$, and $\nu=\left(\sqrt{2}/2,\, \sqrt{2}/2\right)^\intercal$. Panels (a) and (b) specifically illustrate the approximation in Eq.~\eqref{eq: approximation using grid points} using grid points, and the pink shapes in the two panels present the union $\bigcup_{y_{j,j'}\in K_t^\nu} \overline{B (y_{j,j'},\, \delta )}$ in Eq.~\eqref{eq: approximation using grid points}; in panel (a), $J=30$ (i.e., $\delta=0.1$); in panel (b), $J=100$ (i.e., $\delta=0.03$). Panel (c) illustrates the the approximation in Eq.~\eqref{eq: ball unions approx shapes} with centers $\{x_i\}_i$ being the points in Eq.~\eqref{eq: the centers of our shape approximation} and $r=\frac{1}{5}$. Each pink circle in panel (c) presents a ball $\overline{B(x_i, r)}$.}
    \label{fig: Computing_SECT}
\end{figure}

\section{Proofs}\label{section: appendix, proofs}

\paragraph*{Proof of Theorem \ref{thm: boundedness topological invariants theorem}} The following inclusion is straightforward
\begin{align*}
    \left\{\operatorname{Dgm}_k(K;\phi_{\nu})\cap (-\infty,t)\times(t,\infty)\right\} \subset \left\{\xi\in \operatorname{Dgm}_k(K;\phi_{\nu}) \, \vert \, \operatorname{pers}(\xi)>0\right\},
\end{align*}
where the definitions of $\operatorname{Dgm}_k(K;\phi_{\nu})$ and $\operatorname{pers}(\xi)$ are provided in Appendix \ref{The Relationship between PHT and SECT}. Together with the k-triangle lemma (see \cite{edelsbrunner2000topological} and \cite{cohen2007stability}), this inclusion implies
\begin{align*}
    \beta_k(K_t^\nu) &=\# \{\operatorname{Dgm}_k(K;\phi_{\nu})\cap (-\infty,t)\times(t,\infty)\} \\
    & \le \# \{\xi\in \operatorname{Dgm}_k(K;\phi_{\nu}) \, \vert \, \operatorname{pers}(\xi)>0\}\le\frac{M}{d},
\end{align*}
for all $k\in\{1,\cdots,d-1\}$, all $\nu\in\mathbb{S}^{d-1}$, and all $t$ that are not HCPs in direction $\nu$, where $\#\{\cdot\}$ counts the multiplicity of the multisets. Then, result (i) comes from the RCLL property of functions $\{\beta_k(K^\nu_{t})\}_{t\in[0,T]}$. Eq.~\eqref{Eq: first def of Euler characteristic curve} implies
\begin{align*}
    \sup_{\nu\in\mathbb{S}^{d-1}}\left(\sup_{0\le t\le T}\left\vert\chi_{t}^\nu(K)\right\vert\right) & = \sup_{\nu\in\mathbb{S}^{d-1}}\left(\sup_{0\le t\le T}\left\vert\sum_{k=0}^{d-1} (-1)^{k}\cdot\beta_k(K_t^{\nu})\right\vert\right) \\
    &\le \sup_{\nu\in\mathbb{S}^{d-1}}\left[\sup_{0\le t\le T} \left( d\cdot\sup_{k\in\{0,\cdots,d-1\}}\beta_k(K_t^{\nu})\right) \right] \le M,
\end{align*}
which follows from result (i) and gives result (ii). \hfill$\square$\smallskip

\paragraph*{Proof of Theorem \ref{thm: Sobolev function paths}} Because of
\begin{align*}
    \left\{\int_0^t \chi_\tau^\nu(K) d\tau\right\}_{t\in[0,T]} &\in\{\mbox{all absolutely continuous functions on }[0,T]\}\\
    &=\{x\in L^1([0,T]): \mbox{the weak derivative $x'$ exists and }x'\in L^1([0,T])\}\\
    & \overset{\operatorname{def}}{=} W^{1,1}([0,T])
\end{align*}
(see the Remark 8 after Proposition 8.3 in \cite{brezis2011functional} for details), the weak derivative of $\{\int_0^t \chi_\tau^\nu(K) d\tau\}_{t\in[0,T]}$ exists. This weak derivative is easily computed using the tameness of $K$, integration by parts, and the definition of weak derivatives. The proof of result (i) is completed. For the simplicity of notations, we denote
\begin{align*}
    F(t) \overset{\operatorname{def}}{=} \int_0^t\chi_\tau^\nu(K) d\tau - \frac{t}{T} \int_0^T \chi_\tau^\nu(K) d\tau, \ \ \mbox{ for }t\in[0,T].
\end{align*}
Theorem \ref{thm: boundedness topological invariants theorem} implies
\begin{align*}
    \vert F(t)\vert \le \int_0^T \vert\chi_\tau^\nu(K) \vert d\tau + \frac{t}{T} \int_0^T \vert\chi_\tau^\nu(K)\vert d\tau \le 2TM,\ \ \mbox{ for }t\in[0,T].
\end{align*}
Hence, $F\in L^p([0,T])$ for $p\in[1,\infty)$. Result (i) implies that the weak derivative of $F$ exists and is $F'(t)=\chi_t^\nu(K)-\frac{1}{T}\int_0^T \vert\chi_\tau^\nu(K)\vert d\tau$. We have the boundedness
\begin{align*}
    \vert F'(t)\vert \le \vert \chi_{t}^\nu(K) \vert + \frac{1}{T} \int_{0}^T \vert \chi_\tau^\nu(K)\vert d\tau \le 2M, \ \ \mbox{ for }t\in[0,T],
\end{align*}
which implies $F'\in L^p([0,T])$ for $p\in[1,\infty)$. Furthermore, $F(0)=F(T)=0$, together with the discussion above, implies $F\in W^{1,p}_0([0,T])$ for all $p\in[1,\infty)$ (see the Theorem 8.12 of \cite{brezis2011functional}). Theorem 8.8 and the Remark 8 after Proposition 8.3 in \cite{brezis2011functional} imply $W^{1,p}_0([0,T]) \subset \mathcal{B}$ for $p\in[1,\infty)$. Result (ii) follows. \hfill$\square$\smallskip
\medskip

The following lemmas are prepared for the proof of Theorem \ref{lemma: The continuity lemma}.
\begin{lemma}\label{lemma: stability lemma 1}
Suppose $K\in\mathscr{S}_{R,d}^M$. Then, we have the following estimate for all $t$ that are neither HCPs in direction $\nu_1$ nor HCPs in direction $\nu_2$.
\begin{align}\label{Eq: counting estimate}
\begin{aligned}
    & \Upsilon_k(t;\nu_1, \nu_2) \overset{\operatorname{def}}{=} \left\vert \beta_k(K_t^{\nu_1}) - \beta_k(K_t^{\nu_2}) \right\vert  \\
    & \le \#\left\{x\in \operatorname{Dgm}_k(K;\phi_{\nu_1}) \, \Big\vert \, x\ne\gamma^*(x) \mbox{ and } \underline{(x,\gamma^*(x))}\bigcap\partial\big((-\infty,t)\times(t,\infty)\big)\ne\emptyset\right\},
    \end{aligned}
\end{align}
where $\underline{(x,\gamma^*(x))}$ denotes the straight line segment connecting points $x$ and $\gamma^*(x)$ in $\mathbb{R}^2$, $\gamma^*$ is any optimal bijection such that
\begin{align}\label{eq: optimal bijection condition}
    W_\infty \Big(\operatorname{Dgm}_k(K;\phi_{\nu_1}), \operatorname{Dgm}_k(K;\phi_{\nu_2}) \Big) = \sup \Big\{\Vert \xi - \gamma^*(\xi) \Vert_{l^\infty} \, \Big\vert \, \xi\in \operatorname{Dgm}_k(\mathbb{K};\phi_{\nu_1})\Big\}
\end{align}
(see Definition \ref{def: bottleneck distance}, and $\Vert\cdot\Vert_{l^\infty}$ is defined in Eq.~\eqref{eq: def of l infinity norm}), and ``$\#$" counts the corresponding multiplicity.
\end{lemma}
\begin{remark}
Because $(\mathscr{D}, W_\infty)$ is a geodesic space, the optimal bijection $\gamma^*$ does exist (see Proposition 1 of \cite{turner2013means} and its proof therein).
\end{remark}
\begin{proof}
Since $t$ is not an HCP, neither $\operatorname{Dgm}_k(K;\phi_{\nu_1})$ nor $\operatorname{Dgm}_k(K;\phi_{\nu_2})$ has a point on the boundary $\partial\big((-\infty,t)\times(t,\infty)\big)$. If $\beta_k(K_t^{\nu_1}) = \beta_k(K_t^{\nu_2})$, Eq.~\eqref{Eq: counting estimate} is true. Otherwise, without loss of generality, we assume $\beta_k(K_t^{\nu_1}) > \beta_k(K_t^{\nu_2})$. Notice
\begin{align*}
    \beta_k(K_t^{\nu_i})=\#\left\{\operatorname{Dgm}_k(K;\phi_{\nu_i})\bigcap (-\infty,t)\times(t,\infty) \right\},\ \ \mbox{ for }i\in\{1,2\}.
\end{align*}
Let $\gamma^*$ be any optimal bijection, then there should be at least $\beta_k(K_t^{\nu_1}) - \beta_k(K_t^{\nu_2})$ straight line segments $\underline{(x,\gamma^*(x))}$ crossing $\partial\big((-\infty,t)\times(t,\infty)\big)$; otherwise, $\gamma^*$ is not bijective. Hence,
\begin{align*}
    &\beta_k(K_t^{\nu_1}) - \beta_k(K_t^{\nu_2}) \\
    & \le \#\left\{x\in \operatorname{Dgm}_k(K;\phi_{\nu_1})\,\Big\vert\, x\ne\gamma^*(x) \mbox{ and } \underline{(x,\gamma^*(x))}\bigcap\partial\big((-\infty,t)\times(t,\infty)\big)\ne\emptyset\right\},
\end{align*}
and Eq.~\eqref{Eq: counting estimate} follows.
\end{proof}

\begin{lemma}\label{lemma: stability lemma 2}
Suppose $K\in\mathscr{S}_{R,d}^M$. Except for finitely many $t$, we have
\begin{align*}
    \Upsilon_k(t;\nu_1, \nu_2) \le \frac{2M}{d} \cdot \mathbf{1}_{\mathcal{T}_k},\ \ \mbox{where}
\end{align*}
\begin{align*}
    \mathcal{T}_k \overset{\operatorname{def}}{=} \left\{t\in[0,T] \mbox{ not an HCP in direction }\nu_1\mbox{ or }\nu_2\,\Big\vert\, \mbox{there exists } x\in \operatorname{Dgm}_k(K;\phi_{\nu_1}) \mbox{ such that } x\ne\gamma^*(x) \right.
    \\ \left. \mbox{ and } \underline{(x,\gamma^*(x))}\bigcap\partial\big((-\infty,t)\times(t,\infty)\big)\ne\emptyset\right\},
\end{align*}
and $\gamma^*: \operatorname{Dgm}_k(K;\phi_{\nu_1})\rightarrow \operatorname{Dgm}_k(K;\phi_{\nu_2})$ is any optimal bijection satisfying Eq.~\eqref{eq: optimal bijection condition}.
\end{lemma}
\begin{proof}
Theorem \ref{thm: boundedness topological invariants theorem} implies
\begin{align*}
    \Upsilon_k(t;\nu_1, \nu_2) = \left\vert \beta_k(K_t^{\nu_1}) - \beta_k(K_t^{\nu_2}) \right\vert \le 2M/d.
\end{align*}
Furthermore, the inequality in Eq.~\eqref{Eq: counting estimate} indicates that $\Upsilon_k(t;\nu_1, \nu_2)=0$ if $t\notin\mathcal{T}_k$, except for finitely many HCPs in directions $\nu_1$ and $\nu_2$. Then the desired estimate follows.
\end{proof}

\paragraph*{Proof of Theorem \ref{lemma: The continuity lemma}} The definition of Euler characteristic (see Eq.~\eqref{Eq: first def of Euler characteristic curve}) and Lemma \ref{lemma: stability lemma 2} imply the following: for $p\in[1,\infty)$, we have
\begin{align}\label{Eq: estimate in proof}
    \begin{aligned}
        & \int_0^T \left\vert\Big\{\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\} \right\vert^p d\tau \\
        & = \int_0^T \left\vert \sum_{k=0}^{d-1} (-1)^k\cdot\Big(\beta_k(K_\tau^{\nu_1}) - \beta_k(K_\tau^{\nu_2}) \Big) \right\vert^p d\tau \\
    & \le \int_0^T \left(\sum_{k=0}^{d-1}\Upsilon_k(\tau;\nu_1,\nu_2)\right)^p d\tau \\
    & \le d^{(p-1)} \cdot \sum_{k=0}^{d-1} \int_0^T \Big(\Upsilon_k(\tau;\nu_1,\nu_2)\Big)^p d\tau \\
    & \le \frac{(2M)^p}{d} \cdot \sum_{k=0}^{d-1} \int_{\mathcal{T}_k} d\tau \\
    & \le \frac{(2M)^p}{d} \cdot \sum_{k=0}^{d-1} \left(\sum_{\xi\in \operatorname{Dgm}_k(K;\phi_{\nu_1})} 2\cdot\Vert \xi-\gamma^*(\xi)\Vert_{l^\infty}\right),
    \end{aligned}
\end{align}
where the last inequality follows from the definition of $\mathcal{T}_k$. Since $\Vert \xi-\gamma^*(\xi)\Vert_{l^\infty}$ can be positive only if $\operatorname{pers}(\xi)>0$ or $\operatorname{pers}(\gamma^*(\xi))>0$, there are at most $N$ terms $\Vert \xi-\gamma^*(\xi)\Vert_{l^\infty}>0$, where condition (\ref{Eq: topological invariants boundedness condition}) implies
\begin{align*}
    N \overset{\operatorname{def}}{=} \sum_{i=1}^2 \#\{\xi\in \operatorname{Dgm}_k(K;\phi_{\nu_i}) \,\vert \, \operatorname{pers}(\xi)>0\} \le 2M/d.
\end{align*}
Therefore, the inequality in Eq.~\eqref{Eq: estimate in proof} implies
\begin{align*}
    \int_0^T \left\vert\Big\{\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\} \right\vert^p d\tau & \le \frac{2 \cdot (2M)^{(p+1)}}{d} \cdot \sup\Big\{ \Vert \xi-\gamma^*(\xi)\Vert_{l^\infty} \,\Big\vert\, \xi\in Dym(\mathbb{K};\phi_{\nu_1})\Big\} \\
    & = \frac{2 \cdot (2M)^{(p+1)}}{d} \cdot W_\infty \Big(\operatorname{Dgm}_k(K;\phi_{\nu_1}), \operatorname{Dgm}_k(K;\phi_{\nu_2}) \Big).
\end{align*}
Then, Theorem \ref{thm: bottleneck stability} implies
\begin{align*}
    \int_0^T \left\vert\Big\{\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\} \right\vert^p d\tau \le \frac{2\cdot(2M)^{(p+1)}}{d} \cdot \sup_{x\in K} \vert x\cdot(\nu_1-\nu_2)\vert.
\end{align*}
Additionally, $\vert x\cdot(\nu_1-\nu_2)\vert\le \Vert x\Vert\cdot\Vert \nu_1-\nu_2\Vert$ and $K\subset\overline{B(0,R)}$ provide
\begin{align}\label{Eq: Continuity inequality lemma}
    \int_0^T \left\vert\Big\{\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\} \right\vert^p d\tau \le \frac{2 \cdot R \cdot (2M)^{(p+1)}}{d} \cdot \Vert \nu_1-\nu_2\Vert.
\end{align}
Define the constant $C^*_{M,R,d}$ as follows
\begin{align*}
    C^*_{M,R,d} \overset{\operatorname{def}}{=}  \sqrt{ \frac{16M^3R}{d} + \frac{32M^3R}{d} + \frac{64 M^4 R}{d^2} } .
\end{align*}
Setting $p=2$, Eq.~\eqref{Eq: Continuity inequality lemma} implies the following
\begin{align*}
    \left( \int_0^T \left\vert\Big\{\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\} \right\vert^2 d\tau \right)^{1/2} \le \sqrt{ \frac{16M^3R}{d} \cdot \Vert \nu_1-\nu_2\Vert } \le C^*_{M,R,d} \cdot \sqrt{\Vert \nu_1-\nu_2\Vert},
\end{align*}
which is the inequality in Eq.~\eqref{Eq: continuity inequality}.

The definition of $SECT(K)$, together with Eq.~\eqref{Eq: Continuity inequality lemma}, implies
\begin{align*}
& \Big\Vert SECT(K)(\nu_1) - SECT(K)(\nu_2) \Big\Vert^2_{\mathcal{H}} \\
    & = \int_0^T \left\vert  \frac{d}{dt}SECT(K)(\nu_1;t) - \frac{d}{dt}SECT(K)(\nu_2;t) \right\vert^2 dt \\
    & = \int_0^T \left\vert  \Big(\chi_t^{\nu_1}(K)-\chi_t^{\nu_2}(K)\Big) - \frac{1}{T} \int_0^T \Big(\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big) d\tau \right\vert^2 dt\\
    & \le \int_0^T \left( \Big\vert\chi_t^{\nu_1}(K)-\chi_t^{\nu_2}(K)\Big\vert + \frac{1}{T} \int_0^T \Big\vert\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\vert d\tau \right)^2 dt \\
    & \le 2\int_0^T  \Big\vert\chi_t^{\nu_1}(K)-\chi_t^{\nu_2}(K)\Big\vert^2 dt + \frac{2}{T}\left(\int_0^T \Big\vert\chi_\tau^{\nu_1}(K)-\chi_\tau^{\nu_2}(K)\Big\vert d\tau \right)^2 \\
    & \le \frac{32M^3R}{d} \cdot \Vert \nu_1 - \nu_2\Vert + \frac{64 M^4 R}{d^2} \cdot \Vert
    \nu_1-\nu_2 \Vert^2,
\end{align*}
where the last inequality above comes from Eq.~\eqref{Eq: Continuity inequality lemma}. Then, we have
\begin{align*}
    & \Big\Vert SECT(K)(\nu_1) - SECT(K)(\nu_2) \Big\Vert_{\mathcal{H}} \\
    & \le \sqrt{ \frac{32M^3R}{d} \cdot \Vert \nu_1 - \nu_2\Vert + \frac{64 M^4 R}{d^2} \cdot \Vert
    \nu_1-\nu_2 \Vert^2 } \\
    & \le C^*_{M,R,d} \cdot \sqrt{ \Vert \nu_1 - \nu_2\Vert + \Vert
    \nu_1-\nu_2 \Vert^2 }.
\end{align*}
The proof of the second inequality in result (i) is completed.

The law of cosines and Taylor's expansion indicates
\begin{align*}
    \frac{\Vert \nu_1-\nu_2 \Vert}{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)} & = \sqrt{ 2 \cdot \frac{1-\cos\left(d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)\right)}{\left\{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)\right\}^2} }\\
    & = \sqrt{ 2 \cdot \left[ \sum_{n=1}^\infty \frac{(-1)^{n+1}}{(2n)!} \cdot \Big\{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)\Big\}^{2n-2} \right] } = O(1).
\end{align*}
Then, result (ii) comes from the following
\begin{align}\label{eq: 1/2 Holder argument}
    \begin{aligned}
        & \frac{\Vert SECT(K)(\nu_1)-SECT(K)(\nu_2) \Vert_{\mathcal{H}}}{\sqrt{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)}}\\
    & \le C^*_{M,R,d} \cdot \sqrt{ \frac{\Vert \nu_1 - \nu_2\Vert}{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)} + \frac{\Vert
    \nu_1-\nu_2 \Vert^2}{d_{\mathbb{S}^{d-1}}(\nu_1, \nu_2)} }=O(1).
    \end{aligned}
\end{align}
We consider the following inequality for all $\nu_1,\nu_2\in\mathbb{S}^{d-1}$ and $t_1, t_2\in[0,T]$
\begin{align}\label{eq: pm terms for Holder}
        \begin{aligned}
            &\vert SECT(K)(\nu_1; t_1)-SECT(K)(\nu_2; t_2)\vert\\
    &\le \vert SECT(K)(\nu_1; t_1)-SECT(K)(\nu_1; t_2)\vert\\
    & + \vert SECT(K)(\nu_1; t_2)-SECT(K)(\nu_2; t_2)\vert\\
    & \overset{\operatorname{def}}{=} I+II.
        \end{aligned}
\end{align}
From the definition of $\Vert\cdot\Vert_{C^{0,\frac{1}{2}}([0,T])}$ and Eq.~\eqref{eq: Sobolev embedding from Morrey}, we have
\begin{align*}
    & \sup_{t_1, t_2\in[0,T], \, t_1\ne t_2}\frac{\vert SECT(K)(\nu_1; t_1)-SECT(K)(\nu_1; t_2)\vert}{\vert t_1-t_2 \vert^{1/2}} \\
    & \le \Vert SECT(K)(\nu_1)\Vert_{C^{0,\frac{1}{2}}([0,T])}\\
    & \le \Tilde{C}_T  \Vert SECT(K)(\nu_1)\Vert_\mathcal{H}\\
    & \le \Tilde{C}_T  \Vert SECT(K)\Vert_{C(\mathbb{S}^{d-1};\mathcal{H})},
\end{align*}
which implies $I\le \Tilde{C}_T  \Vert SECT(K)\Vert_{C(\mathbb{S}^{d-1};\mathcal{H})} \cdot \vert t_1-t_2 \vert^{1/2}$ for all $t_1, t_2\in[0,T]$. Applying Eq.~\eqref{eq: Sobolev embedding from Morrey} again, we have
\begin{align*}
    II & \le \Vert SECT(K)(\nu_1)-SECT(K)(\nu_2)\Vert_{\mathcal{B}} \\
    & \le \Tilde{C}_T \Vert SECT(K)(\nu_1)-SECT(K)(\nu_2)\Vert_{\mathcal{H}}.
\end{align*}
Then, the inequality in Eq.~\eqref{eq: bivariate Holder continuity} follows from Eq.~\eqref{eq: pm terms for Holder} and result (ii). With an argument similar to Eq.~\eqref{eq: 1/2 Holder argument}, the function $(\nu,t)\mapsto SECT(K)(\nu;t)$ belongs to $C^{0,\frac{1}{2}}(\mathbb{S}^{d-1}\times[0,T];\mathbb{R})$. The proof of Theorem \ref{lemma: The continuity lemma} is completed. \hfill$\square$\smallskip

The proof of Theorem \ref{thm: invertibility} needs the following concepts, which can be found in \cite{andradas2012constructible}.
\begin{definition}\label{Definition: constructible sets}
(Constructible sets) (i) A locally closed set is a subset of a topological space that is the intersection of an open and a closed subset. (ii) A constructible set is a finite union of the aforementioned locally closed sets.
\end{definition}
\paragraph*{Proof of Theorem \ref{thm: invertibility}} Since $K\in\mathscr{S}_{R,d}^M$ is a triangulable subset of $\mathbb{R}^d$, the shape $K$ is homeomorphic to a polygon $\vert S\vert = \bigcup_{s\in S} s \subset\mathbb{R}^d$, where $S$ is a finite simplicial complex and each $s$ is a simplex. We may assume $K=\vert S\vert$ without loss of generality. Since $s=s\bigcap\mathbb{R}^d$, each simplex $s$ is a locally closed set; hence, $K$ is constructible (see Definition \ref{Definition: constructible sets}). Then, Corollary 6 of \cite{ghrist2018persistent} implies the desired result. \hfill$\square$\smallskip

\paragraph*{Proof of Theorem \ref{Thm: metric theorem for shapes}} The triangle inequalities and symmetry of $\rho$ follow from that of the metric of $C(\mathbb{S}^{d-1};\mathcal{H})$. Equation $\rho(K_1, K_2)=0$ indicates $\Vert PECT(K_1)(\nu)-PECT(K_2)(\nu)\Vert_{\mathcal{H}_{BM}}=0$ for all $\nu\in\mathbb{S}^{d-1}$. \cite{evans2010partial} (Theorem 5 of Chapter 5.6) implies $\Vert PECT(K_1)(\nu)-PECT(K_2)(\nu)\Vert_{\mathcal{B}}=0$ for all $\nu\in\mathbb{S}^{d-1}$. Then, we have $\int_0^t\chi_\tau^\nu(K_1) d\tau=\int_0^t\chi_\tau^\nu(K_2) d\tau$ for all $t\in[0,T]$ and $\nu\in\mathbb{S}^{d-1}$; hence, $SECT(K_1)=SECT(K_2)$. Then the invertibility in Theorem \ref{thm: invertibility} implies $K_1=K_2$. Therefore, $\rho$ is a distance, and the proof of result (i) is completed.

The proof of result (ii) is motivated by the following chain of maps for any fixed $\nu\in\mathbb{S}^{d-1}$ and $t\in[0,T]$.
\begin{align*}
    & \mathscr{S}_{R,d}^M \ \ \ \xrightarrow{PECT}\ \ \  C(\mathbb{S}^{d-1};\mathcal{H}_{BM})\ \ \  \xrightarrow{\text{projection}}\ \ \  \mathcal{H}_{BM}\mbox{, which is embedded into }\mathcal{B} \ \ \  \xrightarrow{\text{projection}} \ \ \mathbb{R}, \\
    & K \mapsto \left\{PECT(K)(\nu')\right\}_{\nu'\in\mathbb{S}^{d-1}} \mapsto \left\{PECT(K)(\nu;t') \right\}_{t'\in[0,T]} \ \mapsto PECT(K)(\nu;t)=\int_0^{t} \chi_{\tau}^\nu(K) d\tau,
\end{align*}
where all spaces above are metric spaces and equipped with their Borel algebras. We notice the following facts:
\begin{itemize}
    \item mapping $PECT: \mathscr{S}_{R,d}^M \rightarrow C(\mathbb{S}^{d-1}; \mathcal{H}_{BM})$ is isometric;
    \item projection $C(\mathbb{S}^{d-1};\mathcal{H}_{BM})\rightarrow\mathcal{H}_{BM}, \, \{F(\nu')\}_{\nu'\in\mathbb{S}^{d-1}}\mapsto F(\nu)$ is continuous for each fixed direction $\nu$;
    \item applying \cite{evans2010partial} (Theorem 5 of Chapter 5.6) again, the embedding $\mathcal{H}_{BM}\rightarrow\mathcal{B}, \, F(\nu) \mapsto F(\nu)$ is continuous;
    \item projection $\mathcal{B}\rightarrow \mathbb{R}, \{x(t')\}_{t'\in[0,T]}\mapsto x(t)$ is continuous.
\end{itemize}
Therefore, $\mathscr{S}_{R,d}^M\rightarrow\mathbb{R}, K\mapsto PECT(K)(\nu,t)$ is continuous, hence measurable. Because $\chi_{(\cdot)}^\nu(K)$, for each $K\in\mathscr{S}_{R,d}^M$, is a RCLL step function with finitely many discontinuities,
\begin{align*}
    \chi^\nu_{t}(K)=\lim_{n\rightarrow\infty}\left[\frac{1}{\delta_n}\left
\{PECT(K)(\nu;t+\delta_n)-PECT(K)(\nu;t)\right\}\right],
\end{align*}
for all $K\in\mathscr{S}_{R,d}^M$, where $\lim_{n\rightarrow\infty}\delta_n=0$ and $\delta_n>0$. The measurability of $PECT(\cdot)(\nu;t+\delta_n)$ and $PECT(\cdot)(\nu;t)$ implies that $\chi_t^\nu(\cdot): \mathscr{S}_{R,d}^M\rightarrow\mathbb{R}, K\mapsto \chi_t^\nu(K)$ is measurable, for any fixed $\nu$ and $t$. The proof of result (ii) is completed. \hfill$\square$\smallskip
\medskip

\paragraph*{Proof of Theorem \ref{thm: mean is in H}} For each fixed direction $\nu\in\mathbb{S}^{d-1}$, Theorem \ref{thm: SECT distribution theorem in each direction} indicates that the mapping $SECT(\cdot)(\nu): K\mapsto SECT(K)(\nu)$ is an $\mathcal{H}$-valued measurable function defined on the probability space $(\mathscr{S}_{R,d}^M, \mathscr{F}, \mathbb{P})$. We first show the Bochner $\mathbb{P}$-integrability of $SECT(\cdot)(\nu)$ (see Section 5 in Chapter V of \cite{yosida1965functional} for the definition of Bochner $\mathbb{P}$-integrability), and the Bochner integral of $SECT(\cdot)(\nu)$ will be fundamental to our proof of Theorem \ref{thm: mean is in H}. Lemma 1.3 of \cite{da2014stochastic} indicates that $SECT(\cdot)(\nu)$ is strongly $\mathscr{F}$-measurable (see Section 4 in Chapter V of \cite{yosida1965functional} for the definition of strong $\mathscr{F}$-measurability). Then, Assumption \ref{assumption: existence of second moments} indicates that the Bochner integral
\begin{align*}
    m^*_\nu \overset{\operatorname{def}}{=} \int_{\mathscr{S}_{R,d}^M} SECT(K)(\nu)\mathbb{P}(dK)
\end{align*}
is Bochner $\mathbb{P}$-integrable and $m^*_\nu \in\mathcal{H}$ (see \cite{yosida1965functional}, Section 5 of Chapter V, Theorem 1 therein particularly). The Corollary 2 in Section 5 of Chapter V of \cite{yosida1965functional}, together with that $\mathcal{H}$ is the RKHS generated by the kernel $\kappa(\cdot,\cdot)$ defined in Eq.~\eqref{Eq: kernel of the Brownian bridge}, implies
\begin{align*}
    m^*_\nu(t) &= \langle \kappa(t,\cdot), m^*_\nu \rangle \\
    & = \int_{\mathscr{S}_{R,d}^M} \Big\langle \kappa(t,\cdot), SECT(K)(\nu) \Big\rangle \mathbb{P}(dK) \\
    & =\int_{\mathscr{S}_{R,d}^M} SECT(K)(\nu;t)\mathbb{P}(dK) \\
    & = \mathbb{E}\left\{ SECT(\cdot)(\nu;t)\right\} =m_\nu(t),\ \ \mbox{ for all }t\in[0,T].
\end{align*}
Therefore, $m_\nu=m^*_\nu\in\mathcal{H}$. The proof of result (i) is completed.

To prove result (ii), we first show the product measurability of the following map for each fixed direction $\nu\in\mathbb{S}^{d-1}$
\begin{align}\label{eq: product measurability}
    \begin{aligned}
        & \Big(\mathscr{S}_{R,d}^M \times [0,T], \mathscr{F}\times \mathscr{B}([0,T])\Big)\ \  \rightarrow \ \ (\mathbb{R}, \mathscr{B}(\mathbb{R})),\\
    & (K,t) \ \ \mapsto \ \ SECT(K)(\nu;t),
    \end{aligned}
\end{align}
where $\mathscr{F}\times \mathscr{B}([0,T])$ denotes the product $\sigma$-algebra generated by $\mathscr{F}$ and $\mathscr{B}([0,T])$. Define the filtration $\{\mathscr{F}_t\}_{t\in[0,T]}$ by $\mathscr{F}_t=\sigma(\{SECT(\cdot)(\nu;t')\,\vert\, t'\in[0,t]\})$ for $t\in[0,T]$. Because the paths of $SECT(\cdot)(\nu)$ are in $\mathcal{H}$, these paths are continuous (see Eq.~\eqref{eq: H, Holder, B embeddings}). Proposition 1.13 of \cite{karatzas2012brownian} implies that the stochastic process $SECT(\cdot)(\nu)$ is progressively measurable with respect to the filtration $\{\mathscr{F}_t\}_{t\in[0,T]}$. Then, the mapping in Eq.~\eqref{eq: product measurability} is measurable with respect to the product $\sigma$-algebra $\mathscr{F}\times \mathscr{B}([0,T])$ (see \cite{karatzas2012brownian}, particularly Definitions 1.6 and 1.11, also the paragraph right after Definition 1.11 therein). Eq.~\eqref{eq: finite second moments for all v and t} implies
\begin{align*}
    \int_0^T \int_{\mathscr{S}_{R,d}^M} \vert SECT(K)(\nu;t)\vert^2 \mathbb{P}(dK) dt \le T \cdot \Tilde{C}^2_T \cdot \mathbb{E}\Vert SECT(\cdot)(\nu)\Vert^2_{\mathcal{H}}<\infty,
\end{align*}
where the double integral is well-defined because of the product measurability of the mapping in Eq.~\eqref{eq: product measurability} and the Fubini's theorem. Then, the proof of result (ii) is completed.

For any $\nu_1,\nu_2\in\mathbb{S}^{d-1}$, the proof of result (i) implies the following Bochner integral representation
\begin{align*}
    \Vert m_{\nu_1} - m_{\nu_2} \Vert_{\mathcal{H}} & = \left\Vert \int_{\mathscr{S}_{R,d}^M} SECT(K)(\nu_1) - SECT(K)(\nu_2) \mathbb{P}(dK) \right\Vert_{\mathcal{H}} \\
    & \overset{(1)}{\le} \int_{\mathscr{S}_{R,d}^M} \Big\Vert SECT(K)(\nu_1) - SECT(K)(\nu_2) \Big\Vert_{\mathcal{H}} \mathbb{P}(dK) \\
    & \overset{(2)}{\le} C^*_{M,R,d} \cdot \sqrt{ \Vert \nu_1 - \nu_2\Vert + \Vert
    \nu_1-\nu_2 \Vert^2 },
\end{align*}
where the inequality (1) follows from the Corollary 1 in Section 5 of Chapter V of \cite{yosida1965functional}, and the inequality (2) follows from Theorem \ref{lemma: The continuity lemma} (i). With the argument in Eq.~\eqref{eq: 1/2 Holder argument}, the proof of result (iii) is completed.
\hfill$\square$\smallskip

\end{appendix}

\clearpage
\newpage