# Tip Estimation Method in Phantoms for Curved Needle Using 2D Transverse Ultrasound Images
## 2 Materials and Methods
### Needle Detection  
Needle detection is mainly for identifying the cross-section of the needle in the US images by using the binary method and the histogram method. As the ultrasound is quite sensitive to the metal, the needle-inside area can be brighter than others. A binary method [26] is first used to select ROI in  
Figure 3: The pipeline of curved needle tip estimation. As the ROI configuration finished, needle tracking with needle detection begins step by step. Part A shows the needle tracking by KF, while Part B shows the needle detection to locate the needle tip. Part C shows the shape construction and tip estimation.  
the first image and then a histogram method is used to locate the needle despite the US shadows and poor reflection.  
Binary method intends to strengthen the contrast of brightness to highlight the brighter area to select them. This method is used for the initialization which supposes to find the candidates in the first image. It includes intensity normalization, background reinforcement, and brightness enhancement. The center of the area is the location of the needle. During the experiment, a histogram method is proposed to find the needle accurately. The histogram method contains intensity normalization and background reinforcement. The histogram method tends to find an area of high-intensity pixels, which intends to find the upper face of the needle and then locate the needle based on the diameter. The background reinforcement part can be described as follows:  
\[\begin{array}{ll}\min&I_{t}\\ \text{s.t.}&\sum_{I_{t}}^{255}n_{I_{j}}\leq M\delta\\ &I_{t}\in[0,255]\end{array} \tag{1}\]  
where \(I_{j}\) is the gray level of the pixel and \(n_{I_{j}}\) is the number of pixels which have the gray level of \(I_{j}\). \(M\) is the size of ROI, and \(\delta\) is the manually selected parameter to limit the bright pixels. In this work, \(M\) is a square of \(45\times 45\), and \(\delta\) is set to 0.08 based on empirical tests.  
There are two unexpected situations that may affect the position accuracy, namely the comet tail and the poor reflection. The comet tail will affect the size of the needle area and usually lead to a larger area than the actual size (Figure 4a). On the contrary, the poor reflection makes the needle area look much smaller in the image (Figure 4b). Therefore, the accurate location should be intended to eliminate the effect of shadows and poor reflection. In Figure 4, there are two examples which are used the two methods relatively. As the example shown in Figure 4a, the noise (yellow circle in the histogram of ROI) may probably be concerned as the needle while the needle is just concerned about a few pixels (red circle in histogram of ROI). The two methods can both filter the noise and locate the needle correctly. However, in ROI configuration (shown in Figure 3), the histogram method intends to find more candidates than the binary method, since the former focuses on the higher intensity pixels while the latter focuses on the area and intensity. Therefore, the binary method is more feasible in ROI configuration.  
However, in the case of poor reflection, the needle displays a little in the image, and the area of the needle is smaller than the expected. Because the needle would reflect as long as the image gain is high enough or the sound power is big enough, it would reveal apparently compared to its surroundings. An example of the histogram of ROI is shown in Figure 4b, the red circle represents the upper surface of the needle. Moreover, the ROI square is darker than the one in Figure 4a, while the settings of the ultrasound are the same in Figure 4. From the figure, the histogram method seems to be more accurate than the binary method. In fact, the error of two methods, in this case, is 0.34 mm with 1.2 mm diameter of the needle. It is not that obvious to judge the accuracy. In this study, we use the histogram method during the experiment.