Image Anal Stereol 2013;32:175-181 Original Research Paper THE EULER NUMBER FROM THE DISTANCE FUNCTION Ximo Gual-Arnau Institute of New Imaging Technologies, Campus Riu Sec, Universitat Jaume I, 12071 Castello, Spain e-mail: gual@uji.es (Received April 11, 2013; revised November 11, 2013; accepted November 12, 2013) ABSTRACT We present a new method to obtain the Euler number of a domain based on the tangent counts of concentric spheres in R3 (or circles in R2), with respect to the center O, that sweeps the domain. This method is derived from the Poincare-Hopf Theorem, when the index of critical points of the square of the distance function with respect to the origin O is considered. Keywords: critical points, distance function, Euler number, stereology, tangent counts. INTRODUCTION The Euler number describes the topology of the surfaces of a structure of interest and its practical value of obtaining, for example, the number of trabeculae in bone, the number of glomerular capillaries in kidney, or the alveolar number in lung-architecture, has been demonstrated. Hadwiger (1957) gave an inductive definition of the Euler characteristic which has suggested several methods for deriving the Euler number from close parallel flat sections; see for instance De Hoff (1987), Gundersen et al. (1993), Ohser et al. (1996) or Rataj (2004). In this case, the principle used to obtain the Euler number of an n-dimensional domain in Rn (n = 2 or 3) is based on what happens in an (n — 1)-dimensional plane that sweeps through the domain. Some of the methods obtained from this principle and derived from the Hadwiger definition, can also be proved from the classical Poincare-Hopf Theorem, when the index of critical points of a family of height functions are considered (Gual-Arnau et al., 2001). It follows that, for any vector u in Rn (n = 2 or 3), the Euler number of a domain is obtained from the tangent counts of the domain and a perpendicular plane to u (or line in R2), that sweeps the domain. This method is isotropic in the sense that, although the tangent events depend on the direction u, the final result (Euler number) does not depend on u. In this paper we present an alternative method to obtain the Euler number of a domain based on the tangent counts of concentric spheres in R3 (or circles in R2) that sweep the domain. The tangent counts will depend on the position of the center O of the spheres (or circles) but the final result will be the Euler number for a general position of the center O. This method is then based on what happens in a sphere in R3 (or circle in R2) that sweeps through the domain and it is obtained from the Poincare-Hopf Theorem, when the index of critical points of the square of the distance function with respect to an origin O is considered. In fact, Chapter 6 of Milnor (1969) is deserved to show that the square distance from a chosen point, restricted to a smooth submanifold in Rn, is indeed a function with no degenerate critical points (Morse function), for almost all chosen points for the origin O. For instance, if the domain is bounded by a sphere, the square distance restricted to the sphere is a Morse function for all reference points, except when the reference point O is the center of the sphere. This method may be of interest in images with a prominent reference point: e.g., the nucleolus of a cell or the planet earth when counting celestial objects like stars; and in images which include anisotropic particles that have approximately parallel sides (plant fibers, fibrous minerals,...). In the first part of the paper we give the stereological versions of the principle for 3-dimensional domains in R3, 2-dimensional domains in R2 and domains with boundary in a surface S c R3. In the second part we give the detailed mathematical justifications and we relate the Euler-Poincare characteristic with curvatures of the domain and the concentric spheres in R3 (or circles in R2). STEREOLOGICAL FORMULAE In this section we give an elementary version of the Euler-Poincare characteristic of closed orientable smooth surfaces S = dD in R3, of bounded domains D g R2, and of domains with boundary in an orientable smooth surface S in R3. The Euler-Poincare characteristic for domains in R2 and R3 has been studied in several stereological applications (see, for instance, Gundersen etal., 1993). The principle used to obtain the Euler number of an n-dimensional domain in Rn (n = 2 or 3), is based on what happens in an (n — 1)-dimensional plane that sweeps through the domain. Here we consider a new principle based on what happens in a sphere S2 (A) (or circle S1 (A) in R2) that sweeps through the domain when the radius A varies. Both principles can be derived from a result of Morse (1929) that we simplify for surfaces in R3 and domains in R2. In the next section we give a more detailed mathematical justification. CLOSED SURFACES IN R3 Let f : S —> R be a smooth function defined on a closed orientable smooth surface. We say that x e S is a critical point if vfx : TtS —> R vanishes for every v e TxS. A critical point x e S is non degenerated if the Hessian of f at x, (v2f)x : TXS x TXS —► R, is a non degenerated bilinear form, i.e., for every non zero vector v e TtS, there exists a vector w e TtS such that (v2f )x (v, w) = 0. A function f is called a Morse function if all its critical points are non-degenerated (Bruce etal., 1984). Theorem 1. (Morse) Let f : S ^ R be a differentiable Morse function on a closed orientable two-dimensional surface, then X (S) = £ Indx (/) , xe£(/) (1) where e( f ) denotes the set of singular points of f and the index, Indx (f ), is given by +1 when x is a local extreme of f, or — 1 when x is a saddle point (Morse, 1929). That is, X (S) = M - s + m , (2) where M, m and s denote the number of maximum, minimum and saddle, respectively, of f. Now, we apply the above results to a particular function: the square of the distance function. We define the square of the distance function to a generic coordinate origin O e R3 as d : R3 —► R x —> d(x) = (x,x) = ||x||2. (3) For almost all O G R3 (all but a set of measure 0), the restriction of d to S, d |S, is a Morse function (Milnor, 1969). Now we will apply Theorem 1 to the square of the distance function. The level sets are 2 = d—1 (A2) = {x G R3 / ||x||2 = A2} = S2(A). When we restrict d to S, the critical points x G e(d|s) are those where the tangent plane to S at x coincides with the tangent plane to nA2 at x; i.e., TxS = TxS2(A ); then we give a 'stereological' interpretation of the local extreme (maximum and minimum) and saddle points of d. Let D be a domain in R3 such that d D = S; then, the critical points of d|S, (x G e(d|S)), can be classified as follows: x G e(d|S)) is a point of type "Island" if d—1 (d(x)) = S2(A) is locally contained in R3 \D, (x is a local extreme (maximum) of d|S); x G e(d|S)) is a point of type "Hole" if d—1 (d(x)) is locally contained in D (x is a local extreme (minimum) of d|S); and x G e(d|s)) is a point of type "Bridge" if there exist points of S in the interior and in the exterior of S2 (A ) where S2(A) = d—1 (d(x)), (x is a saddle point of d|S), (see Fig. 1). Fig. 1. Images that we see in the sweeping spheres S2 (A) fl S, where S is a fixed torus and the growing spheres S2(A) have afixed center O. Depending on the type of critical point we have Islands or Holes (blue points) and Bridges (red points). The Euler number of the torus is 0. Note that, although S is fixed, as the radius of S2 (A) increases, a change of scale and orientation of S (torus) appears in the images to get a better view of the critical (tangent) point. Let S = dD c R3 be an orientable smooth surface in R3 and let O e R3 such that d|S is a Morse function. When A varies on R, the different spheres 2 can be considered as a "sweeping" sphere S2 (A) (centered at O) in R3. Then, Theorem 1, with the interpretation of local extrema and saddle points of d|S as Islands, Holes and Bridges, can be expressed as: X (S) = 2x (D)= /2 + H - B2 , (4) where /2, H2, B2 denote the number of islands, holes and bridges observed in the "sweeping" sphere S2 (A), which contribute to the sum £xG£(d|S) Indx(d|S). Moreover, when O S, O is a minimum of d, and X (S) = 2x (D) = 1 + /2 + H - B2 . (5) Note that the tangent counts /2, H2, B2 may depend on the position of the center O; however the final result of (/2 + H2 - B2) is always 2x(D) (see Fig. 2). In fact, when O is far from the domain D the tangent counts /2, H2, B2 are similar to that obtained when sweeping planes are considered. DOMAINS IN R2 Let D c R2 be a domain in R2 whose boundary is a curve dD. In this case, we can not apply Theorem 1 because D is a surface with a boundary. As explained in the Mathematical foundations section, the generalized result of Theorem 1 for domains in R2 is as follows: Theorem 2. Let D c R2 be a domain with boundary and let f : D ^ R be a Morse function such that f has no critical points on dD and the restriction f |dD : dD ^ R is also a Morse function. Then, X (D)= £ Indx (f) + 2 £ Indy (f) , (6) where the index Indx (f) is defined as in Eq. 1 and the index Indx (f |dD) is defined as follows: if the level set f-1 (f (y)) is locally contained in R2 \ D then Indy(f |dD) = +1 and if the level set f-1 (f(y)) is locally contained in D then Indy (f |dD) = — 1. The square of the distance function to a generic coordinate origin O e R2 is d : R R x —> d(x) = (x,x) = | |x| (7) Fig. 2. The surface S is the same as in Fig. 1 and the growing spheres S2 (A) have a fixed origin O different to that considered in Fig. 1. Therefore, we obtain different va/wes of the critical points, because they depend on the position of the center of the spheres, O. B/we points are /s/ands and red points are Bridges. The Eu/er number of the torus is 0. The level curves ^a2 are in this case circles S1 (A) centered at O e R2. To satisfy Theorem 2 we suppose that O G R \ dD; then, the square of the distance function d|D has only a critical point O G D; and we also suppose that the restriction of the square of the distance function d |dD is a Morse function; then, from Eq. 6, X (D) = ¿0 (D) + 2 £ Indy (d |dD) |d d ) where ¿0 (D) = 1, if O G D 0, if O G D (8) (9) and a critical point y e £(d|dD) is a point of type "Island" if d—1 (d(y)) = S1 (A) is locally contained in R2 \ D; and y e £(d|dD)) is a point of type "Bridge" if d—1 (d(y)) is locally contained in D (see Fig. 3). Therefore, when A varies on R, the different circles S1 (A) can be considered as "sweeping" circles in R2, and Eq. 6 can be expressed as: X (D) = (D) + 1 (/1 — B1) , (10) where /1 and B1 denote the number of islands and bridges observed in the "sweeping" circle S1 (A). 2 a) O G D. b) O G D. Fig. 3. Different values of the critical points, depending on the position of the center of the growing circles, O. Blue points are Islands and red points are Bridges. The Euler number of the domain D is 0. Note that when the point O S2 given by u(z) = v(z)/|v(z)|. As an immediate consequence, we see that if f : S ^ R is a Morse function (that is, a function with non-degenerate critical points), then X (S)= £ Indx(f) , (13) xg Hf ) where £( f ) denotes the set of singular points of f and the index, Indx(f ), is given by +1 when x is a local extreme of f, or —1 when x is a saddle point (Morse, 1929). Now, we consider a generalization of the classical Poincare-Hopf Theorem which can be applied domains with boundary in an orientable smooth surface in R3 and, in particular, to closed domains in R2 (Gual-Arnau et al., 2001). Let D c R3 be a compact orientable smooth surface with boundary and let f : D ^ R be a Morse function such that f has no critical points on dD and the restriction f |d D : d D ^ R is also a Morse function. Then, the Poincare-Hopf Theorem (Morse, 1929), states X(D)= £ Indx(f) + 2 £ Indy(f) , (14) xgZ(f) 2 y gZ(f |dd) where the index Indx(f ) is defined as in Eq. 1 and the index Indx(f |dD) is defined as follows: if the level set f—1(f (y)) is not locally contained in D then Indy(f |dD) = +1 and if the level set f-1(f(y)) is locally contained in D then Indy(f |dD) = -1. In the next section we will consider a particular function f, the square of the distance function, and we will interpret Eq. 1 in terms of critical points of this function. CLOSED SURFACES IN R3 Let S be a closed orientable smooth surface in R3. Given x e S, we denote by N(x) and K(x) the normal vector and the Gauss curvature of S, respectively. Theorem 3. Let S C smooth surface in R3. be a closed orientable 1. Let x G S. It is a critical point of d|S if and only if x = ±AN(x) if and only if TXS = TXS2 (A ) (where d (x) = A 2). 2. Let x G S be a critical point of d|S. (a) Suppose that x = —AN(x); then x is non-degenerate if and only if k1 = A and k2 = A (is the Gauss curvature of S2(A)). Moreover, it is a local extreme or a saddle point of d |S depending on weather ( A — k1)( A — k2) is positive or negative, respectively. (b) Suppose that x = AN(x); then x is non-degenerate if and only if k1 = — A and k2 = — A. Moreover, it is a local extreme or a saddle point of d|S depending on weather ( A + ka)( A + k2) is positive or negative, respectively. Proof. To prove part 1 we consider j (Vd)x(v) = - |t=o||a (t )||2 (15) = 2(a '(0), a (0)) = 2(v, x) where a : (—e, e) —> S is a differentiable curve with a(0) = x and a'(0) = v. Then, (Vd)x(v) = 0 if and only if v ± x if and only if x = ±AN(x) if and only if N(x) ± TxS2(A) (||x|| = A) if and only if TtS = Tt§2(A). An alternative proof using local coordinates can be found in Milnor (1969). To prove part 2a we consider the Hessian of d at x, d2 d (V2d)x(v) = ^ |t=o||a (t )||2 = 2 - |t=o(a '(t), a (t)} = 2((a ''(0), a (0)} + (a'(0), a '(0)}) Now, if we take derivatives at t = 0 of the identity (a'(t), —AN(a(t))} = 0 we obtain (a''(0), —AN(x)} = — (v, —AdN(x)(v)} . Since the second fundamental form of S at x is defined as //x(v, v) = — (dN(x)(v), v} and it is symmetric, we obtain (V2d)x(v) = 2(11v112 — A//x(v, v)) . (17) Let {ei, e2} be a principal orthonormal frame at x; then, in matrix form we have (V2d)x(v) = v 1 - AK1 0 0 1 - AK2 T V . (18) = 2((a''(0),-AN(x)) + (v,v)) . So, x is non-degenerate if (1 — A K1)(1 — A k2) = 0; that is, K1 = A and k2 = A. The rest of part 2a is derived from the classification of local extrema and the proof of part 2b is similar. □ Corollary 1. Let S c R3 be a closed orientable smooth surface in R3. Then X (S) = £ sign(1 — Axn)(1 — AK2) xeS / x=—A N(x) + £ sign(1 + Ak1 )(1 + AK2) xeS / x=A N(x) = £ sign(1 — 2A H (x)+ A 2K (x)) xeS / x=—A N(x) + £ sign(1 + 2AH(x)+ A2K(x)) . xeS / x=A N(x) (19) where H(x) denotes the mean curvature of S at x. Proo/ This formula is a direct consequence of Eq. 1 and Theorem 3. □ Remark. In Milnor (1969) it is proved that for almost all O e R3 the function d|S is a Morse function; i.e., in general, all the critical points of d|S are non-degenerate (these points are characterized in Theorem 3). When O e S, from Eqs. 15 and 16, we have that d| S has a non-degenerate critical point (minimum) at x = O. In this case IndO(d|S) = +1. DOMAINS IN R2 Let D c R2 be a domain with boundary. As in the preceding section, we consider now the square of the distance function d : R2 ^ R, instead of the square of the distance function of R3. The level curves nA2 are in this case circles S1 (A). We suppose that the origin O e R2 \ dD, then, the square of the distance function d| D only has the point O as critical point (minimum) if O e D (the distance function d defined in D is given now by d (x, y) = x2 + y2; and this function has a minimum at the point O = (0,0) e D). Moreover, in general, the restriction of the square of the distance function d|dD is a Morse function; then, from Eq. 14, X (D) = 5q(D) + ^ £ Indy(d|dD) where 5q(D) ye^(d|d d) 1, if O e D Q, if O e D (2Q) (21) Lemma 1. Let D c ! then, X (D) = 5o(D) + 2( ; be a domain with boundary; sign k Vyed D / y=-A n(y) A + yed D / y=A n(y) sign( K + a (22) where n(y) and k(y) are the normal vector and the curvature of the plane curve dD, respectively. Proof. Suppose that a is a parameterization by arc length of dD. Given a point y e £(d|dD), with a(s0) = y, we have Dd(s0) =