The body of methods in mathematical morphology is well known and described in [9][8] and various other publications. We will only try to give a short impression about the algorithms used to generate the objects defined in the previous sections.
Frankly spoken the iterative application of the so called hit-or-miss transformation (HMT) results either in an upper or in a lower ricefield image. These images contain the connected components as well as the local extrema.
The HMT is a replacement rule which replaces a pixel by its neighbor, if the processed pixel is recognized as located between two pixels building a monotone increasing or decreasing path, respectively. The HMT is repeated as long as any replacement occurs. In fact it is a thickening or thinning algorithm.
A pixel configuration of an increasing or decreasing path is recognized by the application of directional oriented structuring elements containing one part for an erosion (estimation of minimum pixel) and a dilation (estimation of maximum pixel). The structuring elements are shown in Fig.5, filled circles stand for dilation and empty circels for erosion. The centre point of the structuring element is always considered as origin. The choice of the structuring elements guarantees the topological thickening or thinning, respectively. The central part of C-code used for the HMT is listed in Fig.6 [5]. The exact rule for or against a pixel replacement is given in [8].
Using the familiar notations of mathematical morphology a structuring element is applied and compared with the original pixel grey value by
and is performed for each directed structuring element (see Fig.5) as long as any replacement occurs. This formula delivers a thinning transformation. The formula for thickening is analogous
(see Fig.6). The number of necessary iterations depends from the image topology and is directly related to the longest path in the image. The resulting image is called ricefield since it has some similarity with ricefield terraces. The formula given leads to the lower ricefield (LF). The formula results in the upper ricefield (UF).
The resulting image consists of flat connected components (UCC/LCC) with next existing grey value just below or above the local maximum or minimum (LMX/LMR), respectively. The grey values of the deviding lines of the connected components are those of the original image.
In spite of the theoretical definition of connected components the algorithm cannot generate connected components touching each other. Thin (4-neighbored) lines (paths) lie in between. This results from the complicated topology of discrete sets without open sets and without borders of area 0. In Figure 7b the digital image of a cell nucleus, an osteoblast, is shown with the upper and lower ricefield transform in the first image row (Fig.7a,7c). The dark lines in the left (UR) and the bright lines in the right (LR) image are the deviding lines mentioned above. In the second row of Figure 7 the connected components (Fig.7d,7f). In the Figure 8 the neighborhoods are shown (Fig.8a,8c) as well as the neighborhood (Fig.8b). The nodes of the graphs are located at the centroids of the LMN's and LMX's. The neighborhood graphs are shown on the complete nucleus to avoid border effects possible in the enlarged image.
For the estimation of upper and lower half height sets (UHH/LHH) the deviding lines of the connected components in UF and LF are desturbing. Considering a half height image calculated with
(see Fig.3) results in an image with grey values in . This image has theoretically pixel grey values for pixels in the upper half height and pixel grey values in the lower half height (see Fig.3). Unfortunately the borders of the connected components (thin lines as already mentioned) have original image values, hence they have in the HH image grey value 0 according to the given formula. To avoid these unwished pixels, we apply the following formula for calculation of the half height image:
In Fig.9a and Fig.9c the closing and the opening (see the structuring element D in Fig.5) of the ricefield images UF and LR are shown. The closing is a dilation succeeded by an erosion and the opening is an erosion succeeded by a dilation. The program code used is shown in Figure 6.
In Fig.7e the upper half height set (UHH) is shown. One can recognize, that the UHH appears smaller as the LHH, which is the complement of the UHH. This difference is true. The profile of the grey values in this example image of a cell nucleus has higher peaks (dark grey values) and smoother valleys, or with other words, the local extrema are more distant from each other. Hence the half height line is nearer to the LMX and accordingly the area of the UHH is smaller than the one of the LHH.
The application of the hit-or-miss-transformation for thickening (upper ricefield) and thinning (lower ricefield) delivers transformed images with several interesting and useful properties. The upper ricefield image contain the upper connected components and local maxima, the lower ricefield the lower connected components and the local minima. The ricefields can be interpreted as an upper and lower hull of the image (see Fig.3) and hence additionally useful for calculation of a half height partition, derived from the difference between the mean value image of upper and lower ricefield and the original. This procedure is comparable with segmentation methods applied in linear system theory, using a band pass filtered image instead, taking the difference with the original and the application of a threshold.
The computing time of the ricefield transformation is direct dependent from the longest free path inside the image, the number of elements of this path. To give an impression of the transformation the UR and LR is shown in Fig.10 in pseudo color, illustrating not only the connected components but also the included local extrema.
The ricefield transformation is sensitive for the slightest changes in grey values. Some noise will break down connected components to small pieces. Vice versa even strong averaging do not change the long range results, hence gives not false results. A smoothing with an appropriate filter size will avoid connected components from the size of the filter used and of smaller size.