A pixel's membership in a cluster depends on the neighborhood rule used. This research employs the North-East-West-South (NEWS) neighborhood rule in which two pixels are included in the same cluster if both the pixels are in the same class and the pixels are neighbors according to the neighborhood rule. NEWS neighbors share a pixel boundary on the north, east, west, or south. Consider the map as a 2-dimensional matrix of size and the current pixel is map(i,j) where and . The north, east, west, and south neighbors would have the coordinates map(i,j-1), map(i+1,j), map(i-1,j), and map(i,j+1), respectively (see Figure 5).
Figure 5: North, east, west, south relationship to pixel(i,j).