The 9 possible connectivities in a 5x5x5 neighborhood
In order to specify a set of connectivities, the dimension and the width of the neighborhood , must be specified. The dimension of a neighborhood is valid for any dimension . A common width is 3, which means along each dimension, the central cell will be adjacent to 1 cell on either side for all dimensions.
Let represent a N-dimensional hypercubic neighborhood with size on each dimension of
Let represent a discrete vector in the first orthant from the center structuring element to a point on the boundary of . This implies that each element and that at least one component
Let represent a N-dimensional hypersphere with radius of .
Define the amount of elements on the hypersphere within the neighborhood as . For a given , will be equal to the amount of permutations of multiplied by the number of orthants.
Let represent the amount of elements in vector which take the value .
The total number of permutation of can be represented by a multinomial as
If any , then the vector is shared in common between orthants. Because of this, the multiplying factor on the permutation must be adjusted from to be
Multiplying the number of amount of permutations by the adjusted amount of orthants yields,
Let represent the number of elements inside of the hypersphere within the neighborhood . will be equal to the number of elements on the hypersphere plus all of the elements on the inner shells. The shells must be ordered by increasing order of . Assume the ordered vectors are assigned a coefficient representing its place in order. Then an ordered vector if all are unique. Therefore can be defined iteratively as
If some , then both vectors should be considered as the same such that
Note that each neighborhood will need to have the values from the next smallest neighborhood added. Ex.
includes the center hypervoxel, which is not included in the connectivity. Subtracting 1 yields the neighborhood connectivity,
The assumption that all are unique does not hold for higher values of k & N. Consider , and the vectors . Although is located in , the value for , whereas is in the smaller space but has an equivalent value . but has a higher value of than the minimum vector in .
For the this assumption to hold,
At higher values of & , Values of will become ambiguous. This means that specification of a given could refer to multiple .
4-connected pixels are neighbors to every pixel that touches one of their edges. These pixels are connected horizontally and vertically. In terms of pixel coordinates, every pixel that has the coordinates
8-connected pixels are neighbors to every pixel that touches one of their edges or corners. These pixels are connected horizontally, vertically, and diagonally. In addition to 4-connected pixels, each pixel with coordinates is connected to the pixel at .
6-connected pixels are neighbors to every pixel that touches one of their faces. These pixels are connected along one of the primary axes. Each pixel with coordinates , , or is connected to the pixel at .
18-connected pixels are neighbors to every pixel that touches one of their faces or edges. These pixels are connected along either one or two of the primary axes. In addition to 6-connected pixels, each pixel with coordinates , , , , , or is connected to the pixel at .
26-connected pixels are neighbors to every pixel that touches one of their faces, edges, or corners. These pixels are connected along either one, two, or all three of the primary axes. In addition to 18-connected pixels, each pixel with coordinates , , , or is connected to the pixel at .