# A Rectangular Toroidal Current-Based Approach for Lung Biopsy Needle Tracking
## 2 Materials and Methods
### System Calibration Algorithm  
The magnetic induction strength of the space magnetic field is positively correlated with the size of the excitation current of the electromagnetic transmitter plate and the size of the magnetic permeability in the vacuum. Due to an error in the hardware, in the process of practical application, the size of the signal current is not perfect with the theoretical value; the magnetic permeability of the air and the magnetic permeability of the vacuum are not identical, and there exists a certain proportionality relationship; at the same time, the error in the other hardware in the circuit is also transferred to the bit gesture solving process. At 70 kHz, the effect of eddy currents in biological tissues is negligible due to their relatively high resistivity compared to metal conductors. The magnitude of eddy currents depends on the material's conductivity, permeability, and the frequency of the applied field. While metals with high conductivity generate significant eddy current losses, biological tissues, such as muscle and fat, have conductivities ranging from 0.01 to 1 S/m, which are several orders of magnitude lower. At 70 kHz, the skin depth in biological tissues is several centimeters, allowing for the magnetic field to penetrate effectively with minimal attenuation or distortion. As the frequency increases, factors such as eddy currents and other losses become more significant. On the other hand, lower frequencies are susceptible to environmental interference and result in longer sampling times, which can compromise system efficiency. Therefore, the selection of 70 kHz optimizes the trade-off between minimizing eddy current effects and ensuring a reasonable sampling time, thus improving the overall computational efficiency of the electromagnetic tracking system. At the same time, other hardware errors in the circuit will also be transferred to the bit pose solution process, and these errors are uncontrollable and cannot be accurately obtained through analysis. To solve this problem, it is necessary to calibrate the system before the operation to obtain the calibration coefficients \(k_{i}\) for each transmitting coil of the electromagnetic transmitting board. The calibration process needs to be carried out individually for each transmitting coil by setting up some test points at known locations, using the nonlinear least squares method. It assumes that the measured value of the magnetic flux of the \(i\) transmitting coil at the \(j\) test point in the electromagnetic transmitting plate is \(B_{mosa}^{i}\), and at the same time, the theoretical flux of the \(i\) transmitting coil at the same point, which is derived according to the magnetic field model, is \(B_{calc}^{i}\). Then, the solution for the objective function to minimize the error between the two can be expressed as  
\[F_{i}(k_{i})=\sum_{j=i}^{m}\left(V_{mosa}^{i}\left(x_{j},y_{j},z_{j},\theta_{ j},\varphi_{j}\right)-k_{i}V_{calc}^{i}\left(x_{j},y_{j},z_{j},\theta_{j}, \varphi_{j}\right)\right)^{2} \tag{15}\]  
where \(k_{i}\) is the calibration coefficient of the \(i\) coil, \(F_{i}(k_{i})\) is the sum of errors corresponding to the \(i\) coil, \(mosa\) is the number of test points, and \(\left(x_{j},y_{j},z_{j},\theta_{j},\varphi_{j}\right)\) is the position parameter of the inductive coil at the point, which is minimized by iteratively iterating and correcting the value of \(k_{i}\) to make \(F_{i}(k_{i})\) reach the minimum value. Since the sensor cannot be completely fixed along the axial direction, there are a few errors in the \(z\)-axis direction.