## 2 Materials and Methods
### Proposed Solution  
The biopsy navigation system scheme is presented on Figure 1. In a first step, a patient diagnostic scan is obtained using CT or MR imaging and saved in DICOM file format. The data are 3D-reconstructed, rendered on a work station using CarnaLife Holo technology [26], and visualized on a HoloLens 2 headset. The HMD is equipped with a set of sensors and cameras which are accessible by Research Mode [34]. This enables the possibility of capturing physical objects and mapping them into holographic space. Devices share data with each other within a local network. The visualized data are superimposed onto the patient's body while preserving the real dimensions of the scan. The operator selects a desired optimal trajectory along which to perform the injection. To ensure injection precision and certainty, we have devised a needle tracking module. This module guides the operator to align the needle with the designated trajectory line as closely as possible. The needle tracking method is presented in Figure 2. It involves the acquisition of images through a Photo-Video (PV) camera and identification of the tool region using the YOLOv8 model [35] for instance segmentation as a first step, shown in Figure 2a and Figure 2b, respectively. As the needle itself is not well recognized by the model, it is trained only to segment the grabber part of a tool. Subsequently, the needle line is established through the application of edge detection and the Hough transform. The thresholds for the edge detection are adjusted using a Grey Wolf Optimizer metaheuristic algorithm [36]. A binary image displaying the detected edges is shown in Figure 2c. Figure 1: Biopsy navigation system scheme. The Hough transform is used for finding line segments in a set of points. It transforms every point coordinate in image space \((x,y)\) into a set of lines \((r,\theta)\) using parametric notation:  
\[x\cos\theta+y\sin\theta=r \tag{1}\]  
where \(r\) is the length of a normal from the origin to the line and \(\theta\) is te angle of the line with respect to the horizontal axis. Mapping all possible \((r,\theta)\) values for points given by \((x,y)\) in Cartesian image space results in curves (i.e., sinusoids) in Hough parameter space, as presented in Figure 2d. A set of two or more points that form a straight line will produce sinusoids crossing at a given \((r,\theta)\) for that line. The line is selected if the number of intersections of sinusoids is greater than the given threshold [37]. This results in a series of lines, as presented in Figure 2e. Among them, one line is chosen that best matches the segmented tool region and the motion of the previous positions. The final result of needle segmentation is presented in Figure 2f. To attain the 3D pose of the tool in holographic space, the segmented region of interest is aligned with a part of the point cloud obtained by the depth camera. The depth camera operates in two modes: Articulated Hand Tracking (AHAT), offering high-frequency (45 FPS) near-depth sensing up to 1 m, and Long-Throw, providing low-frequency (1-5 m) far-depth sensing. Due to the superior performance of the camera in AHAT mode and  
Figure 2: Steps for segmenting biopsy needle from image: (**a**) image captured by the PV camera; (**b**) segmented tool region; (**c**) detected edges; (**d**) Hough space; (**e**) detected lines; (**f**) chosen line belonging to the needle. the fact that the needle is in range of 30-60 cm from the operator, this mode was chosen. To achieve coordination between the PV and depth cameras, their respective coordinate systems were interconnected through a transformation process in order to align them with the world coordinate system of the headset.