# Focal Dice Loss-Based V-Net for Liver Segments Classification
## 2 Materials and Methods
### Post-Processing  
The post-processing consisted of two phases: in the first, we retained only the largest connected component for each segment; in the second, we eliminated all segments' inconsistencies, i.e., we avoided the presence, on the same axial slice, of inconsistent segments (from an anatomical perspective). To introduce this concept, we realized the inconsistency matrix reported in Table 2.  
This table was inspired by the liver anatomy. Considering only slices on the axial plane, we can divide the liver into three regions: (1) above the left branch of the portal vein, (2) below the right branch of the portal vein, and (3) between the two branches. For each region, as it is possible to see from Figure 4, the allowed segments are:  
1. Segments II, IV, VII, and VIII;
2. Segments III, IV, V, and VI;
3. Segments III, IV, VII, and VIII.  
Figure 3: Left: values of \(FDL^{W}\) as a function of the Dice coefficient varying \(\gamma\). Center: values of \(FDL^{A}\) as a function of the Dice loss. Right: values of \(p_{i}\) varying \(\gamma\) in the \(FDL^{B}\) formulation.  
From these observations, we derived these substitution rules:  
* Left Branch (LB): above the LB, all the voxels classified as Segment III are relabeled as Segment II; below the LB, all the voxels classified as Segment II are relabeled as Segment III;
* Right Branch (RB):
* Above the RB, all the voxels classified as Segment V are relabeled as Segment VIII, and below the RB, Segment VIII labels are reassigned to Segment V;
* Above the RB, all the voxels classified as Segment VI are relabeled as Segment VII; below the RB, all the voxels classified as Segment VII are relabeled as Segment VI.  
In order to define and localize in the CT volume the two aforementioned branches, i.e., the LB and RB, of the portal vein, we implemented a majority criterion based on the classification of the voxels. The first slice where the sum of the counts of the voxels belonging to Segments III, IV, V, and VI was less than the sum of the counts of the remaining voxels in the first slice above the RB.  
Similarly, the first slice where the sum of the counts of the voxels from Segments II, IV, VII, and VIII was higher than the sum of the counts of the remaining voxels in the first slice above the LB.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Segment** & **I** & **II** & **III** & **IV** & **V** & **VI** & **VII** & **VII** \\ \hline
**I** & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline
**II** & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 1 \\ \hline
**III** & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline
**IV** & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline
**V** & 1 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ \hline
**VI** & 1 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ \hline
**VII** & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 1 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Segments’ inconsistency table. If the presence of the pair of segments in the same axial slice is possible, we inserted a “1” into the matrix, otherwise a “0”.  
Figure 4: Liver segments’ anatomy. Data generated by the Database Center for Life Science (DBCLS) [[https://dbcls.rois.ac.jp/index-en.html](https://dbcls.rois.ac.jp/index-en.html)]([https://dbcls.rois.ac.jp/index-en.html](https://dbcls.rois.ac.jp/index-en.html)), last accessed: 17 January 2022; data provided by BodyParts3D [[https://lifescienced.jp/bp3d/?lng=en](https://lifescienced.jp/bp3d/?lng=en)]([https://lifescienced.jp/bp3d/?lng=en](https://lifescienced.jp/bp3d/?lng=en)), last accessed: 17 January 2022 [61].