How to Maximize the Contact Perimeter and Contact Area of Shapes Composed of Cells in the Discrete Domain

The contact perimeter of a shape composed of pixels is the number of joints between neighboring pixels of the shape, and the contact area of a shape composed of voxels (three dimensional cells) is the number of planar joints between neighboring voxels. In this paper, we present the maximal contact perimeter function for shapes composed of pixels, and the maximal contact area function for voxel-based shapes. Also, we see how each one of these functions induce the definition of the corresponding standard function that extends the concept of contact perimeter (area) to non discrete squares (cubes), and which is used in the definition of the normalized discrete compactness. Corresponding author 738 Carlos Velarde and Ernesto Bribiesca Mathematics Subject Classification: 65D17


Introduction
A fundamental property of a 2D (two-dimensional) region is its perimeter.According to W. Karush [12] "The perimeter of a closed curve is its length; the perimeter of a two-dimensional region is the length of its boundary (or, sometimes, the boundary itself).The perimeter of a circle is called its circumference".Here we will be dealing with 2D shapes composed of pixels and 3D (three-dimensional) objects composed of voxels, respectively.Furthermore, we will consider the concepts of contact perimeter and contact area.The former [6], corresponds to the sum of the boundaries of neighboring pixels of a given shape, whereas the latter corresponds to the sum of the contact areas of neighboring voxels of a given object.
The relation between the contact perimeter and the perimeter of a shape is given by the following equation: where P c is the contact perimeter, P is the perimeter of the shape, and n is the number of pixels of the shape.The contact perimeter corresponds to a measure of compactness called discrete compactness [6].In this case, the term does not refer to point-set topology, but is related to intrinsic properties of objects.In order to normalize the measure of compactness, the maximum contact perimeter has already been computed and the equation of the normalized discrete compactness, C d , has been defined as follows [6,7,8]: The equations of the contact perimeter and the normalized discrete compactness have been used by several authors in different and interesting applications in the 2D domain, for example, Bogaert et al. [3] presented alternative area-perimeter ratios for measurement of 2D shape compactness of habitats.They stated that the discrete compactness of a shape is of main importance to evaluate the effect of external disturbance on natural habitats.In engineering geology, Lee et al. [14] described a system for the acquisition and analysis of 3D data from the surfaces of coarse aggregate particles, where the form and compactness play an important role for the quantification of angularity.
In ecological modelling, Sadler et al. [16] described how to derive state-andtransition models from an image series, where they expressed compactness as an image metric.In applied mathematics, Bogaert et al. [4] proposed a method to reduce resolution to a minimum using spatial aggregation without information loss.Using the equation of the contact perimeter among others, they proved that perimeter measures and fractal dimension are shown not to be invariant to spatial aggregation.Bribiesca [9] presented the computation of the Euler number using the contact perimeter of unit-width objects composed of different size-connected cells.The Euler number is a topological property and is defined as the number of connected regions minus the number of holes.In order to compute the number of holes of a unit-width object composed of side-connected pixels, it is common to use the Euler's well-known equation.This equation uses three variables: the number of faces, the number of edges, and the number of vertices.However, via the equation of the contact perimeter it is possible to use only two variables (the perimeter and the contact perimeter) for computing the number of holes of the above-mentioned objects.
In the 3D domain, the equations of the contact area and the discrete compactness were defined in refs.[7,8].Thus, the area A of the enclosing surface of a rigid solid composed of a finite number n of voxels, corresponds to the sum of the areas of the external plane polygons of the voxels which form the visible faces of the solid.The contact surface area A c of the above-mentioned solid corresponds to the sum of the areas of the contact surfaces which are common to two voxels.The relation between the area of the enclosing surface and the contact surface area of a voxel-based object composed of n voxels is given for the following equation: In order to normalize the measure of compactness in the 3D domain, the maximum contact area was defined and the equation of the normalized discrete compactness C d was defined as follows: Some authors have been using the equations of the contact surface area and the discrete compactness for 3D objects; for example, Braumann et al. [5] described the quantification of cervical carcinoma invasion fronts in 3D.For the invasion quantification they referred to discrete compactness, which is considered to be in tight correspondence with invasion features.Elliot et al. [11] investigated the use of a 3D soil pore characteristics (volume (V ), surface area (S), and tortuosity) for prediction of saturated hydraulic conductivity.They used the equation of the discrete compactness to establish a relationship between the S V ratio and the radius contributing to hydraulic conductivity.Einenkel et al. [10] studied the evaluation of the invasion front pattern of squamous cell cervical carcinoma by measuring classical and discrete compactness.They concluded that "... discrete compactness is a useful and reproducible parameter for a computer assisted assessment of the invasion front pattern of squamous cell carcinoma of the uterine cervix, which allows a metric quantification.Compactness correlates with the invasion in lymph vessels and the parametrium and, thus, defines the motile phenotype".Barnes et al. [2] presented a semiautomated detection of cerebral microbleeds in magnetic resonance images.They expressed that cerebral microbleeds have a very high compactness and veins have a very low compactness.Yang et al. [18] detected whole breast lesions using a naive Bayes classifier for portable ultrasound.In order to reduce the false positive rate via two phase lesion selection criterion, they included the area size, width-height ratio, region ratio, and the discrete compactness for 2D shape feature criteria.Lai et al. [13] presented a computer-aided diagnosis for 3D power doppler breast ultrasound.They proposed that shape features consisted of two parts, the margin and the compactness of the volume structure.They used the discrete compactness definition of 3D objects and the relationship between surface area and volume of tumors.An interesting correlation between 3D tumor shape and the classification of benign and malignant tumors was presented by Moon et al. [15]: In general, benign tumors have a regular shape (close to sphericity), and malignant tumors have a more irregular shape.Thus, they used an ellipsoid to fit the tumor.In this case, discrete compactness of shapes played an important role.
It is important to note that the divisor on the right hand side of the equations of the discrete compactness for 2D and 3D objects belongs to the continuous domain.Now, in the content of this paper we present how to maximize the contact perimeter and contact area of shapes composed of cells in the discrete domain.
This paper is organized as follows.In Section 2 we present the maximal contact perimeter function of 2D discrete shapes.Section 3 describes the maximal contact area function of 3D discrete shapes.Finally, in Section 4 we present some conclusions.

The maximal contact perimeter function of discrete shapes
The 2D shapes we consider here, composed of a finite number of edge-connected unit squares on a grid like Z 2 , have been named polyominoes in the literature [17].First we present a function pc : N → N such that, for each n ∈ N, it gives the maximal contact perimeter attained among the polyominoes of area n.Afterwards, we obtain an alternative way to compute pc (n) through the evaluation of a continuous function related to the discrete compactness.We rely on results presented in [1] and borrow some notation used therein.Two polyominoes are considered equal if one is a translation of the other.Let C n be the set of polyominoes of area n ∈ N, and M n be the subset of elements in C n of minimal perimeter; in [1, Corollary 2.5] there appears a formula to calculate this perimeter, followed by the definition of a canonical polyomino in M n , which we denote here by s n .Let us describe the sequence of canonical polyominoes (see Fig. 1).For each n ∈ N, s n ⊂ s n+1 .If n is a perfect square, say n = m 2 , then s n is the square of side m.Otherwise, n falls between two squares, say m 2 and (m + 1) 2 , in such case two possibilities can happen: If m 2 < n ≤ m 2 + m, then s n is a square of side m glued to its right with an 1 × (n − m 2 ) rectangle, with aligned bases; the second possibility is m 2 + m < n ≤ m 2 + 2m, then s n is an (m + 1) × m rectangle glued to its top with an n − (m 2 + m) × 1 rectangle, with aligned left sides.
Figure 1: An initial segment of a sequence of maximal contact perimeter discrete shapes composed of unit squares.For each n ∈ N, s n has area n and s n ⊂ s n+1 .For each m ∈ N, s m 2 is the square of side m, s m 2 +m is the (m+1)×m rectangle, s m 2 +1 , . . ., s m 2 +m all have perimeter 4m+2, and s m 2 +m+1 , . . ., s (m+1) 2 all have perimeter 4m + 4.

Remark 1
The function p : N → N of minimal perimeter can be recovered from the sequence s n as follows.
1.For each m ∈ N, the elements s n , such that m 2 < n ≤ m 2 + m, all have the same perimeter, p(n) = 4m + 2. (This is the perimeter of the last element in the list, the (m + 1) × m rectangle.) 2. For each m ∈ N, the elements s n , such that m 2 + m < n ≤ (m + 1) 2 , all have the same perimeter, p(n) = 4m + 4. (This is the perimeter of the last element in the list, the square of side (m + 1).) 3. The only missing case is n = 0, for which p(0) = 0.
4. From the two previous remarks we can put together the squares: For each Now, from equation ( 1), P c = (4n − P )/2, then the function pc : N → N of maximal contact perimeter is related to p by from which, using Remark 1, we obtain (3) The first alternative in this equation can be written in the form which is naturally extended to the function f : R ≥0 → R, such that Note that if n is not a perfect square, then f (n) is not an integer.(See Fig. 2.) Nevertheless, the whole part of f (n) coincides with pc (n), as we prove next.
Proof 1 We proceed by cases corresponding to the three alternatives in equation (3).In the first case, by equations ( 5) and (4), f (n) = pc (n).Then f (n) is a whole number and the goal equation holds.
In the second case, combining the hypothesis m 2 < n ≤ m 2 + m with the obvious inequality m 2 + m < (m + 1  2 ) 2 , it follows that From this equality and the fact that ⌊z In the third case, from the hypothesis m 2 + m < n < (m + 1) 2 , observing that the first inequality is equivalent to m 2 + m + 1 ≤ n, and using the fact that (m + 1 2 ) 2 < m 2 + m + 1, we obtain The function f also serves to extend the concept of contact perimeter to non discrete squares, as follows.For each x ∈ R ≥0 , let A = x be the area of a square and let P be the corresponding perimeter, then we have f (x) = 2(x − √ x) = (4A − P )/2.If this last value is an integer, we know that it is the contact perimeter of a discrete square, otherwise, we take it as the definition of the contact perimeter for the given non discrete square.Now, remembering from the differential calculus that the square is the rectangle of minimal perimeter among the rectangles of area A, it follows that the square has maximal contact perimeter amid such rectangles.This, reinforced by Theorem 1, leads us to take the square as the standard of maximal contact perimeter, regardless of whether the square is discrete or not.This is the reason behind the definition of the normalized discrete compactness as a quotient to compare the contact perimeter of a shape of area n an perimeter p versus the contact perimeter of the square of the same area, that is, ((4n − p)/2)/f (n) = (n − p/4)/(n − √ n). Figure 3 shows this measure for some of the shapes s n .

The maximal contact area function of discrete shapes
In this section we treat the case of the 3D shapes composed of a finite number of face connected unit cubes on the grid Z 3 .As in the 2D case, these shapes are known as polyominoes.We present the function âc : N → N such that âc (n) is the maximum contact surface area achieved among the polyominoes of volume n.Then we see that the continuous function obtained as a natural extension of âc does not fit it as good as f fits pc in the 2D case.Nevertheless, we lastly present a piecewise function h : R ≥1 → R that does in fact fit âc right.
A formula for the minimal surface area attained among the polyominoes of volume n, together with a corresponding canonical polyomino with such an area, can be found in [1].Fig. 4 shows an initial segment of the sequence {v n } n∈N of canonical polyominoes.Figure 4: An initial segment of a sequence of maximal contact area discrete shapes composed of unit cubes.For each n ∈ N, v n has volume n and v n ⊂ v n+1 .For each m ∈ N, v m 3 is the cube of side m, v m 3 +m 2 is the (m+ 1) ×m×m box, and v m 3 +2m 2 +m is the (m + 1) × (m + 1) × m box.
The sequence satisfies v n ⊂ v n+1 for each n, and contains all the cubes.If n is not a cube we consider three possibilities: 1) If m 3 < n ≤ m 3 + m 2 (see v 9 to v 12 in Fig. 4.), then v n is the cube of side m glued to its front face with the (slice) polyomino of volume d = n − m 3 whose unit cubes are arranged like the unit squares of the 2D polyomino s d , with aligned bottom left edges.Observe that the last polyomino of the list is the (m + 1) × m × m box (i.e. rectangular parallelepiped).2) If m 3 + m 2 < n ≤ m 3 + 2m 2 + m (see v 13 to v 18 ), then v n is the aforementioned box, glued to its right face with the slice polyomino corresponding to s n−(m 3 +m 2 ) , with aligned rear bottom edges.At the end we have the (m + 1) , then v n is this last box, glued to its upper face with the slice polyomino corresponding to s n−(m 3 +2m 2 +m) , with aligned rear left edges.
2. The contact area of the slice polyomino corresponding to the 2D polyomino s d is numerically equal to pc (d).
Putting it together, we obtain the next formula for âc : In each of the last three alternatives, the first summand is the contact area of a corresponding box (see Remark 2.1), the term pc (d) is the contact area of the slice polyomino that is joined to such a box (see Remark 2.2), and the summand d is due to the joint of the box and the slice polyomino.
From the first and second alternatives we obtain, for each m ∈ N, which we extend to the function g : R ≥0 → R, such that But now, in contrast to Theorem 1, equation âc (n) = ⌊g(n)⌋ does not hold in general, since, for example, âc (5) = 5 = 6 = ⌊g(5)⌋ (see Fig. 5).Nonetheless, the equation is valid for each n such that s n is a box (see Remark 2.1), as we prove next.
Lastly, we exploit Theorem 1 and the appearance of pc in equation ( 6) to construct a function h : R ≥1 → R that satisfies âc (n) = ⌊h(n)⌋ for each n > 0. If we throw away the first alternative of equation ( 6) and in the remaining part pc is replaced by f , and n by x, the following definition is obtained: where m = ⌊ 3 √ x⌋.

Remark 3
1.For each m ∈ N + , the piecewise function h is discontinuous only in m 3 + 2m 2 + m, since the left limit of h in that point is equal to 3m 3 − 2m+f (m 2 +m)+m 2 +m, which is not an integer, while the corresponding right limit, 3m 3 + 3m 2 − m − 1 + f (0), is a whole number.
2. With the same technique as used in the proof of Lemma 2, it can be shown that the aforementioned left limit is bounded above by g, that is, Thus, by Lemma 2 it follows that h is bounded above by g.See Fig. 5.The function g plays a similar role for 3D shapes as f did for 2D shapes, it is an upper bound of âc and extends the notion of contact area, to be applied to cubes whose side is not an integer.Also, since the cube is the box of minimal surface area among the boxes of equal volume, it is taken as the standard of maximal contact area, including the case of non discrete cubes.The discrete compactness of a 3D shape of volume n is defined as the quotient of the contact area of such a shape and g(n).Figure 6 shows the discrete compactness obtained for some shapes v n .

Conclusions
We have presented the maximal contact perimeter function for shapes composed of pixels, and the maximal contact area function for voxel-based shapes.These functions extend the concepts of contact perimeter and area, which are used in the definition of the normalized discrete compactness.

Figure 2 :
Figure 2: The function pc : N → N of maximal contact perimeter for discrete shapes, and the continuous function f : R ≥0 → R, that extends the concept of contact perimeter to each square of area x ≥ 0.

Figure 5 :
Figure 5: The function âc : N → N of maximal contact area for discrete shapes, the continuous function g R ≥0 → R that extends the concept of contact area to each cube of volume x ≥ 0, and the function h : R ≥1 → R that is bounded above by g and satisfies âc (n) = ⌊h(n)⌋ <= ⌊g(n)⌋ for each n ∈ N + .