# 3D Liver and Tumor Segmentation with CNNs Based on Region and Distance Metrics
## 2 Materials and Methods
### Related Work
In addition, boundary loss also provided complementary data to those of regional loss. A symmetric \(L2\) distance (Euclidean distance) on the space of shapes (or contours) was expressed as a regional integral, which avoids completely local differential computations involving contour points. The non-symmetric \(L2\) loss function for regularizing segmentation mask S's boundary deviation compared with the ground truth G is written as follows:  
\[Dist(p,g)=\int_{G}||p_{i}-g_{i}||^{2}dg \tag{8}\]In the formula, on the ground-truth boundary \(G\), the boundary point \(g_{i}\) is aligned based on the counterpart \(p_{i}\) that is located on \(P\) (the prediction boundary). The boundary loss function was used to segment the Magnetic Resonance (MR) images of the brain lesion in [30], and the Dice and Hausdorff score increased by 8% and 10%, respectively, relative to the baseline levels in which the generalized Dice was utilized to be the loss function [30]. * Hausdorff Loss  
In [31], [PERSON] et al. put forward a loss function based on the direct HD reduction for training the CNN-based segmentation algorithms. They proposed three approaches for estimating the HD based on the map of segmentation probability. One method was to use a distance transform splitting of the boundary. The second approach was developed on the basis of the use of morphological erosion to those differences in the real segmentation maps compared with estimated counterparts. The last approach was to employ spherical convolution kernels with diverse radii to the map of the segmentation probability. According to the above three approaches proposed to estimate HD, three loss functions were also put forward in training for the sake of HD reduction. [PERSON] et al. had optimized the function on the basis of the Hausdorff distance to compare the estimated segmentation with the ground truth one, which is shown below. \[f_{HD}(p,g)=Loss(p,g)+\lambda\left(1-\frac{2\sum_{\Omega}(p\circ g)}{(p^{2}+g)}\right) \tag{9}\]  
In the formula, the second term is the Dice loss function, whereas the first one is the Hausdorff distance of \(p\) and \(g\). Parameter \(\lambda\) is the ratio of the HD-based loss term to the Dice loss term. Let \(\Omega\) denote the grid on which the image I is defined, and \(p\) and \(g\) denote the segmentation and ground truth, respectively. The predicted and ground truth segmentation, separately:  
\[Loss(p,g)=\frac{1}{|\Omega|}\sum_{\Omega}\left((p-g)^{2}\circ\left(d_{p}^{ \alpha}+d_{g}^{\alpha}\right)\right) \tag{10}\]  
Parameter \(\alpha\) determines the penalty level for a large error. \(d_{g}\) stands for the ground truth segmentation distance map, which represents an unsigned distance to the \(\delta g\) boundary. Similarly, represents the distance to \(\delta p\). Meanwhile, indicates the Hadamard operation. In this paper, the HD loss function was utilized for training the V-net model jointly with the regional loss function. * Signed Distance Map Loss  
[PERSON] et al. [32] put forward a novel algorithm for solving those existing problems in the current organ segmentation systems based on deep learning. These systems frequently generated results that were unable to obtain target organ shape, together with a lack of smoothness. The task of segmentation was converted into predictive SDM in their method, since there was a rigorous mapping between the SDM and the binary segmentation map. For the target organ, as well as a point \(x\) shown on the 3D medical image, \(y\) is the most adjacent point on the target organ surface, the SDM, which maps \(R\) to \(R^{3}\) can be deemed below:  
\[\Phi(x)=\left\{ \begin{array}{cc}0,&x\in S\\ -&\underset{y\in S}{inf}\ \left\|x-y\right\|_{2},&x\in\Omega_{in}\\ +&\underset{y\in S}{inf}\ \left\|x-y\right\|_{2},&x\in\Omega_{out}\end{array} \right. \tag{11}\]  
In the formula, \(S\) represented the target organ surface; \(\Omega_{in}\) together with \(\Omega_{out}\) denoted the target organ interior and exterior, separately.