1 Introduction

Sphere is one of the important geometric primitives. It finds numerous applications in different areas of science and engineering, starting from the age-old manufacturing industry and ending at today’s rapid prototyping and 3D imaging. Being non-linear, its discretization in the integer space remains a well-studied research problem, since the topological properties like gap-freeness, tunnel-freeness, tiling, surface connectivity, and minimality are associated with it [1, 2, 5, 9, 10, 13, 21, 23, 26].

For reconstruction of 2D/3D discrete objects, several techniques can be found in the literature [16, 20]. Since formulation of an appropriate topology ensures well-composed discrete sets [19], topological properties are used in many techniques to repair/reconstruct discrete surfaces [11, 15, 18, 22, 24, 25]. However, all the existing works are related either with discrete triangulated objects in the Euclidean space or with general voxelized surfaces. To the best of our knowledge, there is no existing work related with topological properties of a specific voxelized surface such as sphere. In this paper, we present the first study on some local topological properties of (naive) discrete sphere and show an interesting application of these properties for reconstruction of a spherical surface.

1.1 Motivation and Main Results

Reconstruction of a discrete object, such as sphere, is a pertinent problem in 3D imaging and allied areas. In this paper, we derive and analyze some of the local topological properties of discrete sphere that provide some insights about its composition and can be used for related applications such as spherical surface reconstruction.

At this point, it is worth mentioning that among the different models of discrete sphere, the naive sphere contains the minimum number of voxels ensuring the separability of its interior and exterior. Hence, it is a subset of any other valid model of discrete sphere [5]. Further, in topological terms, it is 2-minimal and marked by its readiness to decomposition in separate parts based on functional plane [6]. These unique points of naive sphere make us choose it as our model of study.

We first analyze the basic properties of a naive spherical surface. From these basic properties, we derive its other local topological properties. Since a naive sphere is 48-symmetric and each of its quadraginta octants (q-octants, in short) has a unique functional plane [5, 6], we use, w.l.o.g., the projection of its 1st q-octant on its functional plane (i.e., xy-plane). We call this projection as f-map and analyze it for studying the topology in \(3\times 3\) neighborhood.

Figure 1 shows an input f-map and the reconstructed f-map by our algorithm along with the corresponding naive spherical surface in 3D. In the result, each yellow voxel definitely belongs to the naive sphere and hence called a definite voxel. Each blue voxel, on the other hand, is a semi-definite voxel, as itself or its 2-adjacent voxel with a higher z-value belongs to the naive sphere. In this example, there are 41 voxels in the initial set (taken randomly from a naive sphere of radius 30). Our algorithm is able to reconstruct 57 definite and 54 semi-definite voxels for this surface. In practice, especially when the input voxel set is not sparse, our algorithm runs in a time linear in the area of the reconstructed surface. This is one of its strong points in comparison with other reconstruction algorithms that are mostly based on Hough transform.

Fig. 1.
figure 1

A snapshot of our work. (a) A small input instance of an incomplete f-map, M. (b) Representation of M in \({\mathbb {Z}}^3\). (c) Reconstructed f-map based on topological properties. (d) Representation of the reconstructed f-map in \({\mathbb {Z}}^3\).

2 Preliminaries

In this section, we explain some fundamental concepts, and fix some basic notions, notations, and definitions to be used in the sequel. For more details, we refer to [17].

For two (real or integer) points p(ijk) and \(p'(i',j',k')\), we define the distance between them along each coordinate axis. For the coordinate \(w\in \{\)x’,‘y’,‘z\(\}\), it is given by

These inter-point distances, in turn, define the respective x-, y-, and z-distances between a point p(ijk) and a (real) surface \(\varGamma \) as follows.

$$\begin{aligned} d_w(p,\varGamma )=\left\{ \begin{array}{@{}ll} \min \{d_w(p,p'): p' \in \varGamma _w(p)\} &{}\ \text{ if }\ \varGamma _w(p) \ne \emptyset \\ \infty &{}\ \text{ otherwise }\end{array} \right. \end{aligned}$$

where, \(\varGamma _w(p) = \{p' \in \varGamma : d_v(p,p') = 0 \; \forall v \in \{\)x’,‘y’,‘z\(\} \backslash \{w\}\}\).

The above definitions are used to define the isothetic distance between two points, or between a point and a surface. Between two points p(ijk) and \(p'(i',j',k')\), isothetic distance is taken as the Minkowski norm [17], given by

$$\begin{aligned} d_\infty (p,p') = \max \{d_x(p,p'), d_y(p,p'), d_z(p,p')\}. \end{aligned}$$

Between a point p(ijk) and a surface \(\varGamma \), it is defined as

$$\begin{aligned} d_{\perp }(p,\varGamma ) = \min \{d_x(p,\varGamma ),d_y(p,\varGamma ),d_z(p,\varGamma )\}. \end{aligned}$$
Fig. 2.
figure 2

A voxel as 3-cell, and its adjacency.

Next, we define some terms related to voxels and their adjacency. A voxel is an integer point in 3D space, and equivalently, a 3-cell [17]. Two distinct voxels are said to be 0-adjacent if they share a vertex (0-cell), 1-adjacent if they share an edge (1-cell), and 2-adjacent if they share a face (2-cell). Figure 2 shows an illustration. Note that 0-adjacent (resp., 1-adjacent) voxels are not considered as adjacent while considering 1-neighborhood (resp., 2-neighborhood) connectivity. Thus, for \(l\in \{0,1,2\}\), two voxels p(ijk) and \(p'(i',j',k')\) are l-adjacent if \(d_\infty (p,p') = 1\) and \(d_x(p,p')+d_y(p,p')+d_z(p,p') \leqslant 3-l\). In Fig. 3(a), a single voxel is marked in blue, its 2-neighbors are marked in green, 1-neighbors in yellow, and 0-neighbors in saffron. Note that the 0-, 1-, and 2-neighborhood notations, as adopted by us as well as by the authors in [26], correspond respectively to the classical 26-, 18-, and 6-neighborhood notations used in [12].

For \(l\in \{0,1,2\}\), an l-path in a 3D discrete object A (or the discrete space \({\mathbb {Z}}^3\)) is a sequence of voxels from A such that every two consecutive voxels are l-adjacent. The object A is said to be l-connected if there is an l-path connecting any two points of A. An l-component is a maximal l-connected subset of A.

Let B be a subset of a discrete object A. If \(A\backslash B\) is not l-connected, then B is l-separating in A [12]. If such an l-separating set B contains a 3-cell c such that both \(A\backslash B\) and \(A\backslash (B\backslash \{c\})\) are individually l-separating in A, then c is said to be l-simple in B w.r.t. A; otherwise, B is l-minimal in A. If a subset B of A is not l-separating in A, then B has l-gaps. 2-gaps, in particular, are called tunnels [7]. Figure 3(b) shows how a tunnel is formed in a 2-minimal surface when any of its voxels is removed.

3 Naive Sphere and Its Topological Properties

There are several models of discrete sphere and hypersphere, which are built with different topological constraints; see, for example, [14, 26], and the references therein. Our work is focused on the naive model of discrete sphere [2]. A naive sphere \(S(r)\) is a 2-minimal set of 3D integer points (equivalently, voxels) such that \(\max \{d_{\perp }(p,{\mathsf {S}}(r)):p\in S(r)\}\) is minimized. Here \({\mathsf {S}}(r)\) denotes a real sphere of radius r, considered as a positive integer in our work. Also, its center is an integer point, which is taken as (0, 0, 0) for simplicity and without loss of generality.

A detailed number-theoretic analysis of naive sphere with integer specification and an integer algorithm for its generation can be found in [4]. As shown in [3, 4],

$$\begin{aligned} S(r)= \left\{ \begin{array}{@{}l@{\ }l@{}} p\in {\mathbb {Z}}^3: &{} r^2 - \max (X)\leqslant s < r^2 + \max (X)\\ &{} \wedge \left( \left( s\ne r^2+\max (X)-1\right) \vee \left( \mathrm {mid}(X)\ne \max (X)\right) \right) \end{array}\right\} \!\! \end{aligned}$$

where \(p = (i,j,k), s = i^2 + j^2 + k^2,\) and \(X = \{|i|,|j|,|k|\}\).

Fig. 3.
figure 3

(a) A naive sphere of radius 15. All voxels are shown in white except p (blue) and its adjacent voxels (green = 2-adjacent, yellow = 1-adjacent, saffron = 0-adjacent). (b) A tunnel formed when any voxel is withdrawn from the naive sphere. (c) 16 q-octants (8 in front, 8 in back) whose functional plane is the xy-plane. (Color figure online)

In this section, we put forward some interesting properties characterizing the local neighborhood of a voxel in a naive sphere. First, we explain some basic properties and then we derive some additional properties from the basic ones. These properties are later used for efficient reconstruction of a sparse or noisy voxel set generated from a naive spherical surface.

3.1 Basic Properties

As already mentioned, \(S(r)\) is a 2-minimal surface that best-approximates \({\mathsf {S}}(r)\). It does not contain any tunnel, but contains 0- and 1-gaps. A naive sphere is made up of 48 basic symmetric parts called quadraginta octants, or q-octants in short [4]. Figure 4(a) shows the first q-octant of \(S(r)\) with radius 30.

Given a discrete object \(A \subseteq {\mathbb {Z}}^3\), we say that a coordinate plane, say, xy, is functional for A, if for every voxel \(v=(i,j,k) \in A\) there is no other voxel in A with the same first two coordinates. For a plane in general orientation, the functional plane (FP) is unique, and it is one of the coordinate planes. For a sphere, on the contrary, it is not so; rather, for each q-octant, the concept is analogous with plane. To explain this, we denote by \(S^{t}(r)\) the tth q-octant of \(S(r)\), where \(t=1,2,\ldots ,48\). A characterization of the q-octants of \(S(r)\) can be found in [4]. The functional plane of \(S^{t}(r)\) is the coordinate plane on which its projection has a bijection with \(S^{t}(r)\).

Each coordinate plane serves as the FP of 16 specific q-octants. Figure 3(c) shows the voxels of q-octants whose FP is the xy-plane. For a detailed analysis on FPs of discrete sphere, we refer to [6].

Fig. 4.
figure 4

(a) \(S^{1}(r)\) and (b) \(F^{1}(r)\) for \(r=30\). Note that each segment in \(F^{1}(r)\) with constant f-value is a discrete annulus (shown in white or yellow). (Color figure online)

We define f-map as the projection of a q-octant on its FP. Since the projection is bijective for naive sphere, the f-map, at each pixel position, holds the maximum coordinate value of the corresponding voxel. From now on, we refer to this maximum coordinate as f-coordinate. Figure 4(b) shows an example of the f-map of \(S^{1}(r)\). As xy-plane is the FP of \(S^{1}(r)\), each position of its f-map contains the z-value of the corresponding voxel. The voxels with same z-value form discrete annuli and are shown in alternate colors. We denote the f-map of \(S^{1}(r)\) by \(F^{1}(r)\).

We start with the following theorems on two basic properties of the voxels in the 1st q-octant, which can be generalized for all other octants as well.

Theorem 1

Unit increment (decrement) in x- or y-value in \(F^{1}(r)\) results in at most unit decrement (increment) in z-value.

Proof

By [4, Theorem 4], the ith circular arc (voxels with \(x=i\)) in \(S^{1}(r)\) forms a 1-connected monotone path with increasing y-value and non-increasing z-value. This ensures the connectivity of each arc corresponding to a column in \(F^{1}(r)\). Similarly, as the naive surface is 2-separating, for a fixed y-value, unit increment in x-value results in at most unit decrement in z-value.    \(\square \)

Theorem 2

Unit increment (decrement) in x-value and unit decrement (increment) in y-value in \(F^{1}(r)\) results in at most unit increment (decrement) in z-value.

Proof

The z-coordinate induces discrete annuli in \(S^{1}(r)\) (see Fig. 4). The upper and the lower boundaries of the projection of each such annulus in \(F^{1}(r)\) are monotone paths, with increasing x-value and non-increasing y-value from left to right. This owes to the fact that in \(S^{1}(r)\), the x-value at a point does not exceed the y-value. So, a unit increment (decrement) in x-value and a unit decrement (increment) in y-value in \(F^{1}(r)\) points to either the same or the next annulus, whence the result.    \(\square \)

Fig. 5.
figure 5

\(3 \times 3\) neighborhood of a pixel p in \(F^{1}(r)\). (a) Direction codes w.r.t. p. (b–d) Examples from \(F^{1}(r)\) of Fig. 4(b).

3.2 Derived Properties

We explain here some local properties in \(3 \times 3\) neighborhood of \(F^{1}(r)\), which are proved using the basic properties stated in Theorems 1 and 2. For ease of understanding, for a pixel p in \(F^{1}(r)\), we refer to its \(3 \times 3\) neighborhood using direction codes, as shown in Fig. 5(a). We refer to the z-value of pixel p in \(F^{1}(r)\) as f(p), and that of some in the neighborhood of p by \(f(p+{\mathsf d}_\alpha )\), where \(\alpha \) is the direction. For example, in Fig. 5(b), \(f(p)=30\), \(f(p+{\mathsf d}_0)=29\), \(f(p+{\mathsf d}_5)=30\). The set of points in \(3 \times 3\) neighborhood of p and contained in \(F^{1}(r)\) is given by \(N(p) = \{p\} \cup \{p + d_\alpha : \left( p + d_\alpha \in F^{1}(r)\right) \wedge \left( \alpha = 0,1,\ldots ,7\right) \}\). We denote by f(N(p)) the set of f-values of N(p). With these basic notations, we now introduce the properties that are true in the \(3 \times 3\) neighborhood of every point p in the f-map of \(S^{1}(r)\) and can be generalized for any other q-octant of \(S(r)\).

Theorem 3

If \((p+{\mathsf d}_5)\in N(p)\), then \(f(p+{\mathsf d}_5) = \max \{f(N(p))\}\); and if \((p+{\mathsf d}_1)\in N(p)\), then \(f(p+{\mathsf d}_1) = \min \{f(N(p))\}\).

Proof

Observe that \(p+{\mathsf d}_5\) has the lowest x- and y-values, and \(p+{\mathsf d}_1\) has the highest x- and y-values. By Theorem 1, increase in x- or y-value decreases the z-value in \(S^{1}(r)\). Therefore, z-value is maximum for \(p+{\mathsf d}_5\), and minimum for \(p+{\mathsf d}_1\), whence the proof.    \(\square \)

Notice that all three examples in Fig. 5 conform to the above theorem.

Theorem 4

\(\min \{f(N(p))\} \geqslant f(p)-2\) and \(\max \{f(N(p))\} \leqslant f(p)+2\).

Proof

By Theorem 1, the maximum change of z-value occurs in a diagonal direction and it can be 2. So, if we move diagonally from p, then \(f(p+{\mathsf d}_1)\) can be as low as \(f(p)-2\), and \(f(p+{\mathsf d}_5)\) can be as high as \(f(p)+2\).    \(\square \)

For example, in Fig. 5(d), \(\min \{f(N(p))\} = f(p)-2\) at \(p+{\mathsf d}_1\). Note that the above theorem indicates the occurrence of jump that arises in naive planes [8] as well as in naive spheres, as shown recently in [6]. A jump is formed when two voxels are not adjacent on the naive surface but their projections are two 0-adjacent pixels on the functional plane.

Theorem 5

If \(\max \{f(N(p))\} - \min \{f(N(p))\} = 3\), then \(f(p) \in \big \{ \min \{f(N(p))\}+1, \max \{f(N(p))\}-1 \big \}\).

Proof

By Theorem 3, \(f(p+{\mathsf d}_5) = \max \{f(N(p))\}\) and \(f(p+{\mathsf d}_1) = \min \{f(N(p))\}\). By Theorem 4, diagonal z-value change is no more than 2. So, with \(\max \{f(N(p))\} - \min \{f(N(p))\} = 3\), we get \(f(p) = \min \{f(N(p))\}+1\) or \(\max \{f(N(p))\}-1\).    \(\square \)

The following theorems can be used to get f(p) when a partial information is available in N(p).

Theorem 6

For \(0\leqslant \alpha \leqslant 3\) and \(4\leqslant \beta \leqslant 7\), if \(f(p+{\mathsf d}_\alpha )= f(p+{\mathsf d}_\beta )\), then each of these two is equal to f(p).

Proof

From Theorems 1, 2, and 4, it can be inferred that the f-value never increases from p at directions 0, 1, 2, and 3, and never decreases at directions 4, 5, 6, and 7. Therefore, if \(f(p+{\mathsf d}_\alpha )= f(p+{\mathsf d}_\beta )\), where \(0\leqslant \alpha \leqslant 3\) and \(4\leqslant \beta \leqslant 7\), then p also holds the same f-value.    \(\square \)

Theorem 7

If \(f(p+{\mathsf d}_\alpha )=c_1\), \(f(p+{\mathsf d}_\beta ) = c_2\), and \(|c_1-c_2| = 2\), where \(\alpha \in \{0,2,3\}\) and \(\beta \in \{4,6,7\}\), then \(f(p) = \frac{1}{2}(c_1+c_2)\).

Proof

From Theorems 1 and 2, we can infer that from p at directions 0, 2, and 3, the f-value remains same or decrements by one, and at directions 4, 6, and 7, the f-value remains same or increments by one. Therefore, if the difference between \(f(p+{\mathsf d}_\alpha )\) and \(f(p+{\mathsf d}_\beta )\) is two, then f(p) has to lie exactly between these two values.    \(\square \)

Theorem 8

If \(f(p+{\mathsf d}_\alpha )=c_1\), \(f(p+{\mathsf d}_\beta ) = c_2\), and \(|c_1-c_2| = 1\), where \(\alpha ,\beta \in \{0,2,3\}\), then \(f(p) = \max (c_1,c_2)\); or where \(\alpha ,\beta \in \{4,6,7\}\), then \(f(p) = \min (c_1,c_2)\).

Proof

From Theorems 1 and 2, we can infer that from p at directions 0, 2, and 3, the f-value remains same or decrements by one, and at directions 4, 6, and 7, the f-value remains same or increments by one. Therefore, if \(\alpha ,\beta \in \{0,2,3\}\) or \(\alpha ,\beta \in \{4,6,7\}\), i.e., both are either towards non-incrementing or towards non-decrementing directions, and if the difference between \(f(p+{\mathsf d}_\alpha )\) and \(f(p+{\mathsf d}_\beta )\) is unity, then f(p) has to be the maximum of these two values for the non-incrementing direction (\(\alpha ,\beta \in \{0,2,3\}\)) and the minimum of these two values for the non-decrementing direction (\(\alpha ,\beta \in \{4,6,7\}\)).    \(\square \)

Fig. 6.
figure 6

Demonstration of our algorithm. (a) An input instance containing 145 voxels taken from a naive spherical surface. (b) Reconstructed surface after 1st iteration. (c) Reconstructed surface after 2nd iteration. (d) Reconstructed surface after 3rd iteration. (e) Reconstructed surface after last, i.e., 6th iteration. (f) Reconstructed surface after inclusion of semi-definite voxels.

4 Reconstruction

In this section, we show how the local topological properties of a naive sphere can be used to reconstruct its surface when holes or noise are present in input data. The input to the algorithm is a set of integer points/voxels belonging to the first q-octant of a naive spherical surface. We have also assumed that N(p) always consists of 9 points, i.e., the points in the input set are all taken from the interior of the q-octant and not from its border. This assumption helps us to also generate semi-definite voxels around the final definite point set of the reconstructed naive set.

Note that, while generating the definite voxels to fill the gaps appearing in the input surface, only Theorems 6 to 8 are used, as these are the only ones which can definitely predict f(p). Few of the other properties are used to predict the semi-definite voxels after generation of the final definite result set, and can also be used to detect noisy voxels in the input set. The steps of the reconstruction algorithm are as follows.

  1. 1.

    Generate the f-map of the input by taking projection on the functional plane.

  2. 2.

    Scan the f-map row-wise (or column-wise) to detect pixels with undefined f(p), i.e., holes.

  3. 3.

    For each detected hole p, check whether any appropriate pair fits to Theorems 6 to 8, and get the exact value of f(p) as per that theorem.

  4. 4.

    Repeat steps 2 and 3 as long as new holes are filled.

  5. 5.

    Produce a one-pixel empty boundary to the final f-map.

  6. 6.

    Scan the f-map; for any empty location, select the lowest z-value if there are two possible values for f(p).

    Note that existence of any one of the voxels at directions 0, 2, 3, 4, 6, and 7 ensures that we can get two possible values for f(p). So, every semi-definite voxel included in this step has a 50 % chance of actually belonging to the naive spherical surface.

Fig. 7.
figure 7

Applying the local topological properties to detect and restore noisy voxels. (a) An input instance containing noisy voxels in a naive spherical surface. (b) After removal of noise. (c) Reconstruction with defined and semi-definite voxels.

Each iteration of this algorithm scans through the entire f-map to detect empty locations, i.e., it scans through total \((n+m)\) number of points, where n is the number of points in the input set, and m is the number of empty locations in the f-map. Inclusion of definite voxels at each stage helps to predict the values for undefined voxels in the next stage; and in the worst case, the holes may be interconnected in such a way that each iteration is able to produce only one definite voxel. Therefore, the number of iterations depends on the configuration, size, and shape of the hole regions. The time complexity of the algorithm therefore varies from \(O(n+m)\) in the best case to \(O((n+m)m)\) in the worst case. However, as we have experimented, the number of iterations in practice is low and the algorithm stops after a small number of iterations, thus practically giving us a linear time complexity when m is in the order of n / 2 or less.

In the above-stated experimentation, we have assumed that the input set of points belongs to a particular q-octant and all definitely belong to a naive sphere whose radius and center are not known. As the properties stated in the previous section can easily be generalized to work for other q-octants as well, a set of points from different q-octants of a naive sphere can be partitioned by their corresponding functional planes. This can be done by analyzing the projections on the three coordinate planes. After partitioning by functional planes, each part can be used for reconstruction based on the local topological properties and their corresponding f-maps.

We have run the algorithm for multiple input instances and found encouraging results. Figure 6 shows us how the algorithm reconstructs the input surface step by step. In this example, the input surface contains 145 voxels, all of which belongs to a particular naive sphere. After six iterations, our algorithm is able to reconstruct the surface as in Fig. 6(f), which contains 269 definite voxels and 115 semi-definite voxels. Another result shown in Fig. 7 presents how the local topological properties can effectively be used to discard noisy voxels and restore the correct ones to reconstruct a naive spherical surface.

5 Concluding Remarks

We have studied various local properties of naive sphere and have demonstrated a method to utilize these properties for reconstruction of a naive spherical surface containing missing voxels. One point to note is that these properties are not supposed to work while the input data is very sparse and we are not able to find any local neighbors of the holes. In that case, some different methodologies like Hough transform can be employed. Nevertheless, local topological properties in larger neighborhoods may yield better scope for reconstruction, which we foresee interesting and challenging in continuation of the proposed work. Further, these local properties of naive sphere, as stated in this paper, may also be compared with local properties of other naive discrete surfaces, e.g., naive plane, for analyzing how they differ across different parameters.