## 2 Materials and Methods
Lesions were identified and segmented in the preMRI and pre-resectional ultrasound using the smart brush tool element (Brainlab, Munich, Germany) in the navigational software, which automatically calculates the tumor volume. The 3D datasets were exported to MeVisLab (MeVis Medical Solutions AG, Bremen, Germany) for further calculations. To assess similarity of the objects, the Dice coefficient [36] and the Hausdorff distances were computed. Figure 1: (**a**) Live view of precalibrated ultrasound just before image acquisition. The yellow lines indicate the tumor boundaries segmented in preMRI, depicting a spatial deviation. (**b**) Simultaneous visualization of preMRI and corresponding i3D US slices. Segmented tumor objects are displayed in yellow (preMRI) and orange (i3D US). (**c**) During surgery preMRI and i3D US datasets were acquired during different surgical steps (1 st row preMRI, 2 nd row before dual opening, and 3 rd row after tumor resection) are displayed in an overlay fashion. Yellow lines indicate the preMRI tumor segmentation. The Dice coefficient (C\({}_{\text{DSC}}\)) is a spatial overlap index that can be used for comparing segmented objects [37; 38] and is calculated as  
\[C_{Dsc}=\frac{2\left|A_{US}\cap B_{MR}\right|}{\left|A_{US}\right|+\left|B_{MR} \right|}\]  
where \(A_{US}\) and \(B_{MR}\) are number of voxels of the segmented objects. The Dice coefficient is restricted to values between 0 and 1, with a value of 0 indicating no overlap and a value of 1 representing an exact match [38]. The Hausdorff distance measures the extent to which each voxel of one segmentation lies near to some voxel of the other segmentation, and vice versa [39]. The calculated distance can be used to measure the degree of resemblance of the object contours [38; 39]. The formula is defined as  
\[H(A_{US},\ B_{MR})=\max\{d_{max}(A_{US},\ B_{MR}),d_{max}(B_{MR},A_{US})\}\]  
with \(d_{max}=\max\limits_{a\in A_{US}}\min\limits_{b\in B_{MR}}\left\|a-b\right\|\)[38; 39]. The Hausdorff distance is measured in mm; it is a small distance indicating a good resemblance of the segmented objects [38]. Furthermore, the geometric centers of gravity (CoG) were calculated, which have the advantage of being invariant under rotation, scaling and skewing, and a stable measurement even under random noise [40]. The CoG has been used for measuring the displacement of objects in different MRI sequences before [41]. Put simply, the geometric center of gravity is calculated by summing up the coordinates of voxels, divided by the number of voxels:  
\[CoG_{US}=\ \frac{1}{\left|A_{US}\right|}\ \times\ \sum\
olimits_{aa\in A_{US}}a\ \text{and}\ CoG_{MR}=\ \frac{1}{\left|B_{MR}\right|}\ \times\ \sum\
olimits_{ab\in B_{MR}}b\]  
The displacement is calculated by subtraction of the geometric centers of gravity, expressed as Euclidean distance. For statistical analysis GrapPad Prism 8.4.3 (GrapPad Software, San Diego, CA, USA) for MacOS was used. If necessary, testing for normal distribution was performed using the D'Agostino and Pearson test. For the analysis of not normally distributed data either the two-tailed Mann-Whitney test (un-paired) or the Wilcoxon matched-pairs signed rank test (paired data) were used. A \(p\)-value \(<\) 0.05 was considered statistically significant.