Skip to main content

A Locally Gradient-Preserving Reinitialization for Level Set Functions


The level set method commonly requires a reinitialization of the level set function due to interface motion and deformation. We extend the traditional technique for reinitializing the level set function to a method that preserves the interface gradient. The gradient of the level set function represents the stretching of the interface, which is of critical importance in many physical applications. The proposed locally gradient-preserving reinitialization (LGPR) method involves the solution of three PDEs of Hamilton–Jacobi type in succession; first the signed distance function is found using a traditional reinitialization technique, then the interface gradient is extended into the domain by a transport equation, and finally the new level set function is found by solving a generalized reinitialization equation. We prove the well-posedness of the Hamilton–Jacobi equations, with possibly discontinuous Hamiltonians, and propose numerical schemes for their solutions. A subcell resolution technique is used in the numerical solution of the transport equation to extend data away from the interface directly with high accuracy. The reinitialization technique is computationally inexpensive if the PDEs are solved only in a small band surrounding the interface. As an important application, we show how the LGPR procedure can be used to make possible the local level set approach to the Eulerian Immersed boundary method.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8


  1. Adalsteinsson, D., Sethian, J.A.: A fast level set method for propagating interfaces. J. Comput. Phys. 118, 269–277 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  2. Aujol, J.F., Aubert, G.: Signed distance functions and viscosity solutions of discontinuous Hamilton–Jacobi equations. Technical Report RR-4507, INRIA (2002)

  3. Batchelor, G.K.: An Introduction to Fluid Dynamics. Cambridge University Press, Cambridge (2000)

    Book  MATH  Google Scholar 

  4. Bottino, D.C.: Modeling viscoelastic networks and cell deformation in the context of the immersed boundary method. J. Comput. Phys. 147, 86–113 (1998)

    Article  MATH  Google Scholar 

  5. Chang, Y.C., Hou, T.Y., Merriman, B., Osher, S.: A level set formulation of Eulerian interface capturing methods for incompressible fluid flows. J. Comput. Phys. 124, 449–464 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  6. Choi, H.I., Choi, S.W., Moon, H.P.: Mathematical theory of medial axis transform. Pacific J. Math. 181(1), 57–88 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  7. Chrispell, J.C., Cortez, R., Khismatullin, D.B., Fauci, L.J.: Shape oscillations of a droplet in an Oldroyd-B fluid. Phys. D 240(20), 1593–1601 (2011)

    Article  MATH  Google Scholar 

  8. Chrispell, J.C., Fauci, L.J., Shelley, M.: An actuated elastic sheet interacting with passive and active structures in a viscoelastic fluid. Phys. Fluids. 25(1), 013,103 (2013)

    Article  MATH  Google Scholar 

  9. Cottet, G.H., Maitre, E.: A level-set formulation of immersed boundary methods for fluid–structure interaction problems. C. R. Acad. Sci. Paris 338, 581–586 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  10. Cottet, G.H., Maitre, E.: A level set method for fluid–structure interactions with immersed surfaces. Math. Models Methods Appl. Sci. 16, 415–438 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  11. Cottet, G.H., Maitre, E.: Eulerian formulation and level set models for incompressible fluid–structure interaction. Math. Model Numer. Anal. 42, 471–492 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  12. Crandall, M.G., Lions, P.: Viscosity solutions of Hamilton–Jacobi equations. Trans. Am. Math. Soc. 277, 1–42 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  13. Crandall, M.G., Lions, P.: Two approximations of solutions of Hamilton–Jacobi equations. Math. Comput. 43, 1–19 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  14. Deckelnick, K., Elliott, C.M.: Uniqueness and error analysis for Hamilton–Jacobi equations with discontinuities. Interfaces Free Bound 6, 329–349 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  15. Evans, L.C.: Partial Differential Equations, 2nd edn. American Mathematical Society, Providence, RI (2010)

  16. Festa, A., Falcone, M.: An approximation scheme for an eikonal equation with discontinuous coefficient. SIAM J. Numer. Anal. 52(1), 236–257 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  17. Guy, R.D., Thomases, B.: Computational challenges for simulating strongly elastic flows in biology. In: Spagnolie, S.E. (ed.) Complex Fluids in Biological Systems, pp. 359–397. Springer, New York (2015)

  18. Harten, A.: ENO schemes with subcell resolution. J. Comput. Phys. 83, 148–184 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  19. Ishii, H.: Hamilton–Jacobi equations with discontinuous Hamiltonians on arbitrary open sets. Bull. Fac. Sci. Eng. Chuo Univ. 28, 33–77 (1985)

    MathSciNet  MATH  Google Scholar 

  20. Ishii, H.: Existence and uniqueness of solutions of Hamilton–Jacobi equations. Funkc. Ekvacio 29, 167–188 (1986)

    MathSciNet  MATH  Google Scholar 

  21. Ishii, H.: A simple, direct proof of uniqueness for solutions of the Hamilton–Jacobi equations of Eikonal type. Proc. Am. Math. Soc. 100, 247–251 (1987)

    Article  MathSciNet  MATH  Google Scholar 

  22. Jin, S., Liu, H.L., Osher, S., Tsai, R.: Computing multi-valued physical observables for the high frequency limit of symmetric hyperbolic systems. J. Comput. Phys. 210, 497–518 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  23. Kim, J., Moin, P.: Application of a fractional-step method to incompressible Navier–Stokes equations. J. Comput. Phys. 59(2), 308–323 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  24. Koike, S.: A Beginner’s Guide to the Theory of Viscosity Solutions. Mathematical Society of Japan, Tokyo (2004)

  25. Lai, M.C., Peskin, C.S.: An immersed boundary method with formal second-order accuracy and reduced numerical viscosity. J. Comput. Phys. 160, 705–719 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  26. Li, Z., Zhao, H., Gao, H.: A numerical study of electro-migration voiding by evolving level set functions on a fixed Cartesian grid. J. Comput. Phys. 201, 281–304 (1999)

    Article  MATH  Google Scholar 

  27. Lieutier, A.: Any open bounded subset of \(R^n\) has the same homotopy type as its medial axis. Comput. Aided Des. 36(11), 1029–1046 (2004)

    Article  Google Scholar 

  28. Lions, P.L.: Generalized Solutions of Hamilton–Jacobi Equations. Cambridge University Press, Cambridge (1992)

    Google Scholar 

  29. Malladi, R., Sethian, J.A.: Image processing via level set curvature flow. Proc. Natl. Acad. Sci. 92, 7046–7050 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  30. Min, C.: On reinitializing level set functions. J. Comput. Phys. 229, 2764–2772 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  31. Mori, Y., Peskin, C.S.: Implicit second-order immersed boundary methods with boundary mass. Comput. Methods Appl. Mech. Eng. 197, 2049–2067 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  32. Mushenheim, P.C., Pendery, J.S., Weibel, D.B., Spagnolie, S.E., Abbott, N.L.: Straining soft colloids in aqueous nematic liquid crystals. Proc. Natl. Acad. Sci. 113, 5564–5569 (2016)

    Article  Google Scholar 

  33. Newren, E.P., Fogelson, A.L., Guy, R.D., Kirby, R.M.: Unconditionally stable discretizations of the immersed boundary equations. J. Comput. Phys. 222, 702–719 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  34. Osher, S., Fedkiw, R.: Level set methods: an overview and some recent results. J. Comput. Phys. 169, 463–502 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  35. Osher, S., Sethian, J.: Fronts propagating with curvature dependent speed: algorithms based on Hamilton–Jacobi formulations. J. Comput. Phys. 79, 12–49 (1988)

    Article  MathSciNet  MATH  Google Scholar 

  36. Osher, S., Shu, C.: Higher-order essentially nonoscillatory schemes for Hamilton–Jacobi equations. SIAM J. Numer. Anal. 28, 907–922 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  37. Ostrov, D.N.: Extending viscosity solutions to Eikonal equations with discontinuous spatial dependence. Nonlinear Anal. 42, 709–736 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  38. Peng, D., Merriman, B., Osher, S., Zhao, H., Kang, M.: A PDE-based fast local level set method. J. Comput. Phys. 155, 410–438 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  39. Peskin, C.S.: The immersed boundary method. Acta Numer. 11, 479–517 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  40. Salac, D., Miksis, M.: A level set projection model of lipid vesicles in general flows. J. Comput. Phys. 230(22), 8192–8215 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  41. Sethian, J.A.: A fast marching level set method for monotonically advancing fronts. Proc. Natl. Acad. Sci. 93, 1591–1595 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  42. Sethian, J.A.: Level Set Methods and Fast Marching Methods: Evolving Interfaces in Computational Geometry, Fluid Mechanics, Computer Vision, and Materials Science, vol. 3. Cambridge University Press, Cambridge (1999)

    MATH  Google Scholar 

  43. Soravia, P.: Optimal control with discontinuous running cost: Eikonal equation and shape-from-shading. In: Proceedings of 39th IEEE Conference on Decision and Control, 2000, vol 1, pp. 79–84. IEEE (2000)

  44. Soravia, P.: Boundary value problems for Hamilton–Jacobi equations with discontinuous Lagrangian. Indiana Univ. Math. J. 51, 451–476 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  45. Soravia, P.: Degenerate Eikonal equations with discontinuous refraction index. ESAIM: COCV 12, 216–230 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  46. Strychalski, W., Copos, C.A., Lewis, O.L., Guy, R.D.: A poroelastic immersed boundary method with applications to cell biology. J. Comput. Phys. 282, 77–97 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  47. Sussman, M., Smereka, P., Osher, S.: A level set approach for computing solutions to incompressible two-phase flow. J. Comput. Phys. 114, 146–159 (1994)

    Article  MATH  Google Scholar 

  48. Teran, J., Fauci, L., Shelley, M.: Peristaltic pumping and irreversibility of a Stokesian viscoelastic fluid. Phys. Fluids 20(073), 101 (2008)

    MATH  Google Scholar 

  49. Teran, J., Fauci, L., Shelley, M.: Viscoelastic fluid response can increase the speed and efficiency of a free swimmer. Phys. Rev. Lett. 104(3), 038,101 (2010)

    Article  Google Scholar 

  50. Thomases, B., Guy, R.D.: Mechanisms of elastic enhancement and hindrance for finite-length undulatory swimmers in viscoelastic fluids. Phys. Rev. Lett. 113(9), 098,102 (2014)

    Article  Google Scholar 

  51. Tsai, Y.H.R., Cheng, L.T., Osher, S., Zhao, H.K.: Fast sweeping algorithms for a class of Hamilton–Jacobi equations. SIAM J. Numer. Anal. 41(2), 673–694 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  52. Zhao, H.K.: A fast sweeping method for Eikonal equations. Math. Comput. 74(250), 603–627 (2005)

    Article  MathSciNet  MATH  Google Scholar 

Download references


X. Xu acknowledges support by NSF-DMS Grant 1159133.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Saverio E. Spagnolie.


Appendix A: Cut Locus of the Interface

We first show that the signed distance function \(\varphi \) is not differentiable at any point in A.

Lemma 3

Under the assumptions stated in Sect. 3, \(\varphi \) is not differentiable at any point in A.


Since \(\bar{A}\cap \varGamma =\emptyset \), to show that \(\varphi \) is not differentiable we show that \(d(x,\varGamma )\) is not differentiable at \(x\in A\cap U\) (the treatment of \(A\cap U^c\) is similar). By the definition of A, we can find \(y_1, y_2\in \varGamma \), \(y_1\ne y_2\) so that \(d(x, y_1)=d(x, y_2)=\varphi (x)\). Suppose that \(\varphi \) is differentiable at x. We must have \(|\nabla \varphi (x)|=1\). Let \(\hat{n}=\nabla \varphi (x)\). We have \(x+\varepsilon \hat{n}\in U\) for small enough \(\varepsilon >0\). The inequality \(d(x+\varepsilon \hat{n}, y_1)\ge \varphi (x+\varepsilon \hat{n})>\varphi (x)\) then gives

$$\begin{aligned} d(x+\varepsilon \hat{n}, y_1)-d(x, y_1)\ge \varepsilon +o(\varepsilon ), \end{aligned}$$

and the law of cosines tells us that \(\angle (\hat{n}, x-y_1)=0\). But the same argument indicates that \(\angle (\hat{n}, x-y_2)=0\), leading to a contradiction.

We now show that if U is convex, \(d(\bar{A}, \varGamma )=d(A,\varGamma )\ge \inf \{1/\kappa \}>0\). This follows from the following lemma about the local structure of the curve satisfying Assumption 1.

Lemma 4

For any \(a\in A\) and any two points \(y,z\in P(a)\), if the portion of \(\varGamma \) between y and z is the graph of a function over the segment yz, then \(\exists \, w\) on the portion such that \(\kappa (w)\mu (a)\ge 1/d(a,\varGamma )\) where \(\mu (a)=1\) if a is inside \(\varGamma \) and \(\mu (a)=-1\) otherwise.


We take the straight line yz to be the \(x_1\)-axis, and assume at point z that the tangent line of \(\varGamma \) has a positive slope with angle \(\theta \). The projections of y and z to the \(x_1\)-axis are denoted by \(y_1\) and \(z_1\). As the portion of \(\varGamma \) between y and z is the graph of a function of \(x_1\), then so is \(\kappa \): \(\kappa =\kappa (x_1)\). By integrating \(\kappa \) between \(y_1\) and \(z_1\) (\(\kappa \) is integrable by the assumption on the interface), we have

$$\begin{aligned} \mu (a)\int _{y_1}^{z_1}\kappa (x_1)dx_1=2\sin (\theta ). \end{aligned}$$

By basic trigonometry, \(z_1-y_1=2d(a,\varGamma )\sin (\theta )\). Hence, we can find \(w_1\in [y_1, z_1]\) so that

$$\begin{aligned} \mu (a)\kappa (w_1)\ge \frac{2\sin (\theta )}{2d(a,\varGamma )\sin (\theta )}=\frac{1}{d(a,\varGamma )}. \end{aligned}$$

Returning to the previous claim, if U is convex, then \(A\subset U\), \(\mu (a)=1\) and \(\kappa (w)\ge 0\), and the claim then follows from Lemma 4.

Although we will not use the following “no cusp” property in this paper, this is still an interesting property of the cut locus geometry. This property is crucial in the literature when the uniqueness of the viscosity solution to the eikonal equation is discussed.

Theorem 4

For a locally analytical boundary \(\varGamma \), there are no cusps with zero angles in \(\bar{A}\).


We will sketch the proof without details. Consider \(\bar{A}\cap U\) as the example. Suppose that there are two edges making a zero angle at \(x\in \bar{A}\cap U\). Parametrize them with arc lengths: \(\gamma _1(s)\) and \(\gamma _2(s)\), such that \(\gamma _1(0)=\gamma _2(0)=x\),\(\gamma _1'(0)=\gamma _2'(0)=:\hat{n}\) and that \(\forall \varepsilon >0\), \(\exists s_{\varepsilon }\in (0,\varepsilon )\), \(\gamma _1(s_{\varepsilon })\ne \gamma _2(s_{\varepsilon })\). By Lemma 1, there is an opening region between \(\gamma _1\) and \(\gamma _2\). Choose a sequence \(x_k\) approaching x inside the region such that the projection of \(Px_k\) (which is one point) approaches y. Then \(y\in P(x)\). By Lemma 1, \(x_k\)-\(Px_k\) doesn’t intersect with \(\bar{A}\). As a limit line segment, x-y doesn’t cross \(\gamma _1,\gamma _2\) and thus is tangent to the two curves, namely \(\hat{n}=(y-x)/|y-x|\). \(\gamma _1\) and \(\gamma _2\) must be on the two sides of the line xy. Consider \(\gamma _1\) and the portion of \(\varGamma \) on that side, parametrized as \(\varGamma _0(u)\) with \(\varGamma _0(0)=y\). Then there exists a \(\delta >0\) such that the curvature is a smooth function on \([0,\delta ]\) (if necessary, redefine \(\kappa (0)=\lim _{u\rightarrow 0^+}\kappa (u)\)). Choose \(s_k\rightarrow 0^+\) such that \(\#P\gamma _1(s_k)\ge 2\). From the fact that \(x-y\) is the tangent line of \(\gamma _1\) at x, \(x-\gamma _1(s_k)\) and \(\gamma _1(s_k)-y\) are almost parallel for sufficiently large k. Then, for k large enough, \(w_k\in P\gamma _1(s_k)\), \(d(x,w_k)\ge d(x,y)\) implies that \(w_k\) must fall onto \(\varGamma _0(s)\) for \(0\le s\le \delta \). Using \(\gamma _1(s_k)=x+s_k\hat{n}+O(s_k^2)\) and \(P(x+s_k\hat{n})=y\), we know \(\forall w_k\in P\gamma _1(s_k)\) that \(|w_k-y|=O(s_k^2)\). By Lemma 4 and since \(\delta \) is small, there is a \(u_k\) such that \(\varGamma _0(u_k)\) is between two points in \(P\gamma _1(s_k)\) and \(\kappa (u_k)\ge 1/d(\gamma _1(s_k), \varGamma )\). It is clear that \(u_k=O(s_k^2)\). The contradiction is obtained by noticing that \(\kappa (0)\le 1/d(x,y)\) and \(O(s_k^2)=|\kappa (u_k)-\kappa (0)|\ge |1/d(\gamma _1(s_k), \varGamma )-1/d(x,y)|\ge Cs_k\) for some \(C>0\). \(\square \)

Appendix B: Existence and Uniqueness of Solutions of the Eikonal Equation with a Discontinuous Cost Function

Here we prove the existence and uniqueness of the viscosity solution to (4) (Theorem 2). The proof of existence is standard, but the proof of uniqueness is not. There is one essential difference to the cases under consideration in [14, 16, 37, 44, 45]: here, the cut locus may have bifurcation points. This means that there can exist a point x in the singular set of the cost function such that for any disc B centered at x, B will be divided by the singular set into more than two parts. The arguments in references [14, 16, 37, 44, 45] then do not apply. Note that there is another subtle difference in our proof. Although from Theorem 4 we have that there are no cusps with zero angles in the singular set of the cost function, our proof does not rely on this fact.

1.1 Existence

We take \(x\in U\) as an example case. We show that \(\phi _M\) is a viscosity solution; a similar argument applies to \(\phi _m\). Recall that \(0<c_1\le f\le c_2\) and that \(f^{\varepsilon }, f_{\varepsilon }\) are given in (14). We have the following relationships:

$$\begin{aligned} c_1\le & {} \text {essinf}\{f(y)| y\in B(x,\sqrt{(c_2-c_1)\varepsilon })\} \le f_{\varepsilon }(x)\le f_*(x)\nonumber \\\le & {} f^*(x)\le f^{\varepsilon }(x)\le \text {esssup}\{f(y)| y\in B(x,\sqrt{(c_2-c_1)\varepsilon })\}\le c_2. \end{aligned}$$

\(f_{\varepsilon }\) increases to \(f_*\) while \(f^{\varepsilon }\) decreases to \(f^*\), and \(f^{\varepsilon }\)(\(f_{\varepsilon }\)) is continuous. The corresponding solution \(\phi ^{\varepsilon }\) is given as in (9). One then could verify the following dynamic programming principle: for \(x\in U\) and \(0\le s_1\le d(x, \varGamma )\),

$$\begin{aligned} \phi ^{\varepsilon }(x)=\inf _{\gamma \in \mathscr {C}}\left\{ \int _{0}^{s_1}f^{\varepsilon }(\gamma (s))ds+\phi ^{\varepsilon }(\gamma (s_1))|\gamma (0)=x\right\} . \end{aligned}$$

The proof of this principle is omitted here. For similar arguments, one could refer to Chapter 10 of [15]. A direct conclusion from this principle is that

$$\begin{aligned}&0\le \phi ^{\varepsilon }\le c_2 d(x,\varGamma ),\nonumber \\&|\phi ^{\varepsilon }(x)-\phi ^{\varepsilon }(y)|\le c_2|x-y|. \end{aligned}$$

By the Arzela–Ascoli theorem, since \(\bar{U}\) is compact, there is a subsequence \(\phi ^{\varepsilon _k}\) that converges uniformly to \(\bar{\phi }\).

Now suppose that \(\bar{\phi }-\zeta \) has a local maximum at \(x_0\in U\). For small \(\delta >0\), \(\bar{\phi }-\zeta -\delta |x-x_0|^2\) has a strict local maximum at \(x_0\). There is a sequence of local maxima \(x_k\) for \(\phi ^{\varepsilon _k}-\zeta -\delta |x-x_0|^2\) that converges to \(x_0\) by the uniform convergence of the function sequence. Fixing \(K>0\), for \(k>K\), we have

$$\begin{aligned} |\nabla \zeta (x_k)+2\delta (x_k-x_0)|\le f^{\varepsilon _k}(x_k)\le f^{\varepsilon _K}(x_k). \end{aligned}$$

Letting \(k\rightarrow \infty \), since \(f^{\varepsilon _K}\) is continuous, \(|\nabla \zeta (x_0)|\le f^{\varepsilon _K}(x_0)\). Sending \(K\rightarrow \infty \), we obtain \(|\nabla \zeta (x_0)|\le f^*(x_0)\). For a local minimum at \(x_0\), the argument is similar. Here, we just use the modified function \(\bar{\phi }-\zeta +\delta |x-x_0|^2\) and the inequalities

$$\begin{aligned} |\nabla \zeta (x_k)-2\delta (x_k-x_0)|\ge f^{\varepsilon _k}(x_k)\ge f_{\varepsilon _k}(x_k)\ge f_{\varepsilon _K}(x_k) \end{aligned}$$

for \(k>K\). Thus, \(|\nabla \zeta (x_0)|\ge f_*(x_0)\) and \(\bar{\phi }\) is a viscosity solution.

Now, fixing any \(\delta >0\), we can find \(K>0\) so that \(\bar{\phi }(x)+\delta >\phi ^{\varepsilon _k}(x)\) when \(k>K\) for any \(x\in U\). However, \(\exists \,\gamma \) with \(\gamma (0)=x\) such that \(\phi ^{\varepsilon _k}+\delta >\int _0^Lf^{\varepsilon }(\gamma (s))ds\ge \int _0^Lf^*(\gamma (s))ds\). Note that \(f^*(\gamma (\cdot ))\) is the infimum of continuous functions and thus Lebesgue measurable on [0, T]. Meanwhile, \(\bar{\phi }(x)-\delta \le \phi ^{\varepsilon _k}(x)\le \int _0^L f^{\varepsilon _k}(\gamma (s))ds\) for k large enough and any \(\gamma \in \mathscr {C}\) with \(\gamma (0)=x\) and \(\gamma (L)\in \varGamma \). Now fixing \(\gamma \) and taking \(k\rightarrow \infty \), the dominant convergence theorem tells us that \(\bar{\phi }(x)-\delta \le \int _0^Lf^*(\gamma (s))ds\). Hence:

$$\begin{aligned} \bar{\phi }(x)=\inf _{\gamma \in \mathscr {C}}\left\{ \int _0^{L}f^*(\gamma (s))ds ,\ \Big | \, \gamma (0)=x, \gamma (L)\in \varGamma \right\} =\phi _M(x). \end{aligned}$$

The dynamic programming principle for \(\phi _M\) still holds and \(\phi _M\) is also bounded and Lipschitz continuous with the same constants.

1.2 Uniqueness

We again fix \(x\in U\), and show that \(\phi _m(x)=\phi _M(x)\). For any \(\varepsilon >0\), we can find \(\gamma \in \mathscr {C}\) with \(\gamma (0)=x\) and \(\gamma (L)\in \varGamma \) so that \(\int _0^Lf_*(\gamma (s))ds<\phi _m(x)+\varepsilon \). \(\gamma \) has no self-intersection by the definition of \(\mathscr {C}\).

By Lemma 2, except at finitely many points, all the points in \(\bar{A}\) belong to some open locally analytical curves and have a projection with size 2. Noticing that \(\gamma \) is an injection, we pick a set E that covers the finite irregular points such that the total length of \(\gamma \) falling into E is less than \(\varepsilon /c_2\), where \(c_2\) is the upper bound of \(f^*\). Then the remaining part \(\bar{A}\setminus E\) has the following properties: it is the disjoint union of N curve portions \(e_n, 1\le n\le N\); for any \(x\in e_n\), we can find a ball \(B(x, r_x)\) (\(r_x>0\)) so that every point in \(\bar{A}\cap B(x,r_x)\) has a projection of size 2 and \(\bar{A}\cap B(x,r_x)\) is real analytic.

Step 1. We first show that the cost function f has limits on both sides of the edge \(e_n\).

For any \(x\in e_n\), \(B(x,r_x)\) is divided into two subdomains \(B_1\) and \(B_2\) by \(\bar{A}\). Let \(x_k\in B_1\cap U\), \(x_k\rightarrow x\). The sequence \(w_k=Px_k\) has a limit point \(z\in Px\). Further inspection reveals that z is the only limit point of \(w_k\) since \(\#Px=2\) and the sequences in \(B_2\) give another. This means that for every sequence in \(B_1\) converging to x, the projections converge to z. Hence, \(\lim _{y\rightarrow x, y\in B_1} f(y)=\chi (z)\). If the limit function is \(f_1\), by the continuity of projection on one side, \(f_1\) is continuous on \(e_n\). \(f_2\) may be similarly defined.

Step 2. We now decompose \(\bar{A}\) into several parts so that on each part \(\int (f^*-f_*)(\gamma (s))ds\) can be dealt with appropriately.

Let \(e_n\) be equipped with the 1D Lebesgue measure m induced by the arc length, and let \(F_n=\{x\in e_n: f_1(x)=f_2(x)\}\). Clearly, \(f^*=f_*\) on \(F_n\) and \(F_n\) is closed. The set \(e_n\setminus F_n=\{x\in e_n: f_1-f_2>0, \text{ or } f_1-f_2<0\}\) is open, thus is the disjoint union of countable subintervals in \(e_n\). Since the sum of lengths of these subintervals is finite, we can find finitely many of them, say \(M_n\) of them, such that the measure of the remaining is small. For these \(M_n\) intervals, we can cover the endpoints and get \(M_n\) new subintervals denoted as \(I_i, 1\le i\le M_n\). Hence, we can decompose \(e_n\) into \(G_n\) with \(m(G_n)<\varepsilon /Nc_2\), \(F_n\) and \(\cup _{i=1}^{M_n}I_i\). Let’s consider all the \(M=\sum _n M_n\) subintervals. \(\exists \delta _1,\delta >0\) that depend on E, \(F_n, G_n, 1\le n\le N\), such that each subinterval \(I_i\) satisfies: \(U_i=\{x: d(x, I_i)\le \delta _1\}\) is divided into two domains \(V_{i1}, V_{i2}\), \(f^*\in C(\bar{V}_{i2})\), \(f_*\in C(\bar{V}_{i1})\), and \(\inf _{x\in V_{i2}, y\in V_{i1}} f^*(x)-f_*(y)\ge \delta \). We have thus decomposed \(\bar{A}\) into the union of following sets: \(M=\sum _n M_n\) subintervals; a closed set on which \(f_*=f^*\); and a set (union of \(G_n\) and E) with measure less than \(2\varepsilon /c_2\).

Let \(C_i=\{s: \gamma (s)\in I_i\}\) be a subset of [0, L] and \(C=\cup _{i=1}^MC_i\). It is clear that \(\int _{[0,L]\setminus C}(f^*-f_*)(\gamma (s))ds<2\varepsilon \). Hence, we only need to study the integral on \(C_i\).

Step 3. We now obtain a local property of the portion of \(\gamma \) on \(C_i\).

By the local smoothness of the edges, \(\exists \alpha >0\), \(\delta _3<\delta _1/2\), such that if \(s_1, s_2\in C_i\), with \(s_2-s_1\le \delta _3\), then the length of \(I_i\) between \(\gamma (s_1)\) and \(\gamma (s_2)\) is at most \((s_2-s_1)+\alpha (s_2-s_1)^2\). If \(\exists s\in (s_1,s_2)\) so that \(\gamma (s)\notin \bar{V}_{i1}\), then there is an subinterval \([s_3,s_4]\subset [s_1,s_2]\) such that \(s\in [s_3,s_4]\) and \(\gamma ((s_3,s_4))\cap \bar{V}_{i1}=\emptyset \). Since \(\delta _3<\delta _1/2\), \(\gamma ([s_3,s_4])\) cannot leave \(\bar{V}_{i2}\). Noticing that \(f^*=f=f_*\) on \(\gamma ((s_3,s_4))\),

$$\begin{aligned} \int _{\gamma [s_3,s_4]}f_*ds=\int _{\gamma [s_3,s_4]}f^*ds>\int _{J}f_*ds+(s_4-s_3)\delta -\alpha (s_4-s_3)^2c_2, \end{aligned}$$

where J is the part of \(I_i\) between \(\gamma (s_3)\) and \(\gamma (s_4)\). If we pick \(\delta _3\) small enough, we could have \((s_4-s_3)\delta -\alpha (s_4-s_3)^2c_2>0\). We replace \(\gamma ([s_3,s_4])\) with J and get a new curve \(\tilde{\gamma }\), and we see that \(\int _{\tilde{\gamma }}f_*ds<\int _{\gamma }f_*ds\). \(\tilde{\gamma }\) may be self-intersecting. We can modify it as following: If J intersects with \(\gamma (0,s_3)\). we find the infimum of \(s_{\min }\) on \([0,s_3]\) so that \(\gamma (s_{\min })\in J\). Then we piece \(\gamma [0, s_{\min }]\) and the part of J starting from \(\gamma (s_{\min })\) together. Then, by the same method we can deal with the case when J intersects with \(\gamma ((s_4,L))\). Such \(s_3,s_4\) pairs correspond to disjoint open intervals, so we can do this modification at most countable many times and get another curve \(\gamma _1\in \mathscr {C}\), so that \(\int _{\gamma _1}f_*ds<\int _{\gamma }f_*ds\). Hence, without loss of generality we can assume \(\gamma \) satisfies this property: if \(s_1, s_2\in C_i, |s_2-s_1|<\delta _3\), then \(\gamma ([s_1, s_2])\subset \bar{V}_{i1}\).

Step 4. With the property obtained, we perturb the curve defined on \(C_i\) so that the integral on \(C_i\) can be treated.

\(C_i\) is closed and consists of countable closed intervals (they are subintervals of [0, L], different from the intervals on the edge portion) and a nowhere dense set \(G_i'\) (\(G_i'\) may have positive measure). Moreover \(G_i=\bar{G}_i'\) is still nowhere dense since the extra possible points are the endpoints of the intervals. By the assumption above, we may write \(G_i=\cup _{j=1}^{N_1} G_{ij}\) for some \(N_1\in \mathbb {N}\). \([\inf G_{ij}, \sup G_{ij}]\setminus G_{ij}\) does not contain any interval of length \(\ge \delta _3\) for any j, so that \(\gamma ([\inf G_{ij}, \sup G_{ij}]) \subset \bar{V}_{i1}\), and

$$\begin{aligned} \inf _{v_1\in G_{ij_1}, v_2\in G_{ij_2}}|v_1-v_2|\ge \delta _3 \end{aligned}$$

Now, assume K is \(G_{ij}\) or one of the intervals in \(C_i\), and let \(s_l=\inf K, s_r=\sup K\) and \(\varepsilon _1>0\) be fixed. We can find finitely many points \(s_{k}\) in K and the difference between two consecutive points is less than \(\delta _3\). We shift \(\gamma ([s_{k}, s_{k+1}])\) along the normal of \(I_i\) at \(\gamma (s_{k})\) toward \(V_{i1}\) with distance \(\delta _4\). Now, we add line segments to connect the endpoints. The shifted curve portions and line segments are all in \(V_{i1}\) if \(\delta _4\) is small enough. Denote the curve so obtained by \(\gamma '\). By the uniform continuity of \(f_*\) in \(\bar{V}_{i1}\), we have \(\int _{\gamma '}f_*ds<\int _{\gamma }f_*ds+\varepsilon _1\). However, \(\gamma '\) may be self-intersecting. We now modify it following an essentially similar procedure as before: \(\gamma '\) consists of \(\gamma [0,s_l]\), \(\gamma [s_r, L]\) and the shifted curves together with line segments, denoted as \(\tilde{P}\). Consider the first shifted curve portion with the line segment \(\tilde{P}_{1}\). Suppose \(k\ge 2\) is the largest number such that \(\tilde{P}_{k}\) intersects with \(\tilde{P}_{1}\). We find the first point on \(\tilde{P}_1\) that is on \(\tilde{P}_k\), then discard the part on \(\tilde{P}_1\) after this point and all curve portions \(\tilde{P}_l\) with \(1<l<k\) and the part on \(\tilde{P}_k\) that is before this point. Since the portions are finite, this process can be terminated, resulting in \(P\subset \tilde{P}, P\in \mathscr {C}\) that connects \(\gamma (s_l)\) and \(\gamma (s_r)\). The remaining work is the same as how J was modified before. Then, we find a new curve \(\gamma _2\). \(\int _{\gamma _2}f_*ds\le \int _{\gamma '}f_*ds\). By the construction, we have removed \(K\setminus \{s_l,s_r\}\) from \(C_i\) without adding new points. Such sets are countable, we can finish this process and obtain a curve \(\gamma _3\), so that \(C_i(\gamma _3)\) consists of countably many points and \(\int _{\gamma _3}f_*ds-\int _{\gamma }f_*ds<\varepsilon /M\) since \(\varepsilon _1\) is arbitrary.

Hence, we are able to construct a curve \(\gamma _4\) with \(\gamma _4(0)=x\) and \(\gamma _4(L)\in \varGamma \) (since it has the same endpoints as \(\gamma \)) such that \(\int _{\gamma _4}f^*ds\le \int _{\gamma _4}f_*ds+2\varepsilon<\int _{\gamma }f_*ds+3\varepsilon <\phi _m(x)+4\varepsilon \), which verifies the condition so that \(\phi _m(x)=\phi _M(x)\).

Appendix C: The Solution of the Reinitialization Equation

In this section we show that the formula given in (19) is a viscosity sub-solution of the level-set reinitialization equation. An argument showing that it is also a super-solution is similar.

Consider that \(u-\zeta \), where \(\zeta \) is \(C^{\infty }\), has a local maximum at \((x_0, \tau _0)\) for \(\tau _0>0\). We show that the sub-solution condition is satisfied. If \(\tau _0>\tau _{x_0}\), then in a neighborhood of \((x_0,\tau _0)\), we have \(\tau >\tau _x\) since \(\tau _x\) is continuous on x. The solution does not depend on \(\tau \), and we also must have \(\zeta _{\tau }(x_0,\tau _0)=0\). The sub-solution condition is satisfied for \(x_0\notin \varGamma \) as the condition has already been verified for the eikonal equation. If \(x_0\in \varGamma \), \([\text{ sgn }(u_0)(|p|-g)]_*|_{p=\nabla \zeta (x_0), x=x_0}\le 0\) is assured.

Consider \(0<\tau _0\le \tau _{x_0}\). Then \(u_0(x_0)\ne 0\) since for any \(x\in \varGamma \), we have \(\tau _x=0<\tau _0\). Take \(u_0(x_0)>0\) (the result for \(u_0(x_0)<0\) is similar). Let \(h_1=\min \{\tau _0, d(x_0,\varGamma )\}>0\). There exists \(0<h_2\le h_1\), such that the dynamical programming principle holds for \(h<h_2\):

$$\begin{aligned} u(x_0, \tau _0)=\inf _{\gamma }\left\{ u(\gamma (h), \tau _0-h)+\int _0^hg(\gamma (s))ds \,\Big |\,\gamma (0)=x_0 \right\} . \end{aligned}$$

We now show this principle. Since \(\tau _0\le \tau _{x_0}\), for any \(\varepsilon >0\), we can find \(\gamma \) with \(\gamma (0)=x_0\) such that \(u(x_0,\tau _0)+\varepsilon >u_0(\gamma (\tau _0))+\int _0^{\tau _0}g(\gamma (s))ds\). By the definition, \(\int _h^{\tau _0}g(\gamma (s))ds+u_0(\gamma (\tau _0))\ge u(\gamma (h), \tau _0-h)\) whether or not \(\tau _0-h>\tau _{\gamma (h)}\). ‘\(\ge \)’ is thus shown.

We now show the other direction. Let \(B=\inf _{\gamma }\{\int _0^Lg(\gamma (s))ds |\gamma (0)=x_0,\gamma (L)\in \varGamma \}\), and fix an arbitrary \(\gamma \in \mathscr {C},\gamma (0)=x_0\). We will discuss both cases where either \(\tau _0<\tau _{x_0}\) or not.

Consider \(\tau _0<\tau _{x_0}\). Take \(h_2\le h_1\) small enough so that \(|x-x_0|<h_2, |\tau -\tau _0|<h_2\) implies \(\tau <\tau _x\) due to the continuity of \(\tau _x\). Let \(h<h_2\). We can find \(\gamma _1,\gamma _1(0)=\gamma (h)\) such that \(u(\gamma (h), \tau _0-h)+\varepsilon >\int _0^{\tau _0-h}g(\gamma _1(s))ds+|u_0|(\gamma _1(\tau _0-h))\) since \(\tau _{\gamma (h)}>\tau _0-h\). Connecting \(\gamma (s): 0\le s\le h\) and \(\gamma _1\), we find \(\gamma _2\). \(\gamma _2(\tau _0)=\gamma _1(\tau _0-h)\). Then, \(u(x_0,\tau _0)\le \int _0^{\tau _0}g(\gamma _2(s))ds+|u_0(\gamma _2(\tau _0))|<\int _0^hg(\gamma (h))+u(\gamma (h), \tau _0-h)+\varepsilon \).

We now assume that \(\tau _0=\tau _{x_0}\) (recall that we are discussing the case where \(\tau _0\le \tau _{x_0}\)). We must have that \(u(x_0,\tau _0)=B\). Let \(h<h_1\). If \(\tau _0-h\ge \tau _{\gamma (h)}\), then \(\exists \gamma _1,\gamma _1(0)=\gamma (h)\), \(\gamma _1(L)\in \varGamma \) where \(L\le \tau _0-h\) such that \(u(\gamma (h),\tau _0-h)+\varepsilon >\int _0^Lg(\gamma _1(s))ds\). Then, connecting \(\gamma (s): 0\le s\le h\) and \(\gamma _1\), we get a new curve \(\gamma _3\) with total length \(h+L\le \tau _0\). We then have \(u(x_0,\tau _0)=B\le \int _0^{L+h}g(\gamma _3(s))ds<\int _0^hg(\gamma (s))ds+u(\gamma (h),\tau _0-h)+\varepsilon \). If \(\tau _0-h< \tau _{\gamma (h)}\), we can find \(\gamma _1,\gamma _1(0)=\gamma (h)\) such that \(u(\gamma (h), \tau _0-h)+\varepsilon >\int _0^{\tau _0-h}g(\gamma _1(s))ds+|u_0|(\gamma _1(\tau _0-h))\). Connecting \(\gamma (s): 0\le s\le h\) and \(\gamma _1\), we get \(\gamma _2\). Since \(\tau _0=\tau _{x_0}\), \(B\le \int _0^{\tau _0}g(\gamma _2(s))ds+|u_0(\gamma _2(\tau _0))|\) by the definition of \(u(x_0,\tau _0)\). The same argument as in the previous paragraph follows.

Combining what we have, the dynamic programming principle follows. With this principle the sub-solution condition is easily verified: since \(u(x_0,\tau _0)-\zeta (x_0,\tau _0)\ge u(\gamma (h), \tau _0-h) -\zeta (\gamma (h), \tau _0-h)\), we see that

$$\begin{aligned} \zeta (x_0,\tau _0)\le \inf _{\gamma }\left\{ \zeta (\gamma (h), \tau _0-h)+\int _0^hg(\gamma (s))ds \, \Big |\,\gamma (0)=x_0 \right\} , \end{aligned}$$

which implies that

$$\begin{aligned} \zeta _{\tau }(x_0,\tau _0)+|\nabla \zeta |(x_0,\tau _0)\le g(x_0). \end{aligned}$$

Rights and permissions

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Li, L., Xu, X. & Spagnolie, S.E. A Locally Gradient-Preserving Reinitialization for Level Set Functions. J Sci Comput 71, 274–302 (2017).

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: