# Autonomous Prostate Segmentation in 2D B-Mode Ultrasound Images
## 4 Superpixel Algorithm Incorporating Image Statistics
### Superpixel Algorithm Outline  
After both the pixel clusters and superpixel regions have been initialized, the algorithm will step through a series of update steps, such that large superpixel regions will be created. These update steps work to reduce the number of regions in an image by increasing the area (number of pixels) belonging to each region. Using the region layer and its associated graph, the algorithm works to decrease the number of regions by joining together statistically similar regions, returning a smaller number of larger regions each process iteration. This statistics-based approach creates regions from which edges and salient features can be found in a straightforward manner. Each update step can be broken into two sub-steps, the first of which works at the individual pixel level to determine which pixels belong to a particular cluster, acting to increase or decrease the size of the clusters with each step. The second sub-step controls the growth of the superpixel regions by increasing the number of clusters belonging to each region and grouping together pixel clusters to maximize region size. This region update step incorporates the region statistics to only group together regions which have comparable image statistics, thus separating regions which vary in average pixel intensity and standard deviation (or covariance) of pixel intensity. This statistical separation uses the premise developed in [32], where edge and corner features in a generic image have been shown to have distinct statistical properties from smooth features in the image. During the region update step, a hard limit is placed on how dissimilar two regions can be  
Figure 6: Pixel clusters, superpixel regions, and adjacency graph at initialization of superpixel algorithm, after five cluster update and region update iterations, and after the final update iteration. (**a**) Pixel clusters at algorithm initialization; (**b**) Superpixel regions at algorithm initialization; (**c**) Superpixel region adjacency graph at algorithm initialization; (**d**) Pixel clusters after 5 update iterations; (**e**) Superpixel regions after 5 update iterations; (**f**) Superpixel region adjacency graph after 5 update iterations; (**g**) Pixel clusters at termination of algorithm; (**h**) Superpixel regions at termination of algorithm; (**i**) Superpixel region adjacency graph at termination of algorithm. when joined together, with small regions being retained if they are distinct enough from neighbouring regions. The algorithm uses a few parameters which can be tuned to control how the pixel clusters and superpixel regions are modified during updating. The use of these parameters will be described in full in the text for the cluster update and region update sub-steps. One of the parameters of the algorithm is a weighting vector, \(\mathbf{\lambda}\), used to determine the goodness-of-fit for a particular pixel to a cluster and to limit region-to-region statistical similarity. The values within this vector are  
\[\mathbf{\lambda}=\big{[}\lambda_{\mu},\lambda_{L2},\lambda_{KS}\big{]}, \tag{35}\]  
with \(\lambda_{\mu}\) and \(\lambda_{L2}\) being used in the cluster update step to weight a distance function (score) between a pixel and nearby clusters. The value \(\lambda_{KS}\) will be described in the region update step and defines the limit on how dissimilar two regions must be before they cannot be merged. There are a few constraints on the output superpixels of the algorithm which will either be enforced by the algorithm or be checked at the end of each iteration to determine when the optimization is complete (to be discussed below). The desired size of the output superpixel regions is defined as \(r_{darea}\) with constraints on the minimum pixel cluster and region area, \(c_{min}\) and \(r_{min}\), respectively.