`Journal of Applied MathematicsVolumeÂ 2011, Article IDÂ 937263, 29 pageshttp://dx.doi.org/10.1155/2011/937263`
Research Article

## Efficient Boundary Extraction from Orthogonal Pseudo-Polytopes: An Approach Based on the D-EVM

Computer Engineering Institute, The Technological University of the Mixteca (UTM), Carretera Huajuapan-Acatlima Km. 2.5, Huajuapan de LeĂłn, 69000 Oaxaca, Mexico

Received 9 December 2010; Accepted 9 March 2011

#### Abstract

This work is devoted to contribute with two algorithms for performing, in an efficient way, connected components labeling and boundary extraction from orthogonal pseudo-polytopes. The proposals are specified in terms of the extreme vertices model in the -dimensional space (D-EVM). An overview of the model is presented, considering aspects such as its fundamentals and basic algorithms. The temporal efficiency of the two proposed algorithms is sustained in empirical way and by taking into account both lower dimensional cases (2D and 3D) and higher-dimensional cases (4D and 5D).

#### 1. Introduction

The extreme vertices model in the -dimensional space (D-EVM) is a representation scheme whose dominion is given by the -dimensional orthogonal pseudo-polytopes, that is, polytopes that can be seen as a finite union of iso-oriented D hyperboxes (e.g., hypercubes). The fundamental notions of the model, for representing 2D and 3D-OPPs, were originally established by Aguilera and Ayala in [1, 2]. Then, in [3], it was formally proved the model is capable of representing and manipulating D-OPPs. The D-EVM has a well-documented repertory of algorithms (see [1, 3â€“7]) for performing tasks such as Regularized Boolean operations, set membership classification, measure interrogations (content and boundary content), morphological operations (e.g., erosion and dilation), geometrical and topological interrogations (e.g., discrete compactness), among other algorithms currently being in development. Furthermore, conciseness, in terms of spatial complexity, is one the D-EVMâ€™s main properties, because the model only requires storing a subset of a polytopeâ€™s vertices, the extreme vertices, which finally provides efficient temporal complexity of our algorithms. Sections 2 and 3 are summaries of results originally presented in [1, 3]. For the sake of brevity, and because we aim for a self-contained paper, some propositions are only enunciated. Their corresponding proofs and more specific details can be found in [1, 3]. In Section 2, the main concepts and basic algorithms behind the D-EVM are described, while Section 3 presents an algorithm for extracting forward and backward differences of an D-OPP.

Section 4 presents the first main contribution of this work: An EVM-based algorithm for computing connected components labeling over an D-OPP. It is well known connected components labeling is one of the most important tools in image processing and computer vision. The main idea is to assign labels to the pixels in an image such that all pixels that belong to a same connected component have the same label [8]. As pointed out by [9], it is essential for the specification of efficient methods that identify and label connected components in order to process them separately for the appropriate analysis and/or operations. Several approaches have been proposed in order to achieve such labeling, and some of them are applicable in multidimensional contexts (e.g., see [10, 11]), but there is a step that is commonly present in the majority of the methodologies: the scanning step [12]. Such a step determines a label for the current processed pixel via the examination of those neighbor pixels with an assigned label. Suzuki et al. group the methods for connected components labeling in four categories [13].(i)Methods that require multiple passes over the data: the scanning step is repeated successively until each pixel has a definitive label.(ii)Two-pass methods: they scan the image once to assign temporal labels. A second pass has the objective of assigning the final labels. They make use of lookup lists or tables in order to model relationships between temporal and/or equivalent labels [9]. (iii)Methods that use equivalent representations of the data: their strategy is based on using a more suitable representation based on hierarchical tree structures (quadtrees, octrees, etc.) instead of the imageâ€™s raw data in order to speed up the labeling [10, 14]. (iv)Parallel algorithms.

In [7], RodrĂ­guez and Ayala describe an EVM-based algorithm for connected components labeling. It works specifically for 2D and 3D-OPPs. First, they obtain a particular partitioning from the 3D-EVM known as ordered union of disjoint boxes (OUODB), which is, in fact, a special kind of cell decomposition [7]. Then, once the OUODB partition has been achieved, it follows a process which is based in the two-pass approach. We take into account some ideas presented by RodrĂ­guez and Ayala, but our proposal deals with a higher-dimensional context, that is, with D-OPPs, and it works directly with their corresponding D-EVM representations.

Section 5 describes the second contribution of this work: a methodology for extracting D boundary elements from an D-OPP represented through the D-EVM. It is well known that a boundary model for a 3D solid object is a description of the faces, edges, and vertices that compose its boundary together with the information about the connectivity between those elements [15]. However, the boundary representations can be recursively applied not only to solids, surfaces, or segments but to -dimensional polytopes [16]. For Putnam and Subrahmanyan, a polytopeâ€™s boundary representation can be seen as a boundary tree [17]. In the tree, each node is split into a component for each element that it bounds. An element (vertex, edge, etc.) will be represented several times inside the tree, one for each boundary that it belongs to. See Figure 1 for a cubeâ€™s boundary tree.

Figure 1: The boundary tree associated to a 3D cube.

The way we extract D boundary elements from an D-OPP represented through the D-EVM will be reminiscent to the reconstruction of the boundary tree associated with such D-OPP. Moreover, our methodology is strongly sustained in the use of our proposed connected components labeling algorithm (Section 4) and the procedures described in Sections 2 and 3. Some study cases will be presented in order to appreciate the information our proposed procedure can share. Finally, in Section 6, we determine, in empirical way, the time complexity of the algorithm presented in Section 5 in order to provide evidence of its efficiency specifically when higher-dimensional D-OPPs are considered.

#### 2. The Extreme Vertices Model in the -Dimensional Space (D-EVM)

In Section 2.1, some conventions and preliminary background related directly with orthogonal polytopes will be introduced. In Section 2.2, the foundations of the D-EVM will be established. Section 2.3 presents some basic algorithms under the EVM.

##### 2.1. The -Dimensional Orthogonal Pseudo-Polytopes (D-OPPs)

The following definitions ((a) to (i)) belong to Spivak [18].(a)A singular -dimensional hyperbox in is given by the continuous function such that .(b)For all , , if , then the two singular D hyperboxes and are given by (c)A general singular -dimensional hyperbox in the closed set is defined as the continuous function .(d)Given a general singular D hyperbox the composition defines an -cell.(e)The orientation of an D cell is given by , while an D oriented cell is given by the scalar-function product .(f)A formal linear combination of singular general D hyperboxes, , for a closed set is called a -chain. (g)Given a singular D hyperbox , the -chain, called the boundary of , is defined as(h)For a singular general D hyperbox , we define the -chain, called the boundary of , by(i)The boundary of an -chain , where each is a singular general D hyperbox, is given by

Based on the above Spivakâ€™s definitions, we have the elements to establish our own precise notion of orthogonal polytope. A collection , of general singular D hyperboxes is a combination of D hyperboxes if and only if

The first part of the conjunction establishes that the intersection between all the D general singular hyperboxes is the origin, while the second part establishes that there are not overlapping D hyperboxes. Finally, we will say an -dimensional orthogonal pseudopolytope , or just an D-OPP , is an -chain composed by D hyperboxes arranged in such way that by selecting a vertex, in any of these hyperboxes, it describes a combination of D hyperboxes composed up to hyperboxes.

##### 2.2. D-EVMâ€™s Fundamentals

Let be a combination of hyperboxes in the -dimensional space. An odd adjacency edge of , or just an odd edge, will be an edge with an odd number of incident hyperboxes of . Conversely, if an edge has an even number of incident hyperboxes of , it will be called even adjacency edge or just an even edge. A brink or extended edge is the maximal uninterrupted segment, built out of a sequence of collinear and contiguous odd edges of an D-OPP. By definition, every odd edge belongs to brinks, whereas every brink consists of edges, , and contains vertices. Two of these vertices are at either extreme of the brink and the remaining are interior vertices. The ending vertices of all the brinks in will be called extreme vertices of an D-OPP and they are denoted as . Finally, we have that any extreme vertex of an D-OPP, , when is locally described by a set of surrounding D hyperboxes, has exactly incident linearly independent odd edges.

Let be an D-OPP. A D extended hypervolume of , , denoted by , is the maximal set of D cells of that lies in a D space, such that a D cell belongs to a D extended hypervolume if and only if belongs to an D cell present in , that is,

Given an D-OPP, we say the extreme vertices model of , denoted by , is defined as the model as only stores to all the extreme vertices of . We have that except by the fact that coordinates of points in are not necessarily sorted. In general, it is always assumed that coordinates of extreme vertices in the extreme vertices model of an D-OPP , , have a fixed coordinates ordering. Moreover, when an operation requires manipulating two EVMs, it is assumed both sets have the same coordinates ordering.

The projection operator for D cells, points, and sets of points is, respectively specified as follows.(i)Let be an D cell embedded in the D space. will denote the projection of the cell onto an D space embedded in D space whose supporting hyperplane is perpendicular to -axis; that is, .(ii)Let a point in . The projection of that point in the D space, denoted by , is given by . (iii)Let be a set of points in . The projection of the points in , denoted by , is defined as the set of points in such that .

In all the three above cases, is the coordinate corresponding to -axis to be suppressed.

For an D-OPP , we will say that denotes the number of distinct coordinates present in the vertices of along -axis, . Let be the th D extended hypervolume, or just a D Couplet, of which is perpendicular to -axis, .

A slice is the region contained in an D-OPP between two consecutive couplets of . will denote to the th slice of , which is bounded by and , . A section is the D-OPP, , resulting from the intersection between an D-OPP and a D hyperplane perpendicular to the coordinate axis , , which dose not coincide with any D-couplet of . A section will be called external or internal section of if it is empty or not, respectively. will refer to the th section of between and , . Moreover, and will refer to the empty sections of before and after , respectively.

The projection of the set of D couplets, , , of an D-OPP can be obtained by computing the regularized XOR between the projections of its previous and next sections; that is, . On the other hand, the projection of any section, , of an D-OPP can be obtained by computing the regularized XOR between the projection of its previous section, , and the projection of its previous couplet . Or, equivalently, by computing the regularized XOR of the projections of all the previous couplets; that is, .

###### 2.2.1. The Regularized XOR Operation on the D-EVM

Let and be two D-OPPs having their respective representations and , then . This result, combined with the procedures presented in the previous section for computing sections from couplets and vice versa, allows expressing a formula for computing them by means of their corresponding extreme vertices models. That is,(i), (ii).

###### 2.2.2. The Regularized Boolean Operations on the D-EVM

Let and be two D-OPPs and , where is in . Then, . This implies a regularized Boolean operation, , where , over two D-OPPs and , both expressed in the D-EVM, can be carried out by means of the same applied over their own sections, expressed through their extreme vertices models, which are D-OPPs. This last property leads to a recursive process, for computing the regularized Boolean operations using the D-EVM, which descends on the number of dimensions. The base or trivial case of the recursion is given by the 1D-Boolean operations which can be achieved using direct methods. The XOR operation can also be performed according to the result described in the above subsection.

##### 2.3. Basic Algorithms for the D-EVM

Before going any further, we say -axis is the D spaceâ€™s coordinate axis associated to the first coordinate present in the vertices of . For example, given coordinates ordering , for a 3D-OPP, then .

The following primitive operations are, in fact, based in those originally presented in [1] see Algorithm 1.

Algorithm 1: Basic procedures under the EVM.

As can be observed, algorithms MergeXor, GetSection, and GetHvl are clearly sustained in the results presented in Section 2.2. The algorithm GetSection, via MergeXor algorithm, returns the projection of the next section of an D-OPP between its previous section and couplet [1, 3]. On the other hand, the algorithm GetHvl returns the projection of the couplet between consecutive input sections and [1, 3].

The algorithm BooleanOperation computes the resulting D-OPP , where is in (note that can also be trivially performed using MergeXor function). The basic idea behind the procedure is the following.(i)The sequence of sections from and , perpendicular to -axis, are obtained first. (ii)Then, every section of can recursively be computed as(iii)Finally, â€™s couplets can be obtained from its sequence of sections, perpendicular to -axis.

In fact, BooleanOperation can be implemented in a wholly merged form in which it only needs to store one section for each of the operands and (sP and sQ, resp.), and two consecutive sections for the result (sRprev and sRcurr) [1]. The idea is to consider a main loop that gets sections from and/or , using function GetSection. These sections, sP and sQ, are recursively processed to compute the corresponding section of , sRcurr. Since â€™s two consecutive sections, sRprev and sRcurr, are kept, then the projection of the resulting couplet, is obtained by means of function GetHvl, and then, it is correctly positioned in â€™s EVM by procedure SetCoord [1]. When the end of one of the polytopes or is reached, then the main loop finishes, and the remaining couplets of the other polytope are either appended or not to the resulting polytope depending on the Boolean operation considered. More specific details about this implementation of BooleanOperation algorithm can be found in [1] or [3].

#### 3. Forward and Backward Differences of an D-OPP

Because it is well known that regularized XOR operation over two sets and can be expressed as , then we have that given an D-OPP , and specifically one of its couplets the expressions and will be called forward and backward differences of the projection of two consecutive sections and , and they will be denoted by and , where -axis is perpendicular to them.

One interesting characteristic, described in [1], of forward and backward differences of a 3D-OPP, is that forward differences are the sets of faces, on a couplet, whose normal vectors point to the positive side of the coordinate axis perpendicular to such couplet. Similarly, backward differences are the sets of faces, on a couplet, whose normal vectors point to the negative side of the coordinate axis perpendicular to such couplet. By this way, it is provided a procedure for obtaining the correct orientation of faces in a 3D-OPP when it is converted from 3D-EVM to a boundary representation.

In the context of an D-OPP , there are methods to identify normal vectors in the D cells included in â€™s boundary. For example, simplicial combinatorial topology provides methodologies assuming a polytope is represented under a simplexation. Such methods operate under the fact the vertices of an D simplex are labeled and sorted. Such sorting corresponds to an odd or an even permutation. By taking vertices from the vertices of the D simplex, we get the vertices corresponding to one of its D-cells. In this point, usually, a set of entirely arbitrary rules are given to determine the normal vector to such D cells; see for example, [19, 20]. Such rules establish, according to the parity of the permutation, if the assigned normal vector points towards the interior of the polytope or outside of it.

On the other hand, there are works that consider the determination of normal vectors by taking into account properties of the cross product and the vectors that compose the basis of D space. For example, Kolcun [21] provides one of such methodologies; however, it is also dependent of polytopes are represented through a simplexation. In this last sense, forward and backward differences will provide us a powerful tool, because, in fact, given an D-OPP , forward differences are the sets of cells lying on , whose normal vectors point to the positive side of the coordinate axis , while backward differences are the sets of D cells also lying on but whose normal vectors point to the negative side of the coordinate -axis.

Figure 2 shows a 3D-OPP and its corresponding sets of 2D-couplets perpendicular to , , and -axes (Figures 2(b), 2(c), 2(d)). According to Figure 2(a), the OPP has 5 non-extreme vertices which are marked in white. Three of them have four coplanar incident odd edges; another one has six incident odd edges, and the last one has exactly two incident collinear odd edges. The remaining vertices, actually the extreme vertices, have exactly three linearly independent odd edges. Table 1 shows the extraction, for the 3D-OPP shown in Figure 2(a), of its faces and their correct orientation through forward and backward differences. The first row shows sections perpendicular to -axis. Through them, we compute forward differences to in order to obtain the faces whose normal vector points towards the positive side of -axis. On the other hand, these same sections share us to compute backward differences to , which are composed by the set of faces whose normal vector points towards the negative side of -axis. In a similar way, the remaining two rows of Table 1 show sections perpendicular to and -axes and their respective forward and backward differences.

Table 1: Forward and backward differences of a 3D-OPP (see text for details).
Figure 2: (a) A 3D-OPP with its extreme (black) and nonextreme vertices (white). (b) Couplets perpendicular to -axis. (c) Couplets perpendicular to -axis. (d) Couplets perpendicular to -axis.

An algorithm for computing forward and backward differences consists of obtaining projections of sections of the input polytope and processing them through BooleanOperation algorithm by computing regularized difference between two consecutive sections. Algorithm 2 implements these simple ideas in order to compute the forward and backward differences in an D-OPP represented through the D-EVM. Its output will consist of two sets: the first set FD contains the D-EVMs corresponding to forward differences in , while the second set BD contains the D-EVMs corresponding to backward differences in . Algorithm 2 will be useful when we describe our procedure for extracting D boundary elements of an D-OPP which is represented through the D-EVM. Such procedure will be described in Section 5.

Algorithm 2: Computing forward and backward differences in a polytope represented through an D-EVM.

#### 4. A Connected Components Labeling Algorithm under the D-EVM

Now, as one of the main contributions of this work, we will describe our proposed algorithm for performing connected components labeling in an D-OPP expressed under the D-EVM. We think our algorithm can be positioned in Suzukiâ€™s second category (see Section 1), because it assigns temporal labels for elements embedded in the current processed slice of , , but when the next slice is processed, , it is possible some of these labels change taking place a second pass over which assigns new labels. Two properties of interest of our algorithm are pointed out.(i)It processes only two consecutive slices of at a time. In fact, such slices are not explicitly manipulated but their corresponding representative D sections.(ii)The algorithm descends recursively over the number of dimensions in such way that it is determined for each D section of its corresponding D components. By this way, the D components of two consecutive D sections are manipulated and used for determining the labels to assign.

The idea behind the proposed methodology considers to process sequentially each D section of . Let be the current processed section of . We obtain, via a recursive call, its D components. Let be the section before . For each D component in and for each D component in , it is performed their regularized intersection . According to the result, one of three cases can arise.

Case 1. (i) If the intersection is not empty and does not belong to any component of , then is added to the component of , where the current component of , , belongs.

Case 2. (i) If the intersection is not empty but is already associated to a component of , then such component and the component where is contained are united to form only one new component for . It could be the case that both components to unite are, in fact, the same. In this situation, no action is performed. On the other hand, if the union is achieved, then all the references pointing to the original D components where and belonged must be updated in order to point to the new component.

Case 3. (i) If the intersection with all components of is empty, then does not belong to any of the currently identified components of . Therefore, belongs to, and starts, a new D component.

Tables 2 and 3 show an example where the above ideas are applied on a 2D-OPP. Such OPP is composed of 22 extreme vertices and has five internal sections which are perpendicular to -axis. Once all sections are processed, it is determined the existence of two components.

Table 2: Connected component labeling over a 2D-OPP (Part 1).
Table 3: Connected component labeling over a 2D-OPP (Part 2).

A more specific implementation of our procedure is given in Algorithm 3. In order to distinguish between Cases 1 and 2, the algorithm uses a Boolean flag (withoutComponent). When Case 1 is achieved, then , the current component of section , is already associated to a component of . Therefore, the flagâ€™s value is inverted for indicating this last property and, for instance, sharing that only Case 2 could be reached in the subsequent iterations. If for all components of , the section before , the intersection with was empty, then the flag never changed its original value. In this way, Case 3 can be identified.

Algorithm 3: Connected component labeling over an D-OPP expressed in the D-EVM.

Our implementation considers the use of lists for controlling and manipulating references between D sectionsâ€™ components and their associated D components. We assume that such lists are manipulated and accessed through the following primitive functions.(i)Size (list): returns the number of elements in the list.(ii)List (i): returns the element at position i of the list, . (iii)Update (list, i, nV): the list is updated by substituting element in position i with the new element nV. (iv)Append (list, v): an element v is appended at the end of the list.(v)Insert (list, i, v): an element v is inserted at position i of the list. (vi)Remove (list, i): it is removed from the list the element at position i.(vii)IndexOf (list, v): returns a negative integer if v is not present in the list. Otherwise, an index between 0 and Size (list)-1 is returned indicating the first occurrence of v.(viii)DeleteAll (list): deletes all the elements contained in the list.

Algorithm 3 considers the use of five lists. (i)componentsSj (componentsSi): the D components of section . The D-EVM associated to the th (th) component of section is obtained via componentsSj( ) (componentsSi( )).(ii)indexesSj (indexesSi): a list of indexes. () denotes the th (th) component of section belongs to the th (th) component of D-OPP .(iii)componentsP: the components of input D-OPP . components( ) returns a list of D sections which describe the th D component of .

Let be the th component of section and be the th component of section . Both and were, respectively, obtained from componentsSi( ) and componentsSj( ). The lists are used and manipulated according the considered algorithmâ€™s case.(i)In Case 1, componentsP(indexesSi( )) returns the component of , where belongs. is incorporated to such component by appending it in such list. Finally, via Append(indexesSj, indexesSi( )), it is now established that belongs to the same component than , because they have the same componentâ€™s index.(ii)In Case 2, we obtain the components, where and belong through componentsP(indexesSi(i)) and componentsP(indexesSj(j)) (if indexesSi(i) and indexesSj(j) are equal, then, as commented previously, no action is performed). All the elements in the first component are transferred to the second component. The position where the first component resided in the list componentsP is now updated to NULL. Via, Update(indexesSi, i, indexesSj(j)), it is established that belongs to the same component like . Finally, it must be verified if there are D components of and whose value in indexesSi and indexesSj refers to the now nullified position in componentsP. If it is the situation, then their indexes must be updated with the value in indexesSj(j). (iii)In Case 3, a new component for D-OPP is created. The new list, containing only to , is appended in list componentsP. The value given by the size of list componentsP minus one is appended in list indexesSj. Such value corresponds to the componentâ€™s index for .

When the algorithm finishes the processing of sections, each list in componentsP is a list of D sections or a NULL element. If a NULL element is found, then it must be removed. Otherwise, we obtain the corresponding D-EVM, which at its time corresponds to a component of the input D-OPP . It is possible the D sections contained in a given list are not correctly ordered. With the purpose of determining the correct sequence, in Algorithm 3, when a D-OPP is appended, the common coordinates of the previous and next couplets are also introduced with it.

Consider a 5D-OPP generated by the union of the following six 5D hypercubes:(i), (ii), (iii), (iv), (v), (vi).

Figure 3(a) shows â€™s 5D-4D-3D-2D projection. Hypercubes and have a common (3D) volume; hypercube shares an edge with hypercube , and hypercubes to compose a J-shaped form. Its representation via the 5D-EVM required 92 extreme vertices. Figures 3(b) and 3(c) show its 4D couplets and sections, perpendicular to -axis, respectively. Each 4D section of is composed of only one component (this is determined via a recursive call of Algorithm 3). Remember that , hence, its intersection with section is also empty and, therefore, is associated to 5D component 0. Next, the regularized intersections between projections of sections and is also empty. This implies that is associated with 5D component 1. The same result is obtained when computing regularized intersection between projections of sections and . Component 2 has to . Finally, the intersection between and corresponds to a 4D hyperbox, which implies that is also associated to component 2. As a final result, Algorithm 3 identified three 5D components in .(i)Component 0 corresponds to hypercube (Figure 4(a)).(ii)Component 1 corresponds to hypercube (Figure 4(b)).(iii)Component 2 corresponds to the union of hypercubes to (Figure 4(c)).

Figure 3: A 5D-OPP. (a) 5D-4D-3D-2D projection. (b) 4D Couplets perpendicular to -axis. (c) 4D Sections perpendicular to -axis.
Figure 4: The three components identified by applying Algorithm 3 over the 5D-OPP from Figure 3(a).

Previously, we mentioned hypercubes and shared a 3D volume. When computing regularized intersection between and (their corresponding sections in ) the result was the empty set. This is due to the use of regularized boolean operations: operations between D polytopes must be dimensionally homogeneous; that is, they must produce as result another D polytope or the null object [22]. Hypercubes and shared a (1D) edge, but the regularized intersection between their corresponding sections, in , and , also produced a null object. A distinct situation arises when the regularized intersection between and is analyzed: Algorithm 3 determined that they are associated with the same component.

The above example has illustrated a property of Algorithm 3. When the foundations behind our method were established, it was commented the algorithm process, not in an explicit way, consecutive slices of the input polytope . Each D slice of has its corresponding representative section for which Algorithm 3 determines its corresponding D components. Let and be nonempty D components such that is associated to D section , while is associated to D section . The fact that and have empty regularized intersection implies (1) that their corresponding D regions are disjoint and, therefore, they have null adjacencies, or (2) that some parts of its corresponding slices have a D adjacency; that is, some D elements, , are, completely or partially, shared. In both cases, Algorithm 3 uses this kind of adjacencies, via the result of regularized intersection between and , for determining that the corresponding D regions are disjoint and, for instance, associate them with different components. Hence, a D component shared by Algorithm 3 corresponds to those parts of the input D-OPP that are united via D adjacencies. The way Algorithm 3 breaks a polytope will be very useful in the following sections, specifically when we present our methodology for identifying D boundary elements.

#### 5. Extracting D Boundary Elements from an D-OPP

This section presents the second main contribution of this work. As commented in Section 1, the way we extract D boundary elements from an D-OPP represented through the D-EVM will be reminiscent to the reconstruction of the boundary tree associated to such D-OPP. According to Section 3, forward and backward differences can be computed through Algorithm 2. In fact, all and from an D-OPP are D-OPPs embedded in D space, because the projection operator is used in their corresponding definitions: and . If such forward and backward differences were computed through our proposed algorithm, then they are expressed as and . If we apply again Algorithm 2 to such D-OPPs, we will get new forward and backward differences that correspond to the D oriented cells on the boundary of such D-OPPs. These new forward and backward differences are themselves D-OPPs represented through the EVM. Hence, by applying again Algorithm 2 to them, we obtain their associated D oriented cells grouped as forward and backward differences. This procedure generates a recursive process which descends in the number of dimensions. In each recursivity level, we obtain forward and backward differences associated to the input D-OPPs, . The base case is reached when . In this situation, the boundary of a 1D-OPP is described by the beginning and ending extreme vertices of each one of its composing segments.

Algorithm 4 implements the above-proposed ideas in order to identify and to extract D boundary elements from a D-OPP. Input parameters for our algorithm require the EVM associated with the input D-OPP , the number of dimensions, and a list, where the boundary elements of are going to be stored. Such a list, called boundaryElements, is assumed to be a list of lists such that boundaryElements( ) returns the list that contains the identified D elements, . When , then we have the main call with D-OPP , , and list boundaryElements initialized with empty lists (if , then the boundary elements of are precisely its extreme vertices which can be directly extracted from the ). When , then the input OPP is, in fact, a D boundary element of and boundaryElements contains the elements (vertices, edges, faces, etc.) discovered prior to such recursive call. In the algorithmâ€™s basic case, when , no action is performed, because the input 1D-OPP has only as boundary elements the vertices that bound its corresponding segment. The vertices in such 1D-OPP have been previously identified, because the algorithm always receives and uses a list of discovered vertices. Such a list is located in the input boundaryElements at position zero, and it is updated, as required, along main and all recursive calls.

Algorithm 4: Extracting D boundary elements from an OPP expressed in the EVM.

Specifically, Algorithm 4 performs the discovery of D boundary elements, for an input D-OPP , in the following way.(i)We obtain the list, where the discovered D boundary elements are going to be stored: boundaryElements . We obtain the list of previously discovered vertices of : boundaryElements(0).(ii)We compute, through Algorithm 2, â€™s forward and backward differences perpendicular to -axis (the axis associated with the first coordinate of the vertices in the input EVM).(iii)For each element in the list of forward (backward) differences are computed, via Algorithm 3, its corresponding components. Each component is expressed as a D-EVM.

Now, each component in the currently processed forward (backward) difference is processed in the following way.(i)We initialize a list which will store the vertices that form the component (verticesCurrComp).(ii)Because the component is an OPP embedded in D space, the vertices in its EVM only contain coordinates. The pointsâ€™ coordinates are completed first by incorporating them into the common coordinate that the -coordinates extreme vertices, that define the forward (backward) difference to which the component belongs, have. The remaining coordinates are taken from the list previousCoordinates (such a list is received as input by the algorithm). The function GetNdPoint performs the completion of the pointsâ€™ coordinates in such a way that we obtained vertices with coordinates.(iii)Each point (now with coordinates) from the component is evaluated in order to determine if it has been previously discovered. In this sense, it is verified if the point is present in the list of identified vertices. If function IndexOf returns a negative index, then it implies a new vertex has been discovered. In this case, the point is appended in the list of vertices. Its corresponding new index is given by the size of such a list minus one. In any case, the pointâ€™s index is inserted in the componentâ€™s list of vertices (verticesCurrComp). It is important to take into account that points listed in verticesCurrComp appear in the order they were discovered by our algorithm; hence, pointsâ€™ ordering in such a list do not necessarily follow the orientation of the component they belong to.

Once all the points in the EVM of the current component have been processed, we continue, on one side, to determine if it has been previously discovered, and on the other side, to use it for the discovering of new D boundary elements. Both tasks are, respectively, achieved in the following way.(i)It is verified if the componentâ€™s list of vertices (verticesCurrComp) is an element of the list containing the previously identified D boundary elements. If the function IndexOf returns a negative index, then a new D boundary element has been discovered and list verticesCurrComp is appended in the list of D elements. (ii)It is performed a recursive call to the algorithm by using as input the componentâ€™s D-EVM. Such a recursive call will identify D boundary elements of D-OPP .

Consider the 3D-OPP shown in Figure 5. Suppose that the ordering of the coordinates of 3D-EVM of is . All the vertices of are extreme except that with a dotted circle, because it has five incident edges and four of them are odd edges, while the fifth one, which is parallel to -axis, is, in fact, an even edge; hence, it does not belong to any brink of . There are another two even edges in : one of them is parallel to -axis while the other to -axis. Tables 4 and 5 show the way Algorithm 4 discovers faces, perpendicular to -axis, and vertices of (we recall that our algorithm lists boundary elementsâ€™ vertices in the order they are discovered). Table 4 corresponds to the processing of forward differences. is composed by only one component and its 2D-EVM shares the discovering of four vertices. Three of them correspond to projections of extreme vertices of , because they have only 2 coordinates, while the fourth one precisely corresponds to the projection of the nonextreme vertex indicated in Figure 5. The vertices are completed, in order to have three coordinates, by annexing them the common coordinate of its corresponding forward difference . By this way, vertices , , , and , and the face they define, are initially discovered. Via Algorithm 3, is separated in two components. Each component corresponds to a new face defined by four vertices. Both faces and the eight vertices are, respectively, added to the lists of discovered faces and vertices.

Table 4: Identifying faces, of the 3D-OPP from Figure 5, through forward differences and Algorithm 4 (see text for details. Facesâ€™ vertices are listed in the order they are discovered).
Table 5: Identifying faces, of the 3D-OPP from Figure 5, through backward differences and Algorithm 4 (see text for details. Facesâ€™ vertices are listed in the order they are discovered).
Figure 5: A 3D-OPP. The dotted lines correspond to even edges. The vertex with the dotted circle is a nonextreme vertex.

Table 5 shows the processing of backward differences. corresponds to a 2D-OPP in which six of its seven vertices are extreme vertices. When applying Algorithm 3 over , we obtained two components. The extreme vertices of are present in the components, but a new vertex appear which is product of the separation of the original face. Such a vertex , in fact, was previously identified when processing (Table 4). nonextreme vertex is present in the second component: it was also identified when was processed. The remaining vertices in both components, and the faces they define, are appended to their corresponding lists.

Each one of the 2D components in the forward and backward differences of is used as input for the recursive calls of Algorithm 4. These calls have the objective of identifying edges perpendicular to -axis. Table 6 presents the way Algorithm 4 discovers of some of these edges. When is sent as input its corresponding 1D forward and backward differences, perpendicular to -axis, are computed. Two edges are identified: one is defined by vertices and (an odd edge), while the other is defined by vertices and . Edge is one of the three even edges that 3D-OPP has. According to previous sections, nonextreme vertices are ignored by the EVM. Moreover, when brinks are obtained from an EVM, even edges remain unidentified, because they are not part of brinks. Tables 4 and 6 exemplify situations where these types of former boundary elements are obtained after computing forward and backward differences.

Table 6: Identifying some edges, of the 3D-OPP from Figure 5, through Algorithm 4 (see text for details).

When considering D orthogonal polytopes, , Algorithm 4 is clearly capable of identifying nonextreme vertices and even edges. Furthermore, it is capable of discovering those D boundary elements that cannot be described via brinks. Consider the 4D-OPP presented in Figure 6(a). Such polytope can be seen as two hypercubes sharing a face (which is shaded in gray). The face is composed by four nonextreme vertices and four even edges. When â€™s brinks, parallel to to -axes, are obtained (Figure 6(b)), the shared faceâ€™s elements are not present, because the 4D-EVM only stores extreme vertices which in time define brinks which are formed only by odd edges. Figure 6(c) presents the three 3D couplets, perpendicular to -axis, of . Each couplet is formed by a volume. The three volumes appear to intersect, but this is an effect of the 4D-3D-2D projections used. Figure 6(d) presents â€™s two 3D forward differences perpendicular to -axis. When processing , Algorithm 4 detects a 3D boundary volume defined by eight vertices: four of them correspond to extreme vertices of , while the other four correspond to the vertices of the shared face: such vertices did not belong to . These four vertices are detected again when processing backward difference (see Figure 6(e)). Three-dimensional forward difference is used, in a recursive call, as input for Algorithm 4 (see Figure 6(f)). When its 2D forward and backward differences, perpendicular to -axis, are processed and specifically when processing its only backward difference, the shared face is formerly discovered and stored in the list of â€™s boundary faces. The edges of such face are formerly discovered when this face is then sent as input, in a new recursive call, of Algorithm 4.

Figure 6: Discovery of a specific face in a 4D-OPP via Algorithm 4 (see text for details).

We conclude this section by mentioning that it is important to take into account the coordinates ordering in an EVM determines which boundary elements are identified. Suppose that we use the sorting . Algorithm 2 will extract forward and backward differences perpendicular to -axis. Then, in turn, Algorithm 4 shares to identify 3D boundary volumes perpendicular precisely to -axis (see Figures 6(d) and 6(e)). When each one of these volumes is sent as input in the corresponding recursive calls, we have input 3D-EVMs sorted as . Hence, there are identified, again, because of the use of Algorithm 2, faces perpendicular to -axis. In this phase, we are working with volumes embedded in a 3D space, because of the use of projection operator which has removed the -coordinate. But, when the source 4D Space is taken into account, it can be determined, in fact, such faces are perpendicular to the plane described by and axes, because they precisely belong to volumes perpendicular to -axis (see Figure 6(f)). When each face, expressed as a 2D-EVM, is sent again as input, we identify edges perpendicular to -axis, formally, edges perpendicular to the 3D hyperplane described by , , and axes. Some applications could require to have access to boundary elements which cannot be identified via a given coordinates ordering. In this sense, a new sorting of the corresponding EVM is required, but it can be achieved in efficient time respect to the number of extreme vertices in the corresponding EVM. By this way, for example, coordinates sorting will share to identify 3D volumes perpendicular to -axis, faces perpendicular to the plane , and edges perpendicular to the 3D hyperplane .

#### 6. An Experimental Time Complexity Analysis for Boundary Extraction under the D-EVM

The following key points define the conditions over which the execution time of Algorithm 4 was measured.(i)The units for the time measures are given in nanoseconds.(ii)The evaluations were performed with a CPU Intel Core Duo (2.40â€‰GHz) and 2 Gigabytes in RAM. (iii)Our algorithms were implemented using the Java Programming Language under the Software Development Kit 1.6.0.(iv)Our testing consider .(v)For each , we have generated 10,000 random D-OPPs. Each generated D-OPP was, respectively, expressed as and sent as input to Algorithm 4.(vi)In the 2D, 3D, 4D, and 5D cases, the considered coordinates ordering were , , , and , respectively. This implies that, as specified in Section 5, we identified first D boundary elements perpendicular to -axis, then we identified D boundary elements perpendicular to -axis, and so on. (vii)Once the generation of D-OPPs has finished and the algorithm was evaluated, we proceed with a statistical analysis in order to find a trendline of the form , where = Card , that fits as good as possible to our measures in order to provide an estimation of the temporal complexity of Algorithm 4 for each value of . The quality of the approximation curve is assured by computing the coefficient of determination .

Table 7 shows some statistics related to our generated polytopes. In Figure 7 the behavior of Algorithm 4 with our testing sets of D-OPPs can be visualized. In the same chart the corresponding trendline for each value of whose associated equations are shown in Table 8 can be also appreciated.

Table 7: Some statistical characteristics of the sets of random D-OPPs for testing of Algorithm 4.
Table 8: Equations associated to the trendlines that describe execution time of Algorithm 4 in the cases with .
Figure 7: Execution times of Algorithm 4 for 2D, 3D, 4D, and 5D-OPPs and their corresponding trendlines.

We can then observe in the obtained trendlines (Table 8) that the exponents associated with the number of vertices vary between 1 and 1.5. These experimentally identified complexities for our Algorithm 4 provide us elements to determine its temporal efficiency when we extract boundary elements from an D-OPP expressed as an EVM.

#### 7. Concluding Remarks and Future Work

In this work, we have provided two contributions: an algorithm for computing connected components labeling and an algorithm for extracting boundary elements. The procedures deal with the dominion of the -dimensional orthogonal pseudo-polytopes, and they are specified in terms of the extreme vertices model in the -dimensional space. As seen before, both algorithms are sustained in the basic methodologies provided by the D-EVM. As commented in Section 2, some of such basic algorithms in time are sustained in the MergeXor algorithm. It computes the regularized XOR between two D-OPPs expressed in the EVM but in terms of the ordinary XOR operation. This implies MergeXor, as its name indicates, is implemented as a merging procedure that only takes in account those extreme vertices present in the first or second input EVMs but not in both. Therefore, it can be specified as a merging-like procedure with an execution linear time given by the sum of the cardinalities of the input EVMs [1]. On one hand, this has as a consequence the temporal efficiency of the basic EVM algorithms. On the other hand, as seen in Section 6 and from an empirical point of view, we have elements to sustain the efficiency of the algorithms provided here.

As part of our future work, and particularly, immediate applications for Algorithms 3 and 4, we comment that we will attack the problem related to the automatic classification of video sequences. In [23], we describe a methodology for representing 2D color video sequences as 4D-OPPs embedded in a 4D color-space-time geometry. Our idea is the use of geometrical and topological properties, such as boundary descriptions, connected components, and discrete compactness, in order to determine similarities and differences between sequences and for instance to classify them. In [5], part of this work has been boarded using only discrete compactness, and the obtained results are promising. We are going to incorporate the information provided by Algorithms 3 and 4 in order to determine if they can contribute to enhance the results.

#### References

1. A. Aguilera, Orthogonal polyhedra: study and application, Ph.D. thesis, Universitat Politècnica de Catalunya, 1998.
2. A. Aguilera and D. Ayala, â€śOrthogonal polyhedra as geometric bounds in constructive solid geometry,â€ť in Proceedings of the 4th ACM Siggraph Symposium on Solid Modeling and Applications (SM ’97), pp. 56â€“67, ACM, Atlanta, Ga, USA, 1997.
3. R. Pérez-Aguila, Orthogonal polytopes: study and application, Ph.D. thesis, Universidad de las Américas-Puebla (UDLAP), 2006.
4. R. Pérez-Aguila, â€śModeling and manipulating 3D datasets through the extreme vertices model in the n-dimensional space (nD-EVM),â€ť Research in Computer Science, vol. 31, pp. 15â€“24, 2007.
5. R. Pérez-Aguila, â€śComputing the discrete compactness of orthogonal pseudo-polytopes via their $n$-EVM representation,â€ť Mathematical Problems in Engineering, vol. 2010, Article ID 598910, 28 pages, 2010.
6. J. Rodríguez and D. Ayala, â€śErosion and dilation on 2D and 3D digital images: a new size-independent approach,â€ť Vision Modeling and Visualization, pp. 143â€“150, 2001.
7. J. Rodríguez and D. Ayala, â€śFast neighborhood operations for images and volume data sets,â€ť Computers and Graphics, vol. 27, no. 6, pp. 931â€“942, 2003.
8. A. Rosenfeld and J. L. Pfaltz, â€śSequential operations in digital picture processing,â€ť Journal of the ACM, vol. 13, no. 4, pp. 471â€“494, 1966.
9. S. Marchand-Maillet and Y. M. Sharaiha, Binary Digital Image Processing, Academic Press Inc., San Diego, Calif, USA, 2000.
10. H. Samet and M. Tamminen, â€śefficient component labeling of images of arbitrary dimension represented by linear bintrees,â€ť IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 10, no. 4, pp. 579â€“586, 1988.
11. K. Sandfort and J. Ohser, â€śLabeling of $n$-dimensional images with choosable adjacency of the pixels,â€ť Image Analysis & Stereology, vol. 28, no. 1, pp. 45â€“61, 2009.
12. K. Wu, E. Otoo, and A. Shoshani, â€śOptimizing connected component labeling algorithms,â€ť in Progress in Biomedical Optics and Imaging, vol. 5747 of Proceedings of SPIE, no. 3, pp. 1965â€“1976, 2005.
13. K. Suzuki, I. Horiba, and N. Sugie, â€śLinear-time connected-component labeling based on sequential local operations,â€ť Computer Vision and Image Understanding, vol. 89, no. 1, pp. 1â€“23, 2003.
14. H. Samet, â€śConnected component labeling using quadtrees,â€ť Journal of the Association for Computing Machinery, vol. 28, no. 3, pp. 487â€“501, 1981.
15. A. A. Requicha, â€śRepresentations for rigid solids: theory, methods, and systems,â€ť Computing Surveys, vol. 12, no. 4, pp. 437â€“464, 1980.
16. H. Hansen and N. Christensen, â€śA model for n-dimensional boundary topology,â€ť in Proceedings of the 2th Symposium on Solid Modeling and Applications, pp. 65â€“73, Montreal, Canada, 1993.
17. L. K. Putnam and P. A. Subrahmanyam, â€śBoolean operations on n-dimensional objects,â€ť IEEE Computer Graphics and Applications, vol. 6, no. 6, pp. 43â€“51, 1986.
18. M. Spivak, Calculus on Manifolds. A Modern Approach to Classical Theorems of Advanced Calculus, W. A. Benjamin, Inc., New York, NY, USA, 1965.
19. G. McCarty and G. S. Yound, Topology, Dover Publications Inc., New York, NY, USA, 2nd edition, 1988.
20. G. L. Naber, Topological Methods in Euclidean Spaces, Dover Publications Inc., Mineola, NY, USA, 2000.
21. A. Kolcun, â€śVisibility criterion for planar faces in 4D,â€ť in Proceedings of Spring Conference on Computer Graphics (SCCG '04), pp. 216â€“219, Budmerice, Slovakia, 2004.
22. T. Takala, â€śA taxonomy on geometric and topological models,â€ť Computer Graphics and Mathematics, pp. 146â€“171, 1992.
23. R. Pérez-Aguila, â€śRepresenting and visualizing vectorized videos through the extreme vertices model in the n-dimensional Sspace (nD-EVM),â€ť Journal Research in Computer Science, vol. 29, pp. 65â€“80, 2007.