# 5.3. Pivot calibration¶

Pivot calibration is the transformation between a tracked marker/sensor and the tip of a tool (e.g., pointer). This process consists in rotating the tracked instrument on a stationary point in order to localise the 3D position of the instrument’s tip. There are several ways to perform the pivot calibration, mainly: sphere fitting, algebraic one step, and algebraic two steps. All these methods solve exactly the same problem but taking the transformation in a different order. A review can be found here: [Yaniv2015]. Yaniv et al. concluded that algebraic formulations were more precise and more accurate than sphere fitting, but Ma et al. found that sphere fitting was superior when data was good and algebraic methods degrade less when data is bad [Ma2017].

## 5.3.1. Sphere fitting¶

The sphere fitting method assumes that the tracked sensor/marker forms a sphere while is rotated (see figure below), where the marker is at the surface of the sphere and the tip of the tracked tool at the centre of the sphere (pivoting point).

The equation of a sphere with origin at point (x0, y0, z0), a point (x,y,z) on the surface and a radius r has the following equation:

If we expand this equation we get:

which in turn is equivalent to:

Considering that we will have a list of n surface points, this can be written in a least-squares form f=AC:

Where

This can be easily solved using Python or MATLAB functions, among others libraries. For example, SciKit-Surgery implements Pivot Calibration using the above spherical method, an algebraic one-step, and also using RANSAC to reduce outliers.

In the following video Dr. Clarkson explains and demonstrates how to do a pivot calibration:

## 5.3.2. Errors¶

The accuracy of this method depends on the shape of the tip of the tool, the length of the tool and the noise on the pivoting data. When pivoting the tool on a stationary point on a flat surface, if the tip is not sharp enough(which very often is not sharp to avoid tissue damage) may lead to inaccuracies on the measurements. One solutions is to use a soft surface to pivot the tool, however by doing that, the tip will be at the centre of the rotation instead of exactly at the tip.