## 2 Materials and Methods
### Image Fusion for Residual Brain Tumor Identification  
The approach to automatically identify tumor residuals based on iUS image data is depicted in (Figure 3). It consists of automatically segmenting target structures in the image data and then of optimally fusing them to keep only those that provide relevant information. The target structures, i.e., the residual tumors, are highlighted in both B-mode and CEUS modalities. Therefore, gray-level intensities were chosen as the feature for extracting tumor tissue. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Patient** & **Location** & **Side** & **Tumor Size in mL** \\ \hline
1 & frontotemporal & left & 45.3 \\
2 & temporal & right & 73.5 \\
3 & frontal & right & 11.5 \\
4 & temporal & left & 26.8 \\
5 & frontal & left & 14.7 \\
6 & temporal & left & 9.6 \\
7 & parietal & left & 24.4 \\
8 & frontal & left & 30.6 \\
9 & frontal & left & 11.5 \\
10 & frontal & right & 30.3 \\
11 & occipital & left & 55.6 \\
12 & frontal & left & 15.1 \\
13 & frontal & right & 43.6 \\
14 & frontal & right & 33.0 \\
15 & temporal & right & 33.4 \\
16 & frontal & right & 41.7 \\
17 & parieto-occipital & right & 46.9 \\
18 & frontal & left & 23.3 \\
19 & frontal & right & 72.2 \\
20 & parietal & left & 40.9 \\
21 & frontal & left & 1.5 \\
22 & frontal & left & 17.9 \\
23 & parieto-occipital & left & 22.9 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Brain tumor data from patients, such as: location, side and size of the tumor. A preprocessing stage was previously carried out by extracting foreground masks for both images (i.e., B-mode and CEUS). Given an image \(I(i,j,k)\) where the background contains voxels of value zero, the mask \(M\) is obtained as \(M=I(i,j,k)>0\). Then, erosion filters (with cubic/quadratic structuring elements of \(9\times 9\times 3\) and \(3\times 3\times 1\) for B-mode and CEUS, respectively) were applied on these masks. The multiplication of original images by the filtered masks was performed for removing artifacts located at the image's border and due to the contact of the ultrasound transducer with the brain surface. In a second step, high intensity structures in the iUS data were automatically extracted using the Otsu multilevel thresholding method [34; 35]. The Otsu method is one of the better and stable thresholding algorithms, which can be reliably applied on real images. Its uniformity results in bi-level thresholding allowing one to separate the objects and background by maximizing the between class variance [36]. Multilevel thresholding segments a level gray image into several distinct homogeneous regions by increasing the number \(N\) of estimated thresholds (\(T_{i}\)). The quantity of segmented classes is related to the number of estimated thresholds by \(N-1\). It should be noticed that \(N\) should have a moderate value in order that multi-thresholding algorithms could get reliable results. In the proposed implementation, \(N\) is not recommended to go higher than five; unfortunately, thresholding algorithms cannot automatically determine the number of thresholds [37], and the number of thresholds has to be fixed, focalizing the targeted regions. In the 3D iB-mode images the highlighted structures are mainly borders of the resection cavity including blood and possible tumor residuals, but also blood vessels, bone structures and artifacts. In the 3D iCEUS images, they mainly consist of tumor residuals and vascular structures. The number of classes for Otsu thresholding method was experimentally set to four and three for iB-mode and iCEUS, respectively. Additionally, the voxels classified in the highest intensity class were kept as the target (i.e., tumor remnant). Lastly, a post-processing stage based on the opening filter (with structuring element of \(3\times 3\times 1\)) was applied to reduce small false positive regions detected by the algorithm. The opening operation consists of an erosion followed by a dilation step, such that \(f\circ g=(f\ominus g)\oplus g\), where \(f\) is the image and \(g\) the structuring function.