In this section, the proposed kidney segmentation method with a hierarchical strategy will be presented in detail. The hybrid method which incorporates SKFCM and IGC algorithm mainly consists of four steps. The framework of the proposed method is shown in Figure 1.

### A. Preprocessing

CT image has inhomogeneity, noise which affect the continuity and accuracy of the images segmentation. Therefore, a 3 × 3 median filter is used to reduce the noise. The equation of median filter is defined as:

\mathsf{\text{g}}\left(\mathsf{\text{x}},\mathsf{\text{y}}\right)=\mathsf{\text{Median}}\left({f}_{s}\left(\mathsf{\text{x}},\mathsf{\text{y}}\right)\right)

(1)

where S represents the template window with a 3 × 3 surrounding neighborhood, {f}_{s}\left(\mathsf{\text{x}},\mathsf{\text{y}}\right) represents the intensity value of each pixel in the S, \mathsf{\text{Median}}\left({f}_{s}\left(\mathsf{\text{x}},\mathsf{\text{y}}\right)\right) represents the middle value of all the values of the pixels in the neighborhood. Instead of simply replacing the pixel value with the mean of neighboring pixel values, median filter replaces it with the median of those values. Figure 2(a) is the original image. Figure 2(b) is the denoised image by a median filter. It has a better denoising result while the edges are well preserved.

### B. Rough Segmentation with SKFCM

In this paper, SKFCM algorithm introduces a kernel function and spatial constraint into the FCM algorithm, which can reduce the effect of noise and improve the clustering ability. The objective function of SKFCM as follows,

{J}_{m}={\displaystyle \sum _{i=1}^{c}}{\displaystyle \sum _{k=1}^{N}}{u}_{ik}^{m}\left(1-K\left({x}_{k},{v}_{i}\right)\right)+\alpha {\displaystyle \sum _{i=1}^{c}}{\displaystyle \sum _{k=1}^{N}}{u}_{ik}^{m}\left(1-K\left({\overline{x}}_{k},{v}_{i}\right)\right)

(2)

where c is the number of clusters of the dataset {\left\{{x}_{k}\right\}}_{k=1}^{N}, n is the number of pixels, m is a weighting exponent on each fuzzy membership and determines the amount of fuzziness of the resulting classification, {\left\{{v}_{i}\right\}}_{i=1}^{c} are the centers and the array \left\{{u}_{ik}\right\}\left(=U\right) represents a partition matrix, α in the second term controls the effect of the penalty, {\overline{x}}_{k} is the mean of neighboring pixel values of {x}_{k}, \mathsf{\text{K}}\left(\cdot ,\cdot \right) is the Gaussian kernel function. The objective function in (2) is minimized using the alternate iterations of the fuzzy partition matrix (3) and the centroids of clusters (4).

{u}_{ik}=\frac{{\left(\left(1-K\left({x}_{k},{v}_{i}\right)\right)+\alpha \left(1-K\left({\overline{x}}_{k},{v}_{i}\right)\right)\right)}^{\frac{-1}{\left(m-1\right)}}}{{\sum}_{j=1}^{c}{\left(\left(1-K\left({x}_{k},{v}_{i}\right)\right)+\alpha \left(1-K\left({\overline{x}}_{k},{v}_{i}\right)\right)\right)}^{\frac{-1}{\left(m-1\right)}}}

(3)

{v}_{i}=\frac{{\sum}_{k=1}^{n}{u}_{ik}^{m}\left(K\left({x}_{k},{v}_{i}\right){x}_{k}+\alpha K\left({\overline{x}}_{k},{v}_{i}\right){\overline{x}}_{k}\right)}{{\sum}_{k=1}^{n}{u}_{ik}^{m}\left(K\left({x}_{k},{v}_{i}\right)+\alpha K\left({\overline{x}}_{k},{v}_{i}\right)\right)}

(4)

The above algorithm can be summarized in the following steps.

Step 1: Fix the number c of these centroids and select initial class centroids and set \epsilon >0 to a very small value.

Step 2: Compute the mean filtered image.

Step 3: Update the partition matrix using (3).

Step 4: Update the centroids using (4)

Repeat steps 3-4 until the following termination criterion (5) is satisfied:

{V}_{new}-{V}_{old}<\epsilon

The purpose of this subsection is to get the rough contour of kidney in the CT images. Owing to the gray scales of kidney is similar to its neighboring tissues, it is important to identify which part belongs to the kidney. To solve this problem, a slice which has the largest contour in the whole dataset is cropped by a rectangle manually. The rectangle must enclose the kidney and its size should be as small as possible, so that it can increase the processing speed and the segmentation accuracy. Other slices are automatically cropped as described in the following. The optimal cluster number is 4 which is determined by experiments. The rough segmentation includes six steps.

Step 1: The cropped image is the input of SKFCM algorithm, and then each pixel in the cropped region is clustered into different clusters.

Step 2: The number of pixels in each cluster is calculated and the cluster which contains maximum pixels is extracted.

Step 3: The largest connected region is extracted to be the candidate kidney region.

Step 4: There are some holes inside the kidney because some vessels are rejected in the processing of fuzzy clustering. Therefore this step is to fill holes.

Step 5: The kidney contour is smoothed by morphological operations.

Step 6: Through the above steps, the mask of candidate kidney region is gotten. In order to realize the continuous segmentation, the minimum bounding rectangle (MBR) of the mask is calculated. Then the MBR is extended about 10 pixels so that we can get a new rectangle. This new rectangle is used to crop the next slice of CT sequeces.

Continuous rough kidney segmentation on CT images can be achieved by repeating steps 1-6. The procedure of rough segmentation is shown in Figure 3.

Figure 4 shows some intermediate results of rough segmentation. Figure 4(a) and 4(g) are original images, and the red rectangles are used to crop these original images. Figure 4(b) and 4(h) are clustering results. Figure 4(c) and 4(i) are the clusters which contain maximum pixels. Figure 4(d) and 4(j) are the largest connective regions with filled holes. Figure 4(e) and 4(k) are the candidate kidney with smooth contour. Figure 4(f) and 4(l) are the final results of SKFCM. The red rectangle is generated automatically and used to crop the next slice of CT images. As shown in the figures, Figure 4(f) is a better segmentation result than Figure 4(l). The former does not need refined segmentation, but the later need further segmentation by IGC algorithm. In the whole datasets, there are about half of images do not need refined segmentation after rough segmentation. More results of rough segmentation were shown in Figure 5. The parameter *n* is the slice number in the whole datasets.

### C. Refined Segmentation with IGC Algorithm

#### 1) The traditional GrowCut

GrowCut algorithm is an interactive segmentation method and solves pixel labeling task based on cellular automaton.

A cellular automaton (CA) is defined as a triplet \mathsf{\text{A}}=\left(\mathsf{\text{S}},\mathsf{\text{N}},\delta \right), where S is a set of non-empty state, N is the neighborhood system and \delta :{\mathsf{\text{S}}}^{\mathsf{\text{N}}}\to \mathsf{\text{S}} defines the state transition rule of cells at time t+1 based on the states of neighbor cells at time t. The Moore von (8-connected) and Neumann (4-connected) neighborhoods are two commonly used neighbor systems. The state of each cell is also a tri-plet {\mathsf{\text{S}}}_{\mathsf{\text{p}}}=\left({\mathsf{\text{l}}}_{\mathsf{\text{p}}},{\theta}_{\mathsf{\text{p}}},{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{p}}}\right), where {\mathsf{\text{l}}}_{\mathsf{\text{p}}} is the label of this cell, {\theta}_{\mathsf{\text{p}}} is the strength of this cell which ranges from 0 to 1, and {\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{p}}} is the feature vector that its value is image intensity.

A two-dimensional medical image (P) is a matrix of m×n pixels, and it is also treated as a cellular automaton with a special state in GrowCut algorithm. Each pixel (p) in the image is a "cell" with a certain type, and it may be background, foreground or undefined. The initial state for \forall \mathsf{\text{p}}\in \mathsf{\text{P}}is set to

{\mathsf{\text{l}}}_{\mathsf{\text{p}}}=0;{\theta}_{\mathsf{\text{p}}}=0;{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{p}}}={\mathsf{\text{I}}}_{\mathsf{\text{p}}}

(6)

where {\mathsf{\text{l}}}_{\mathsf{\text{p}}} is the intensity value of each pixel. As the segmentation algorithm proceeds, all pixels in this image are assigned to one of possible labels.

Before starting the segmentation, user should input an initial label matrix manually. The label matrix has a same size with the original image. In the label matrix, there are two kinds of marked points, one is foreground seed point whose label is {\mathsf{\text{l}}}_{\mathsf{\text{p}}}=1, and the other is background seed point whose label is {\mathsf{\text{l}}}_{\mathsf{\text{p}}}=-1. The original strength of these two kinds of marked points is {\theta}_{\mathsf{\text{p}}}=1. Apart from these two kinds of marked points, the label of the remainder of points is {\mathsf{\text{l}}}_{\mathsf{\text{p}}}=0. After all the initial operations have been done, the iteration segmentation runs until the label matrix does not change. Finally, the label value of object region is 1 and the label value of background is -1. The iterative process of labels {\mathsf{\text{l}}}_{\mathsf{\text{p}}} and strength {\theta}_{\mathsf{\text{p}}} at time t+1 is shown as follows,

State transition of CA

// For each cell...

for \forall \mathsf{\text{p}}\in \mathsf{\text{P}}

// Copy the previous state

{\mathsf{\text{l}}}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}+1}={\mathsf{\text{l}}}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}};

{\theta}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}+1}={\theta}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}};

// Neighbors try to attack current cell

for \forall \mathsf{\text{q}}\in \mathsf{\text{N}}\left(\mathsf{\text{p}}\right)

if \mathsf{\text{g}}\left(\left|\right|{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{p}}}-{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{q}}}|{|}_{2}\right)\cdot {\theta}_{\mathsf{\text{q}}}^{\mathsf{\text{t}}}>{\theta}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}}

{\mathsf{\text{l}}}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}+1}={\mathsf{\text{l}}}_{\mathsf{\text{q}}}^{\mathsf{\text{t}}};

{\theta}_{\mathsf{\text{p}}}^{\mathsf{\text{t}}+1}=\mathsf{\text{g}}\left(\mathsf{\text{||}}{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{p}}}-{\stackrel{\u20d7}{\mathsf{\text{C}}}}_{\mathsf{\text{q}}}||{}_{2}\right)\cdot {\theta}_{\mathsf{\text{q}}}^{\mathsf{\text{t}}};

end if

end for

end for

In [18], g(x) is defined as:

\mathsf{\text{g}}\left(\mathsf{\text{x}}\right)=1-\frac{\mathsf{\text{x}}}{\mathsf{\text{max}}{||\stackrel{\u20d7}{\mathsf{\text{C}}}||}_{2}}

(7)

#### 2) The Improved GrowCut

Although GrowCut algorithm is simple and precise, it is an interactive segmentation algorithm. For some complex images, just once interactive operation cannot achieve satisfactory results, and both foreground seed points and background seed points also should be selected carefully. In order to avoid multi-interaction, we propose an improved GrowCut algorithm which can generate seed labels automatically.

In this subsection, the rough segmentation results are continuous in space series and about half of them do not need refined segmentation. Therefore, the initial label matrix can be generated automatically using the result of rough segmentation (denoted as "a seed template image"). The seed template image must meet two conditions. One is that it does not need refined segmentation, and the other is that it is adjacent to the slice which needs refined segmentation. The process of generating both foreground and background seed points is described in Figure 6. Figure 6(a) is an original kidney CT image and Figure 6(d) is the contour of the kidney. Due to the spatial continuity of CT images, Figure 6(d) can be used to generate the initial label matrix for the segmentation of next slice. There are four steps to generate the initial label matrix automatically.

Firstly, we should get the edge points of kidney contour.

Secondly, calculate the altitude difference between two edge points. Figure 6(b) and 6(c) show the altitude difference (d_{y}) at point P_{m} and P_{n} respectively.

Thirdly, there are three threshold values T_{h}, T_{1}, T_{2} to control the process of generating seed points. The seed points will be located in the vertical direction if d_{y} is less than T_{h}, otherwise they will be located in the horizontal direction. Taking Figure 6(e) as an example, the foreground seed point is located at the bottom of P_{m} and the background seed point is located at the top of P_{m} , because d_{y} is less than T_{h}. In Figure 6(f), the foreground seed point is located at the right of P_{n} and the background seed point is located at the left of P_{n}, because d_{y} is greater than T_{h}. All foreground seed points are located inside of the kidney contour and the distance between them and edge points are T_{1} pixel. All background seed points are located outside of the kidney contour and the distance between them and edge points are T_{2} pixel. In Figure 6(e) and 6(f), the red points are denoted as foreground seed points and the green points are denoted as background seed points.

Finally, according to step 2 and 3, we can get both foreground and background seed points of each edge point

Figure 7 shows the refined segmentation result by IGC algorithm. Figure 7(a) is a seed template image. Figure 7(b) is the seed label image which is generated automatically base on IGC algorithm. The red points are foreground seed points and the green points are background seed points. The value of red point is 1, the value of green point is -1, and the remainders are 0. The final result of IGC is shown in Figure 7(c). More refined segmentation results are shown in Figure 8. They have the same slice number with the rough segmentation results in Figure 5.

### D. Post-processing

Some segmentation results of IGC and SKFCM have rough boundaries. To achieve a smoother contour of kidney, a post-processing method based on morphological operations is needed. The most common morphological operations are dilation and erosion.