Abstract—To develop statistical methods for shapes with a tree-structure, we construct a shape space framework for tree-shapes and study metrics on the shape space. This shape space has singularities which correspond to topological transitions in the represented trees. We study two closely related metrics on the shape space, TED and QED. QED is a quotient euclidean distance arising naturally from the shape space formulation, while TED is the classical tree edit distance. Using Gromov's metric geometry, we gain new insight into the geometries defined by TED and QED. We show that the new metric QED has nice geometric properties that are needed for statistical analysis: Geodesics always exist and are generically locally unique. Following this, we can also show the existence and generic local uniqueness of average trees for QED. TED, while having some algorithmic advantages, does not share these advantages. Along with the theoretical framework we provide experimental proof-of-concept results on synthetic data trees as well as small airway trees from pulmonary CT scans. This way, we illustrate that our framework has promising theoretical and qualitative properties necessary to build a theory of statistical tree-shape analysis.
Tree-shaped objects are fundamental in nature where they appear, e.g., as delivery systems for gases and fluids [
^{24}], as skeletal structures, or hierarchies. Examples encountered in image analysis and computational biology are airway trees [
^{14}], [
^{25}], [
^{37}], vascular systems [
^{7}], shock graphs [
^{3}], [
^{31}], [
^{36}], scale space hierarchies [
^{8}], and phylogenetic trees [
^{5}], [
^{17}], [
^{28}].
Statistical methods for tree-structured data would have a wide range of applications. For instance, more consistent studies of changes in airway geometry and structure related to airway disease [
^{33}], [
^{40}] could improve tools for computer-aided diagnosis and prognosis.
Due to the wide range of applications, extensive work has been done in the past 20 years on comparison of trees and graphs in terms of matching [
^{14}], [
^{25}], object recognition [
^{8}], and machine learning [
^{15}], [
^{18}], [
^{29}] based on intertree distances. However, most existing tree-distance frameworks are algorithmic rather than geometric. Very few attempts [
^{2}], [
^{27}], [
^{39}] have been made to build analogues of the theory for landmark point shape spaces using manifold statistics and Riemannian submersions [
^{20}], [
^{21}], [
^{32}]. There exists no principled general approach to studying the space of tree-structured data, and as a consequence, the standard statistical properties are not well defined. As we shall see, difficulties appear even in the basic problem of finding the average of two tree-shapes. This paper starts to fill the gap by introducing a shape-theoretical framework for geometric trees, which is suitable for statistical analysis.
Most statistical measurements are based on a concept of distance. The most fundamental statistic is the
mean (or prototype)
for a dataset
, which can be defined as the minimizer of the sum of squared distances to the data points:
(1)
This definition of the mean, called the
Fréchet mean, assumes a space of tree-shapes endowed with a distance
, and is closely connected to geodesics, or shortest paths, between tree-shapes. For example, the midpoint of a geodesic from
to
is a mean for the two-point dataset
. Hence, if there are multiple geodesics connecting
to
, with different midpoints, then there will also be multiple means.
As a consequence, without (local, generic) uniqueness of geodesics, most statistical properties are fundamentally ill posed! Thus, geometry enters the picture, and the idea of a geodesic tree-space gives a constraint on the possible geometric structure of tree-space. In a shape space where distances are given by the shortest path length, we must be able to continuously deform any given tree-shape into any other by traveling along the shortest path that connects the two shapes. The deformation paths are easy to describe when only branch shape is changed, while tree topology (branch connectivity) is fixed. Such deformations take place in portions of tree-space where all trees have the same topological structure. It is more challenging to describe deformation paths in which the tree-topological structure is changed, for instance, through a collapsed internal branch as in
Fig. 1. We model topologically intermediate trees as collapsed versions of trees with differing tree topology. Different portions of tree-space are glued together along subspaces that correspond to collapsed trees, as in
Fig. 2. As a consequence, tree-space has self-intersections and is not smooth, but has singularities.
Fig. 1. A good metric must handle edge matchings that are inconsistent with tree topology.
Fig. 2. Continuous transitions in tree topology: Tree-shapes with different tree topology live in different components of tree-space. Paths in different components can terminate in identical collapsed tree-shapes. To identify these, the tree-space components are glued together along subsets with the collapsed tree-shapes.
The main theoretical contributions of this paper are the construction of a mathematical tree-shape framework along with a geometric analysis of two natural metrics on the shape space. One of these metrics is the classical tree edit distance (TED), into which we gain new insight. The second metric, called quotient euclidean distance (QED), is induced from a euclidean metric. Using Gromov's approach to metric geometry [
^{16}], we show that QED generically gives locally unique geodesics and means, whereas finding geodesics and means for TED is ill-posed even locally. We explain why using TED for computing average trees must always be accompanied by a carefully engineered choice of edit paths to give unique results, choices which can yield average trees that are substantially different from the trees in the dataset [
^{36}]. The QED approach, on the contrary, allows us to investigate statistical methods for tree-like structures that have previously not been possible, like different well-defined concepts of average tree. This is our motivation for studying the QED metric.
The paper is organized as follows: In Section 1.1, we discuss related work. The tree-space is defined in Sections 2 and 3, and the geometric and statistical properties of tree-space are analyzed in Section 4. In Section 5, we discuss practical computation of geodesics in both metrics, and present a simple QED approximation. In Section 6, we illustrate the properties of QED by computing geodesics and different types of average tree for synthetic planar data trees as well as by computing QED means for sets of small 3D airway trees from human lungs. We finish with a discussion and conclusions in Section 7.
1.1 Related Work
Metrics on sets of tree-structured data have been studied by different research communities for the past 20 years. The best-known approach is perhaps TED, which has been used extensively for shape matching and recognition based on medial axes and shock graphs [
^{31}], [
^{36}]. TED and, more generally, graph edit distance (GED) are also popular in the pattern recognition community and are still used for distance-based pattern recognition approaches to trees and graphs [
^{15}], [
^{29}]. The TED and GED metrics will nearly always have infinitely many shortest edit paths, or geodesics, between two given trees because edit operations can be performed in different orders and increments. As a result, even the problem of finding the average of two trees is not well posed. With no kind of uniqueness of geodesics, it becomes hard to meaningfully define and compute average shapes or modes of variation. This problem can be solved to some extent by choosing a preferred edit path [
^{15}], [
^{29}], [
^{36}], but there will always be a risk that the choice has negative consequences in a given setting. Trinh and Kimia [
^{36}] face this problem when they use TED for computing average medial axes using the simplest possible edit paths, leading to average shapes that can be substantially different from most of the dataset shapes.
Statistics on tree-shaped objects is receiving growing interest in the statistical community. Wang and Marron [
^{39}] study metric spaces of trees and define a notion of average tree called the median-mean as well as a version of PCA which finds modes of variation in terms of
tree lines, encoding the maximum amount of structural and attributal variation. Aydin et al. [
^{2}] extend this work by finding efficient algorithms for PCA. This is applied to analysis of brain blood vessels. The metric defined by Wang and Marron does not give a natural geodesic structure on the space of trees as it places a large emphasis on the tree-topological structure of the trees. The metric has discontinuities in the sense that a sequence of trees with a shrinking branch will not converge to a tree that does not have that branch. Such a metric is not suitable for studying trees with continuous topological variations and noise, such as anatomical tree structures extracted from medical images, because the emphasis on topology makes the metric sensitive to structural noise.
A more general problem is analysis of graphs, where a substantial amount of work has also been done. Baloch and Krim [
^{4}] analyze the geometry and topology of shapes from their skeletal graphs using Morse theory. Jain and Obermayer [
^{18}] study metrics on attributed graphs, represented as incidence matrices. The space of graphs is defined as a quotient of the euclidean space of incidence matrices by the group of vertex permutations. The graph space inherits the euclidean metric, giving it the structure of an orbifold. This construction is similar to the tree-space presented in this paper in the sense that both spaces are constructed as quotients of a euclidean space. The graph-space framework does not, however, give continuous transitions in internal graph-topological structure, which leads to large differences between the geometries of the tree and graph spaces.
Trees also appear in genetics. Hillis et al. [
^{17}] visualize sets of phylogenetic trees using multidimensional scaling. Billera et al. [
^{5}] invented a geodesic phylogenetic tree-space for analysis of phylogenetic trees, and Owen and Provan [
^{28}] have developed fast algorithms for computing geodesics in phylogenetic tree-space. Nye [
^{27}] developed the first notion of PCA in phylogenetic tree-space, but makes strict assumptions on principle components being "simple lines" for the sake of computability. Phylogenetic trees are not geometric, and have fixed, labeled leaf sets, making the space of phylogenetic trees much simpler than the space of tree-shapes.
We have previously [
^{12}], [
^{13}] studied geodesics between small tree-shapes in the same type of singular shape space as studied here, but most proofs have been left out. In [
^{11}], we study different algorithms for computing average trees based on the QED metric. This paper extends and continues [
^{12}], giving proofs, in-depth explanations, and more extensive examples illustrating the potential of the QED metric.
2. The Space of Ordered Tree-Shapes
Let us discuss which properties are desirable for a tree-shape model. We require some form of existence and uniqueness of geodesics to compute average trees and analyze variation in datasets. When geodesics exist, we want the topological structure of the intermediate trees along the geodesic to reflect the resemblance in structure of the trees being compared. In particular,
a geodesic passing through the trivial one-vertex tree should indicate that the trees being compared are maximally different. We want to compare trees where the desired edge matching is inconsistent with tree topology, as in
Fig. 1a, which requires geodesic deformations in which the tree topology changes, e.g., as in
Fig. 1b.
2.1 Representation of Trees
In this paper, a "tree-shape" is an embedded tree in
or
, and consists of a series of edge embeddings, connected as determined by a rooted, ordered combinatorial tree. Tree shapes are invariant to translation, but our definition of tree-shape does not remove scale and rotation. However, tree-shapes can always be aligned with respect to scale and rotation prior to comparison.
Any tree-shape is represented as a pair
consisting of a rooted, planar tree
with edge attributes
. In
,
is the vertex set,
is the edge set, and
is the root vertex. The tree
describes the tree-shape topology and the attributes describe edge shape, as illustrated in
Fig. 3. The shape attributes, represented by a point
in the product space
, is a concatenation of edgewise attributes from an attribute space
. The attributes could, e.g., be edge length, landmark points, or edge parameterizations. In this work, we use open curves translated to start at the origin, described by a fixed number of landmark points along the edge. Thus, throughout the paper, the attribute space
is
, where
or 3 and
is the number of landmark points per edge. Collapsed edges are represented by a sequence of origin points. In some illustrations, we shall use scalar attributes for the sake of visualization, in which case
.
Fig. 3. Tree-shapes are encoded by an ordered binary tree and a set of attributes describing edge shape.
To compare trees of different sizes and structures, we need to represent them in a unified way. We describe all shapes using the
same tree
to encode tree topology. By choosing a sufficiently large
, we can represent all the trees in our dataset by filling out with empty (collapsed) edges. We call
the maximal tree.
We model tree-shapes using
binary maximal trees
. Tree-shapes which are not binary are represented by the binary tree
in a natural way by allowing constant, or collapsed, edges, represented by the zero scalar or vector attribute. In this way,
an arbitrary attributed tree can be represented as an attributedbinarytree, see
Fig. 4a. This is geometrically very natural. Binary trees are geometrically
stable in the sense that small perturbations of a binary tree-shape do not change the tree-topological structure of the shape. Conversely, a trifurcation or higher-order vertex can always be turned into a series of bifurcations sitting close together by an arbitrarily small perturbation. Thus, in our representation, trifurcations are represented as two bifurcations sitting infinitely close together, and so on.
Fig. 4. (a) Higher-degree vertices are represented by collapsing internal edges (dotted line = zero attribute = collapsed edge). We identify those tree preshapes whose collapsed structures are identical: The preshapes and represent the same tree-shape . (b) The tree deformation shown in the top row does not correspond to a path in as the two representations of the intermediate tree are found at distinct points in . (c) The simplest nontrivial tree-shape space, consisting of ordered trees with two edges with scalar attributes. Along the - and -axes are trees with a single branch. For each real number , the tree-shape found at is also represented at . We build the tree-shape space by gluing the different representations of the same tree-shapes (e.g., and ) together, obtaining the shape space shown on the right. Note the path from to through in on the right; the corresponding path in the preshape space involves a "teleportation" between the representations and of .
Trees embedded in the plane have a natural left-right order on the children of any edge. We say that a tree is
ordered whenever each set of sibling edges in the tree is endowed with such a total order. Conversely, an ordered combinatorial tree always has a unique, implicit embedding in the plane, where siblings are ordered from left to right. For this reason, we use the terms "planar tree" and "ordered tree" interchangingly. We first study metrics on the set of ordered binary trees, which are heavily studied in pattern recognition and vision [
^{3}], [
^{31}], [
^{36}]. Next, we induce distances between unordered trees by considering all possible orders, allowing us to model trees in
. Considering all orders leads to computational challenges, which are discussed in Section 5.
To build a space of tree-shapes, fix an ordered maximal binary tree
with edges
, which encodes the connectivity of all our trees. Any attributed tree
is now represented by a point
in
, where the coordinate
describes the shape of the edge
. Since we allow zero-attributed edges, some tree-shapes will be represented by several points in
(
Fig. 4a). As a result, some natural tree deformations are not found as continuous paths in
. In
Figs. 4b and
4c, the paths in
corresponding to the indicated deformations require a "teleportation" between two representations of the intermediate tree-shape. We tackle this by using a refined tree-shape space
, where different representations of the same tree-shape are identified as being the same point. The original space
is called the tree preshape space, analogous to Kendall's terminology [
^{20}].
2.2 The Singular Space of Ordered Tree-Shapes
We go from preshapes to shapes by identifying those preshapes which define the same shape.
Consider two ordered tree-shapes with collapsed edges. Replace their binary representations by collapsed representations, where the zero attributed edges have been removed. The orders of the original trees induce well-defined orders on the collapsed trees. We say that two ordered tree-shapes are
the same when their collapsed ordered, attributed versions are identical, as in
Fig. 4a. More precisely, given a preshape tree
, denote by
(2)
the set of noncollapsed edges with nonzero attributes of
. Given two preshape trees
, we say that
is equivalent to
, and write
if there exists an order-preserving bijection preserving edge attributes:
(3)
Showing that
is actually an equivalence relation is trivial. The quotient space
(4)
of equivalence classes
of ordered-preshape trees is the space of ordered trees.
Quotient spaces are standard constructions from topology and geometry [
^{6}, Chapter 1.5]. The geometric interpretation of the tree-space quotient is that we "glue" the preshape space along the identified subspaces; that is, when
, we "glue" the two points
and
together. See
Fig. 4c for an illustration.
Identification of preshape trees extends to entire subspaces of
. Indeed, associated to
is the subspace
of
, spanned by axes of
and defined by
(5)
Now, given an ordered bijection
, it induces a linear isomorphism
(6)
which connects each representation
in
to a unique representation in
.
2.3 Metrics on the Space of Ordered Trees
Given a metric
on the preshape-space
, there is a quotient pseudometric [
^{6}]
induced on the quotient space
, defined by
(7)
This corresponds to finding the optimal path from
to
, consisting of any number
of concatenated euclidean lines, passing through
identified subspaces, as shown in
Fig. 4c. It is clear from the definition that the distance function
is symmetric and satisfies the triangle inequality. Since (7) is an infimum, though, the distance between two distinct tree-shapes may be zero, as occurs with some intuitive shape distances [
^{26}]. This is why
is called a
pseudometric, and it remains to prove that it actually is a metric, that is, that
implies
.
We prove this for two specific metrics on
which come from two different ways of combining individual edge distances: The metrics
and
on
are induced by the norms
(8)
(9)
From now on,
and
will denote either the distance functions
and
, or
and
. In Section 2.4, we prove:
Theorem 1. The distance function is a metric on which is a contractible, complete, proper geodesic space.
Thus, given any two trees, we can always find a geodesic between them in both metrics
and
.
2.3.1 Geometric Interpretation of the Metrics It follows from the definition that the metric coincides with the classical TED metric for ordered trees. In this way, the abstract, geometric construction of tree-space gives a new way of viewing the intuitive TED metric. The metric is a descent of the euclidean metric on , and geodesics in this metric are concatenations of straight lines in flat regions. A qualitative comparison of the TED and QED metrics is made in Section 5.
2.4 Proof of Theorem 1
We now construct a proof of Theorem 1. The rest of the paper is independent of this section, and during the first read, the impatient reader may skip to Section 3. However, while the proof is technical, Theorem 1 is a fundamental building block for the shape space framework. We shall assume that the reader has a good knowledge of metric geometry or general topology [
^{6}], [
^{9}]. It is crucial for the proof that we are only identifying subspaces of the euclidean space
which are spanned by euclidean axes, and these are finite in number. This induces a well-behaved projection
, which carries many properties from
to
.
2.4.1 Details and Terminology We say that ordered tree-shapes whose (collapsed) ordered structure is the same belong to the same combinatorial tree-shape type. For each combinatorial type of ordered tree-shape ( ) that can be represented by collapsing edges in the maximal tree , there is a family of subsets of , the corresponding to the th representation of any tree-shape of type . That is, any will induce the particular type when the edges in ( ) are endowed with nonzero attributes, leaving all other edges with zero attributes. These subsets are characterized by the properties: That is, the subset for any lists the set of edges in which have nonzero attributes for the th representation of any shape of type . Corresponding to each is the linear subspace of given by
(10)
and by condition 2 we can define isometries by ignoring the zero entries in and keeping the depth-first coordinate order. We generate the equivalence on by asking that whenever for some . We now define the space of ordered tree-shapes as the quotient , and define the quotient map .
2.4.2 The Pseudometric Is a Metric Proposition 1. Let denote or . The pseudometric is a metric on .
Proof. It is easy to show that for any , so it suffices to show that implies . Hence, from now on, write for , and assume that for two tree-shapes and .
Choose such that
(11)
that is, is smaller than the size of any of the nonzero edges in and .
We may assume that because otherwise we may assume by symmetry that and .
Denote by the image of under the quotient projection for any .
We may assume that and belong to the same identified subspace, that is, there exist such that
(12)
since otherwise
(13)
Because is a finite set and is a closed set, (13) implies . In this case, the path will have to go through some that does not contain points equivalent to and because in order to reach , we need to remove edge attributes that are nonzero in , and for all . Thus, (12) holds, and in fact, it holds for all the intermediate path points from (7).
But if the path points stay in , then the path consists of changing the nonzero edge attributes of the trees in question. This will only give a sum if the trees are identical and the path is constant.
2.4.3 Topology of the Space of Tree-Shapes Here, we prove the rest of Theorem 1, namely, that the tree-shape space is a complete, proper geodesic space and is contractible. First, we note that although is not a vector space, there is a well-defined notion of size for elements of , induced by the norm on . Lemma 1. Note that if , we must have ; hence we can define .
Proof. The equivalence is generated recursively from the conditions whenever either , indicating , or , indicating since the are isometries. Hence, the lemma holds by recursion.
We will prove that is a proper geodesic space using the Hopf-Rinow theorem for metric spaces [ ^{6}], which states that every complete locally compact length space is a proper geodesic space. A length space is a metric space in which the distance between two points can always be realized as the infimum of lengths of paths joining the two points. Note that this is a weaker property than being a geodesic space, as the geodesic joining two points does not have to exist; it is enough to have paths that are arbitrarily close to being a geodesic. It follows from [ ^{6}, Chapter I, L. 5.20] that is a length space for any metric on where is a metric.
The tree-shape space is locally compact: Since the projection is finite-to-one, any open subset of has as preimage a finite union of open subsets of . Thus, and is compact whenever is bounded.
We also need to prove that is complete:
Proposition 2. Let denote either of the metrics and . The shape space is complete.
The proof needs a lemma from general topology.
Lemma 2. [ ^{9}, Chapter XIV, Theorem 2.3] Let be a metric space and assume that the metric has the following property: There existssuch that for allthe closed ballis compact. Then, is complete.
Using the projection , we can prove:
Lemma 3. Bounded closed subsets of are compact.
Proof. Since Lemma 1 defines a notion of size in , any closed, bounded subspace in is contained in a closed ball in for some , where is the image . Since , it follows that , which is a closed and bounded ball in . Since closed, bounded subsets of are compact, is compact. By continuity of , is compact. Then, is compact too.
It is now very easy to prove Proposition 2:
Proof of Proposition 2. By Lemma 3, all closed and bounded subsets of are compact, but then by Lemma 2 the metric must be complete.
Using the Hopf-Rinow theorem [ ^{6}, Chapter I, Proposition 3.7], we thus prove that is a complete, proper geodesic space. We still miss contractibility.
Lemma 4. Let be a normed vector space and let be an equivalence on such that implies for all . Then, is contractible.
Proof. Define a map by setting . Now, is well defined because of the condition on and , so is a homotopy from to the constant zero map.
Combining the results of Section 2.4, we see that the proof of Theorem 1 is complete.
3. The Space of Unordered Tree-Shapes
The world is not two-dimensional, and in most applications trees are embedded in
. As opposed to planar trees, these trees have no canonical edge order. The order on a planar tree restricts the set of possible edge matchings, whereas for unordered trees, we need to consider all orderings of the same tree and choose orders that minimize the distance. This gives a straightforward mathematical derivation of the space of unordered trees from the space of ordered trees.
The space of unordered 3D tree-shapes is the quotient
, where
is the group of reorderings of the maximal binary tree
. The metric
on
induces a quotient pseudometric
on
. We can prove:
Theorem 2. For induced by either or , the function is a metric and the space is a contractible, complete, proper geodesic space.
Theorem 2 can be proven using standard results on compact transformation groups along with similar techniques as for Theorem 1. While considering all different possible orderings of the tree is easy from the point of view of geometric analysis, this becomes a computationally impossible task when the size of the trees grows beyond a few generations. In Section 5, we discuss computational heuristics and approximations in real applications.
4. Curvature of Tree-Space and Reduced Tree-Spaces
Having proven Theorems 1 and 2, we may now pass to studying the geometry of the tree-shape space through its geodesics. Uniqueness of geodesics and means is closely connected to the geometric notion of
curvature, a concept that fundamentally depends on the underlying metric. We shall start out by reviewing the concept of curvature in metric geometry [
^{6}], [
^{16}] before we investigate the curvature of the tree-shape space with the QED and TED metrics. Using curvature, we obtain well-posed local statistical methods for QED. We discuss the implications of locality and explain how locality issues can be dealt with by restricting to smaller tree-spaces that are particularly relevant for a given problem. As part of the exposition, we discuss two conjectures on statistics for global generic datasets.
4.1 Curvature in Metric Spaces
Since general metric spaces can have all kinds of anomalies, the concept of curvature in such spaces is defined through a comparison with spaces that are well understood. Metric spaces are studied using
geodesic triangles, which are compared with
comparison triangles in model spaces with a fixed curvature
. The model spaces are spheres (
), the plane
(
), and hyperbolic spaces (
), where the metric space curvature is bounded by the curvature
of the model space. In this paper, we shall use comparison with planar triangles, which gives us curvature bounded from above by 0. For an extensive review of metric geometry, we refer to [
^{6}].
Given a geodesic metric space
, a
geodesic triangle in
consists of three points
and geodesic segments joining them. A planar
comparison triangle for the triangle
consists of a triangle with vertices
in the plane, whose side lengths are identical to those of
, see
Fig. 5.
Fig. 5. A metric space is if, for a geodesic triangle and for any point on the triangle, the distance from to the opposite vertex is not longer than the corresponding distance in the planar comparison triangle .
A
space is a metric space in which geodesic triangles are "thinner" than their planar comparison triangles. That is,
for any
on the edge
, where
is the unique point on the edge
such that
and
. If the planar comparison triangle is replaced by a spherical or hyperbolic comparison triangle of curvature
, we get a
space.
A space
has nonpositive curvature if it is locally
, i.e., if any point
has a radius
such that the ball
is
. Similarly, define curvature bounded by
as being locally
.
Example 1.
One of the main reasons why
spaces (and
in particular) are attractive is because for
, geodesics exist and are unique locally. For
, geodesics exist and are unique globally.
There are many competing ways of defining central elements given a dataset in a metric space. We consider the
circumcenter considered in [
^{6}], the
centroid considered, among other places, in [
^{5}], and the
mean [
^{19}].
Definition 1.
It is well known that centroids [
^{5}] and circumcenters [
^{6}] are unique in
-spaces. Uniqueness of means follows from a more general theorem by Sturm [
^{34}, Proposition 4.3]; we include an elementary proof here for completeness.
The problem of existence and uniqueness of means can be attacked using convex functions. Recall that a function
is convex if
for all
and
. If we can replace
with
whenever
, then
is
strictly convex. Convex coercive functions have minimizers, which are unique for strictly convex functions. Hence, existence and uniqueness of means can be proven by expressing them as minimizers of strictly convex functions.
We say that a function
on a geodesic metric space
is (strictly) convex if for any two points
and any geodesic
from
to
, the function
is (strictly) convex. We shall make use of the following standard properties of convex functions.
Lemma 5.
The
mean of a finite subset
in a metric space
is defined as in (1), and is called the
Fréchet mean. Local minimizers of (1) are called
Karcher means.
Theorem 3. Means exist and are unique in spaces.
Proof. The function given by is convex for any fixed by [ ^{6}, Proposition II.2.2], so the function is strictly convex by step 1 in Lemma 5. But then is strictly convex by step 2 in Lemma 5, and a mean is just a minimizer of the function . The function is coercive, so the minimizer exists. Since is strictly convex, the minimizer is unique.
4.2 Genericity
Definition 2 (Generic Property). A generic property in a metric space is a property that holds on an open, dense subset of .
Some of our results, e.g., uniqueness of means in tree-space, will not hold in general, but we shall see that local uniqueness of means is a generic property. This is a topological way of saying that our results hold for a randomly selected dataset with limited variation. In tree-space, generic properties hold almost surely, or with probability one, with respect to natural probability measures. Thus, for a random tree-shape, we can safely assume that it satisfies generic properties, e.g., that the tree-shape is a binary tree. A nongeneric property is a property whose "not happening" is generic. This is similarly interpreted as a property that may not hold for randomly selected tree-shapes. A detailed discussion of the relation between genericity and probability is found in Appendix A in the supplemental material, which can be found in the Computer Society Digital Library at http://doi. ieeecomputersociety.org/10.1109/TPAMI.2012.265.
Example 2. Being a truly binary tree-shape (i.e., the corresponding collapsed tree-shape is a binary tree) is a generic property. To see this, let be a tree-shape in or that is not truly binary, represented by a maximal binary tree . By adding small noise to the zero attributes on edges of , we can obtain truly binary tree-shapes that are arbitrarily close to . Thus, the set of full truly binary tree-shapes in or is open and dense and contained in the set of binary tree-shapes.
One common misunderstanding is that "generic tree" refers to a particular class of trees with a particular generic property. It is important to note that many different properties, which do not necessarily happen on the same subsets of tree-space, may all be generic at the same time. For instance, there are generic properties that do not hold for all binary trees. However, any finite set of generic properties will combine to a new, more restrictive, generic property.
4.3 Curvature in the Space of Tree-Shapes
We now reach our first conclusions on the curvature of the space of tree-shapes.
Theorem 4 (Curvature for Ordered Tree-Shapes).
Local properties are defined as properties that hold within a sufficiently small neighborhood.
Proof. Case 1: Consider any tree-shape , where trees in are spanned by with at least two edges , and induce a second tree-shape such that for all and and . Now, there are at least two geodesics from to : one which first deforms to before deforming to , and one which first deforms to before deforming to . Moreover, the TED distance between and can be arbitrarily small. Since this is possible anywhere in tree-space, geodesics are nowhere locally unique and the curvature of tree-space with TED is unbounded everywhere [ ^{6}, Prop. II 1.4].
Case 2: Recall from Section 2.2 how was formed by identifying subspaces , defined in (6). These identified subspaces corresponded to different representations in of the same shapes . The points in can now be divided into three categories:
These three classes of points correspond to local curvature 0, , and , respectively. That is, the space is locally at points in category 1; at points from category 2 it is for every , so it has curvature ; and at points from category 3 it is not for any ; hence, the curvature is . It thus suffices to show that the set of points in categories 1-2 contains an open, dense subset. This follows from the fact that the points in category 3 sit in a lower-dimensional subspace of .
It is easy to prove that the same results also hold for unordered tree-shapes. Recall that the space of unordered tree-shapes
is the quotient of
with respect to the action of a finite group
, which means that
is locally well behaved almost everywhere. In particular, off fixed points for the action of reorderings
on
, the projection
is a local isometry, i.e., it is distance preserving within a neighborhood. Hence, the geometry from
is preserved off the fixed points. Geometrically, a fixed point in
is an ordered tree-shape, where a reordering
of certain branches does not change the ordered tree-shape; that is, some pair of sibling edges must have the same shape attributes. In particular, being a fixed point is a nongeneric property in
because the fixed points belong to the lower-dimensional subset of
where two sibling edges have identical shape. Thus, we have:
Theorem 5 (Curvature for Unordered Tree-Shapes). Nonpositive curvature is a generic property in the space of unordered trees with the QED metric. With the TED metric , however, has everywhere unbounded curvature, and geodesics are nowhere locally unique.
As we shall see in Section 4.5, the practical meaning of Theorems 4 and 5 is that for datasets contained in a sufficiently small neighborhood, there exist unique means, centroids, and circumcenters for the QED metric. Moreover, the same techniques cannot be used to prove uniqueness of prototypes for the TED metric. In fact, any geometric method that requires bounded curvature [
^{5}], [
^{6}], [
^{19}] will fail for the TED metric. This motivates our study of the QED metric.
4.4 The Locality Assumption
We have shown that the local curvature is nonpositive almost everywhere in
, which at a first glance makes
well suited for geometric definitions of statistical properties. However, our notion of "almost everywhere" is tied to (maximal) dimensionality, which again is tied to the topological structure of the maximal tree
. As a consequence, the
neighborhoods are sometimes small. Below, we shall discuss one example relevant to our applications where this is not a problem, and we shall discuss two examples where this is a problem. After investigating the locality constraint, we shall discuss natural restrictions on tree-space that allow us to increase the size of the
neighborhoods.
Consider the following three examples; we thank one of the anonymous reviewers for the second one.
Example 3.
1. Consider the space of tree-shapes spanned by the rooted binary tree with three leaves. This represents, for instance, the subtree of the central airways that spans the segments of the left upper lobe. In this space, the trees at which the tree-space curvature is are missing two consecutive edges, which rarely happens in airway trees. Moreover, the spatial orientations of the airway segmental branches in different individuals are fairly similar, although the branching order of given branches varies. This means that a typical dataset is quite local. Thus, in this tree-space, the neighborhoods are not locally euclidean, and our airway subtrees will usually be contained in a neighborhood.
2. Consider the tree-shapes and shown in Fig. 6a. These two tree-shapes are joined by two geodesics, and thus and are not contained in the same neighborhood in . However, in a suitably chosen smaller tree-space , as defined in Definition 3 below, they can be.
3. Consider the tree-shape in the space of unordered tree-shapes with attributes in , spanned by the maximal tree as in Fig. 6b. Arbitrarily close to we will find two trees and that are joined by two geodesics, as shown in the figure.
As illustrated by examples 2-3, the
neighborhoods in the shape-space
can be quite small, mainly containing trees whose topology is the same as or similar to
. On the other hand, both these examples rely on orthogonality or symmetry as they use trees whose attributes are orthogonal to each other. If one of the trees is slightly perturbed, the geodesics are again unique.
Fig. 6. (a) Two trees joined by two different geodesics in . (b) Arbitrarily close to are two other trees, and , which cannot be joined by a unique geodesic. (c) Local-to-global properties of TED: If the trees and are decomposed into subtrees , and , as in Fig. 6c, such that the geodesic from to restricts to geodesics between and as well as and , then . (d) Two options for structural transition in a path from Tree 1 to Tree 2.
The tree-spaces
and
are very natural spaces for geometric trees and, based on the symmetry properties in all known examples of nonunique geodesics, we conjecture that having a unique connecting geodesic is a generic property for pairs of trees in
or
without any locality assumption. For now, however, we propose making application-specific assumptions that restrict to natural reduced tree-spaces
and
, whose exact definition gives modeling flexibility, and where
neighborhoods can be much larger. This allows us to do well-defined statistics on trees appearing in real applications.
Definition 3 (Reduced Tree-Shape Space). Consider a subset which only contains all representations of trees of certain particular topologies. The th topology is characterized by a subset consisting of the edges in the maximal tree that have nonzero attributes. Associated to is a linear subspace containing representations of all the trees of this particular topology. We include all representations of each tree topology (otherwise some shape space paths may disappear), and obtain a reduced preshape space
containing all the trees that have of one of the considered topologies. The equivalence relation on restricts to an equivalence relation on , from which we obtain a reduced tree-shape space . The QED metric on induces a metric on that induces a quotient pseudometric on .
Example 4. Denote by the space of all trees in with leaves; now is the space of ordered tree-shapes with leaves.
All the results that we have proven for
and
now carry over directly to
and
:
Theorem 6.
Proof. First, we show that the pseudometric is a metric. The pseudometric in (7) defines the distance as the infimum of lengths of paths in connecting and . Any path in is also a path in , so if , then as well, so .
The proofs of the other claims follow the proofs of Theorems 1, 2, 4, and 5.
Example 5. Denote by the space of all trees in with a feasible airway tree topology, as defined in Appendix C, available in the online supplemental material. Now, is the reduced space of airway trees.
4.5 Means and Related Statistics for Tree-Shapes
In this section, we use what we learned in the previous section to show that, given the QED metric on a space of tree-shapes, we can find various forms of average shape in the space of ordered tree-shapes, assuming that the data lie within a
neighborhood. We have:
Theorem 7. Consider the tree-spaces and . Local uniqueness of means, centroids, and circumcenters is generic in both spaces. That is, the set of points with a neighborhood such that sets contained in have unique means, centroids, and circumcenters contains an open, dense subset. For the TED metric, these statistics are not locally unique anywhere. The same results hold in the reduced tree-spaces and , defined in Definition 3.
Proof. First consider and with the QED metric. By Theorems 4 and 5, and are both locally spaces, and by Theorems 1 and 2 they are both complete metric spaces. We have seen in Theorem 3 that means exist and are unique in spaces, so the statement holds for means. By [ ^{6}, Proposition 2.7], any subset of a complete space has a unique circumcenter. Hence, the statement holds for circumcenters. Similarly, by [ ^{5}, Theorem 4.1], finite subsets of spaces have centroids (unique by definition), so the statement holds for centroids.
For the TED metric, note that for any two-point dataset, all these notions of mean coincide with the midpoint of a geodesic connecting the points. We know that geodesics and midpoints are not unique in the TED metric.
The proofs transfer directly to the spaces and .
All the results from Section 4.5 hold generically, within a neighborhood where the
property holds. We have seen examples of points where local
-property must fail, illustrating the limitations of
techniques for analyzing general trees. However, as discussed, the examples where the
property fails rely on nongeneric symmetries, and we conjecture that having a unique mean is a generic property for finite datasets in
and
. Analogous results for manifolds have appeared very recently [
^{1}], and we expect this extension from existing models to be nontrivial. In the meantime, as discussed in the previous section, application-specific reduced tree-spaces can be designed, where
-neighborhoods are larger.
In manifold statistics, means are unique [
^{19}] in any convex neighborhood in which geodesics are unique. In tree-space, any convex neighborhood that does not contain points of curvature
will be a
neighborhood. In tree-space, radius is not a good measure for the size of a
neighborhood as a tree may contain both small branches, leading to a small radius, as well as large branches, giving much larger
neighborhoods than indicated by the radius.
5. Geodesics and Their Computation
Computation of tree-space geodesics is not trivial, and it is an open problem to find a QED heuristic, exact or not, which is realistically computable for trees of moderate size. In this section, we first compare the qualitative properties of QED and TED geodesics, and then discuss strategies for approximation, which we use for computing geodesics between small trees. We stress that the main focus of this paper is to investigate the potential of QED for tree statistics. In this setting, proof-of-concept experiments are important for judging whether finding computable algorithms for QED between trees of arbitrary size is worthwhile, as we consider this a nontrivial research problem. The main problem is that the QED distance is optimal among an exponential number of cases, each of which involves a nontrivial optimization term. To make proof-of-concept experiments, we use approximation and semi-labeling to restrict the search space, and stick to small trees where a complete enumeration of the remaining options is feasible.
For a qualitative comparison of TED and QED geodesics, we compare edge matchings implied by the TED and QED geodesics between small, simple trees. Consider the two tree-paths in
Fig. 6d, where the edges are endowed with scalar attributes
describing edge length. Computing the TED and QED costs of the two different paths, we find the shortest path.
Path 1 indicates matching left- and right-side edges
and
, while path 2 does not make the match. The cost of path 1 is
in both metrics, while the cost of path 2 is
in the QED metric and
in the TED metric. TED will identify the
and
edges whenever
, while QED makes the identification whenever
. Thus, in these cases, TED is more prone to internal structural change than QED.
The same occurs in the comparison of TED and QED matching in
Figs. 7a and
7b. Although TED is more prone to matching trees with different tree-topological structures, the edge matching results are similar, as is expected, because the metrics are closely related.
Fig. 7. Given a set of five data trees, we match each to the four others in both metrics.
Computing TED or QED distances between unordered tree-shapes is NP-complete [
^{10}], but we can often use geometry and prior knowledge (e.g., anatomy) as a heuristic to reduce the search space. For instance, trees appearing in applications are often not completely unordered, but are semi-labeled.
Example 6 (Semilabeling of the Central Airway Tree). The airway tree has about 30 branches that have anatomical names and can be identified by experts. For instance, the root edge is the trachea; the second generation edges are the left and right main bronchi. As these top-generation branches are easily identified, we use their identification to simplify computations of interairway geodesics in Section 6.2.
The TED metric has nice decomposition properties that are used in dynamic programming algorithms for TED; see
Fig. 6c. QED does not share these decomposition properties due to the square root in the euclidean distance, and thus we have chosen to approximate the QED in our experiments. To approximate the QED distance, we take advantage of the fact that many types of biological trees have relatively few tree-topological variations. The airways is an example of such a type of tree, as explained in Example 6. For such tree types, it is safe to assume that the number of internal structural transitions found in a geodesic deformation is low, and that the geodesics pass through identified subspaces of low co-dimension. For instance, for the airway trees studied in Section 6.2 we find empirically that it is enough to allow for one structural change in each lung subtree, which has at most a trifurcation. Recall the definition of the metric from (7); the approximation consists of imposing upper bounds
on the number
and
on the degrees of internal vertices appearing in (7), respectively, giving
(14)
where all
and
have vertex degrees at most
. Geometrically,
is the number of euclidean segments concatenated to form the geodesic. Bounding
is equivalent to bounding the number of topological transitions throughout the geodesic. In fact,
the number of topological transitions in the geodesic. Note that this approximation is similar to that employed for TED in [
^{35}].
We approximate the QED metric using Algorithm 1; see Appendix B, available in the online supplemental material, for details. For the unordered airway trees in Section 6.2, Algorithm 1 is combined with a search through all tree orders. The algorithm was implemented for trees with depth at most 3 by listing all options for intermediate tree topologies within the approximation, optimizing for the branch attributes found in the intermediate topologies, choosing the optimal path among the considered ones. This is possible because the trees are small and the enumeration of options can be done manually. Finding more exact and efficient heuristics is an important but nontrivial research problem.
Algorithm 1. Computing approximate QED distances
between ordered, rooted trees with up to
structural transitions through trees of order at most
1: , planar rooted binary trees in .
2: set of ordered isometric pairs of
subspaces of in which the same ordered tree-shapes
are representing, as in eq. (6).
3: for with do
4: ,
where and
.
5: .
6: end for
7:
8:
9:
10: geodesic
11: return
The QED metric is new, whereas the properties of the TED metric are well known [
^{31}]. Our experimental results on real and synthetic data illustrate the geometric properties of the QED metric. The experiments on airway trees in Section 6.2 show, in particular, that it is feasible to compute geodesics between real, 3D data trees. In all our experiments, edges are translated to start at
and are represented by six landmark points evenly distributed along the edge, the first at the origin.
6.1 Synthetic Planar Trees
Movies illustrating geodesics between planar depth 3 trees, as well as a table illustrating a tree-shape matching experiment for a set of synthetic planar depth 3 trees, are found on the webpage http://image.diku.dk/aasa/tree_ shape/planar.html. The movies and matchings show the geometrically intuitive behavior of the geodesic deformations. We see that the intermediate structures resemble the geodesic endpoint trees in a reasonable manner, and show the ability of the geodesics to handle internal topological differences. These are among the wanted properties from the model listed in the beginning of Section 2.
QED mean (computed with the weighted midpoints algorithm of [
^{11}], [
^{34}]) and centroid [
^{5}] trees are shown in
Fig. 8. The mean and centroid trees clearly represent the main common properties of the dataset trees.
Fig. 8. Top: A small set of synthetic planar trees. Bottom left: The centroid tree. Bottom right: The mean tree.
6.2 Results in 3D: Pulmonary Airway Trees
As proof-of-concept experiments on real data, we compute means for sets of pulmonary airway trees from the EXACT'09 airway segmentation competition [
^{23}]. The airway trees were first segmented from low dose screening computed tomography (CT) scans of the chest using a voxel classification-based airway tree segmentation algorithm [
^{22}]. The centerlines were extracted from the segmented airway trees using a modified fast marching algorithm based on [
^{30}]. The method gives a tree structure directly through connectivity of parent and children branches. For simplicity, we only consider the central airways down to the lobar branches.
We compute TED means [
^{36}] and QED means (using the weighted midpoints algorithm [
^{11}], [
^{34}]). The dataset is shown in
Fig. 9a; the results in
Fig. 9b. We clearly see how the choice of the TED geodesic makes the TED mean vulnerable to missing branches in the dataset trees, giving a mean shape whose structure is too simple. The QED mean, on the other hand, represents the data well.
Fig. 9. (a) Subtrees of 14 airway trees from the EXACT'09 test set [ ^{23}]. (b) The QED and TED mean airway trees. The TED mean misses the upper lobar branches on both sides, caused by the fact that the 13th data tree misses these.
7. Discussion and Conclusion
We define a tree-shape space, starting from a purely geometric point of view. This geometric framework allows us to simultaneously take both global tree-topological structure and local edgewise geometry into account. We study two metrics on this shape space, TED and QED, which both give the shape space a geodesic structure (Theorems 1 and 2). The framework is developed for tree-shapes, but carries over to other geometric trees with vector attributes.
QED is the geometrically most natural metric, and turns out to have essential properties that allow statistical shape analysis for local data. Through a geometric analysis of the tree-shape framework, we show that the QED metric gives local uniqueness of geodesics and local existence and uniqueness for three versions of average shape, namely, the mean, the circumcentre, and the centroid (Theorem 7). Our analysis gives new insight into the metric space defined by TED, and explains why the problem of finding TED averages is ill posed.
To obtain unique averages with the help of
spaces, we assume that our data are contained in a neighborhood which is "sufficiently small" to be
. We have seen that in some cases these neighborhoods are small. While we conjecture that having a unique mean is a generic property for finite datasets without any locality assumption, we also show how to obtain larger
neighborhoods by restricting to reduced tree-spaces, where only trees of certain topologies, chosen in an application-specific manner, are found. Even with such an assumption, our results significantly extend the state of the art, which either uses the TED metric [
^{31}], [
^{36}] or is unable to simultaneously handle topology and geometry [
^{39}].
Both metrics are generally NP-complete to compute for 3D trees. We explain how approximation and semi-labeling can be used to compute geodesics, and illustrate this by computing QED means for sets of trees extracted from pulmonary airway trees as well as synthetic planar data trees. The QED lacks an obvious decomposition strategy for dynamic programming, and involves an optimization term that makes it more time consuming to compute than the TED metric. The two metrics have similar matching properties, and thus, for applications that do not require a unique geodesic (e.g., clustering), the TED metric is just as suitable as the QED metric. However, for statistical computations, the QED metric is the only suitable metric. This is emphasized by our experiments, where computed QED and TED means illustrate that the TED means miss important structure.
Future research will center around two points: development of nonlinear statistical methods for the singular tree-shape spaces, and finding more efficient approximations and heuristics for the QED metric using both the tree geometry and the tree-space geometry. The latter will pave the road for computing averages and modes of variation for large, real three-dimensional data trees, as well as considering more sophisticated edge shape spaces from modern shape analysis [
^{21}], [
^{26}]. Construction of efficient algorithms is by no means trivial due to the nonsmooth structure of the tree-shape space and the complexity of computing exact geodesics.
Acknowledgments
The authors thank the anonymous reviewers for their helpful comments that improved the quality of the paper. This work is partly funded by the Lundbeck foundation, the Danish Council for Strategic Research (NABIIT projects 09-065145 and 09-061346), and the Netherlands Organisation for Scientific Research (NWO). They thank Søren Hauberg for helpful discussions during the preparation of the paper.
A. Feragen, P. Lo, M. Nielsen, and F. Lauze are with the eScience Center, Department of Computer Science, University of Copenhagen, Universitetsparken 5, 2011 Copenhagan, Denmark.
E-mail: {aasa, pechin, madsn, francois}@diku.dk.
M. de Bruijne is with the eScience Center, Department of Computer Science, University of Copenhagen, Universitetsparken 5, 2011 Copenhagan, Denmark, and the Biomedical Imaging Group Rotterdam, Department of Radiology and Medical Informatics, Erasmus MC-University Medical Center Rotterdam, Room Ee 2112, PO Box 2040, Rotterdam 3000 CA, The Netherlands. E-mail: marleen@diku.dk.
Manuscript received 1 Feb. 2012; revised 26 Sept. 2012; accepted 30 Nov. 2012; published online 19 Dec. 2012.
Recommended for acceptance by D. Weinshall.
For information on obtaining reprints of this article, please send e-mail to: tpami@computer.org, and reference IEEECS Log Number TPAMI-2012-02-0080.
Digital Object Identifier no. 10.1109/TPAMI.2012.265.
1. is saturated if, for each tree topology appearing in , all reorderings of the same tree topology also appear in . Equivalently, , where .
Aasa Feragen received the PhD degree in mathematics from the University of Helsinki, Finland, in 2010. She is currently Freja Fellow and Assistant Professor at the Department of Computer Science, University of Copenhagen, Denmark. Her research interests include mathematical modeling and computational anatomy for biomedical image analysis, as well as statistics and machine learning for structured data.
Pechin Lo received the PhD degree in computer science from the University of Copenhagen, Denmark, in 2010. He is currently a postdoctoral researcher at the University of California, Los Angeles. His research interests include image segmentation, pattern recognition, and machine learning applied to the field of medical image processing.
Marleen de Bruijne received the MSc degree in physics and the PhD degree in medical imaging, in 1997 and 2003, both from Utrecht University, The Netherlands. She is an associate professor of medical image analysis at Erasmus MC Rotterdam, The Netherlands, and at the University of Copenhagen, Denmark. She has coauthored more than 100 peer-reviewed papers in international conferences and journals. She was on the program committee of many international conferences in medical imaging and computer vision and is a member of the editorial board of
Medical Image Analysis. Her research interests include model-based and quantitative analysis of medical images in various applications.
Mads Nielsen received the PhD degree in computer science from the University of Copenhagen, Denmark, in 1995. In 1995-1996, he was a postdoctoal researcher at Utrecht University, The Netherlands, and the University of Copenhagen, where he was an assistant professor during 1997-1999. He became an associate professor in 1999 and a professor in 2002 at the IT University of Copenhagen, where he headed the Image Analysis Group. In 2007, he became a professor and the head of the Image Group, University of Copenhagen. He was a general chair of MICCAI '06 and is a member of the editorial boards of the
International Journal of Computer Vision and
Journal of Mathematical Imaging and Vision.
François Lauze studied mathematics in France at the University of Nice-Sophia-Antipolis, where he received the PhD degree in algebraic geometry in 1994. He received another PhD degree in 2004 from the IT University of Copenhagen, Denmark, including work on variational methods for motion compensated in-painting and motion recovery. He has worked with variational and geometric methods for image analysis.