# Autonomous Prostate Segmentation in 2D B-Mode Ultrasound Images
## 6 Results  
The input dataset used to create the probabilistic prostate contour model was a series of contours exported from Variseed (Varian Medical Systems Inc., Palo Alto, CA, USA) after preplanning for clinical prostate brachytherapy (approval for study granted from Alberta Cancer Research Ethics Committee under reference 25837). For this work, the prostate segmentation algorithm was tested on the clinical ultrasound images collected from nine patients during a prostate brachytherapy procedure. The ultrasound images were taken using a B&K Medical Pro Focus 2202 ultrasound machine with a B&K Medical Type 8808 Biplane Transducer (B&K Medical Systems, Peabody, MA, USA). The image processing, model fitting, and graph-cut algorithms were all programmed or implemented in Matlab 2018a (The Mathworks Inc., Natwick, MA, USA) and run using the Simulink Real-Time environment, on an Intel Core i7-3930K running at 3.20 GHz (Intel Corporation, Santa Clara, CA, USA). The mean absolute difference (MAD), max absolute difference (MaxD), segmented prostate volume, Jaccard index, and prostate contour width-height are used to compare the 3D contour volumes returned by algorithm, \(R(\theta,i|\beta_{A})\), to the target clinician segmented 3D contours, \(R(\theta,i|\beta_{C})\), to evaluate the effectiveness and accuracy of the algorithm. The mean absolute difference (MAD) and max absolute difference (MaxD) are commonly used performance metrics in the literature which provide a measure of how closely the component 2D algorithm and clinician segmented contours match across all slices in the 3D contour. The difference between corresponding points, with the same \(i\) and \(\theta\) values, on the algorithm segmented contour and clinician segmented contours are given by  
\[D_{CA}(i,\theta)=\sqrt{\left(\,{}^{P}x_{C}(i,\theta)-\,{}^{P}x_{A}(i,\theta) \right)^{2}+\left(\,{}^{P}y_{C}(i,\theta)-\,{}^{P}y_{A}(i,\theta)\right)^{2}} \tag{56}\]  
Figure 11: Segmented prostate contours in TRUS image slice from our proposed algorithm, \(R(\theta,i|\beta_{A})\), shown as solid green line and compared with input clinician-segmented contour, \(R(\theta,i|\beta_{C})\), indicated with dashed blue line. where \(\{\,{}^{P}x_{C}(i,\theta),\,{}^{P}y_{C}(i,\theta)\}\) and \(\{\,{}^{P}x_{A}(i,\theta)\,{}^{P}y_{A}(i,\theta)\}\) are the corresponding points between the algorithm and clinician contours in Cartesian coordinates, respectively, where the Cartesian coordinates are found from (3). A set of \(\theta_{j}\) points sampled at regular intervals in the range \((-\pi,\pi]\), where \(theta_{j}=-\pi+2\pi\frac{j}{n_{\theta}-1}\), is used for calculating the MAD and MaxD values; the value \(n_{\theta}\) is the number of points to be compared (\(n_{\theta}=90\) for the presented results). The mean absolute difference and max absolute difference metrics are given by  
\[\mathrm{MAD}=\frac{1}{nSlice\times n_{\theta}}\sum_{i}\sum_{j}\left|D(i, \theta_{j})\right| \tag{57}\]  
\[\mathrm{MaxD}=\max\left|D(i,\theta_{j})\right|\,\forall\{i,j\}\]  
where \(i=\{0,1,...,nSlice\}\) and \(j=\{0,1,...,n_{\theta}\}\). The height and width of the prostate contour, measured in mm in the ultrasound image frame \(\,{}^{U}y\) and \(\,{}^{U}x\) axes, are found from the height and width of a bounding box containing the prostate contour; see Figure 12. The average width and height of the algorithmic and clinician segmented prostate contours, with respect to image depth, are presented in Figure 13. For measuring the area and volume of the prostate, a polygon is fit to points on the prostate contour model \(R(\theta,i|\boldsymbol{\beta}_{A})\) or clinician-segmented contour \(R(\theta,i|\boldsymbol{\beta}_{C})\) for each slice \(i\), as shown in Figure 12, with the resulting polygon areas, \(Area_{A}(i)\) and \(Area_{C}(i)\) for the algorithmic and clinician contours respectively, calculated in metric units (mm\(\,{}^{2}\)).