The Measurement Accuracy of Ball Bearing Center in Portal Images Using an Intensity-Weighted Centroid Method

Medical linac based imaging modalities such as portal imaging can be utilized for highly accurate measurements. An intensity-weighted centroid method for determining object center is proposed that can detect the position of small object at subpixel accuracy. The principles and algorithms of the intensity-weighted centroid method are presented. Analytical results are derived for positional accuracy of a rod and a sphere in digital images, and the theoretical accuracy limits are calculated. The method was experimentally examined using phantoms with embedded ball bearings (BBs). Images of the phantoms were taken by the MV portal imager of a medical linac. The image pixel size was 0.26 mm when projected at the linac isocenter plane. The BB coordinates were calculated by applying the intensity-weighted centroid method after removing the background. The reproducibility of BB position detection was measured with 3 monitor unit (MU) exposures at various dose rates. A stationary BB, of 0.25 image contrast, showed position reproducibility in the range of 0.004 0.013 mm. When the method was used to measure the displacement of a moving BB, the difference between the measured and expected BB position had a standard deviation of 0.006 mm. The effect of image noise on the BB detection accuracy was measured using a phantom with multiple BBs. The overall detection accuracy, represented by standard deviation, steadily improved from 0.13 mm at 0.03 MU to 0.008 mm at 5.0 MU, and showed an inverse correlation with contrast-to-noise ratio. We demonstrated that intensity-weighted centroid method can achieve subpixel accuracy in position detection. With a linac based imaging system, precise mechanical measurement with accuracy of microns could be achieved.


Introduction
New radiotherapy delivery modalities, especially stereotactic radiosurgery, increasingly demand better mechanical accuracy of medical linear accelerators (linacs) and imaging devices [1]. The Winston-Lutz test, introduced in 1988 [2], has become the de facto standard for high-precision mechanical measurements. In fact, phantoms with built-in ball bearings (BBs) are now commonly used in radiology and radiation oncology for quality assurance and mechanical calibration [3]- [9]. During these procedures, the phantoms are imaged using the portal imager (MV therapy beam) or kV imager attached to the linac gantry (e.g., On-Board Imager). The BB center position in the image is then measured and analyzed, either with manual techniques or on-board or third party software. Clearly, the ultimate results of the quality assurance and calibration done in this way depend upon the accuracy with which the BB position is measured on the images. The purpose of this study was to determine both the theoretical and practical accuracy with which a given linac imaging system can detect the position of BBs in a phantom.
An imaging system generates digital images of known pixel size. In general, the image of a BB is brighter or darker than the surrounding lower-density materials depending on how the image is displayed. There are different approaches to determine the location of the BB center [4] [10] [11]. For example, well-defined radiation fields can be detected by applying threshold methods to image histograms. Dong et al. [12] applied threshold detection as a first step in computing the center of mass of a reference radiation field applied to tungsten ball phantoms.
In this study, we propose using an intensity-weighted centroid of a BB to represent its center on the image. This approach will allow us to determine the theoretical limit of a perfect imaging system. The central principles of this approach were proposed a few years ago and applied to an animal study published in 2008 [13]. These principles are further elaborated in this manuscript, supported by experimental imaging data that demonstrate the practical limit in clinically relevant scenarios.
Subpixel detection accuracy has been demonstrated by other investigators. Du et al. [14] reported an approach based on a Hough transform algorithm applied to prior knowledge of field shapes. They reported that the method could detect the centers of circular fields with an absolute error of 0.037 ± 0.019 pixels. While the Hough transform technique has advantages, such as insensitivity to image noise and image discontinuities, an intensity-weighted centroid method is still desirable in many respects. The centroid method requires no prior knowledge of shape and can be readily implemented.
In this technical note, we will show that: (1) The measurement accuracy of a BB center is subpixel or a small fraction of the pixel size, and this accuracy can be derived analytically for ideal situations; and (2) In clinically realistic situations, the localization accuracy can be measured through multiple images of the same phantom containing two or more BBs. This study was motivated by the aforementioned application studies where high-accuracy measurements are demanded. For instance, if the measurements require submillimeter accuracy, the "ruler" (measuring device) should have a resolution on the order of 0.1 mm or lower in order to achieve a reliable result. When the combination of portal imager and BB is used, the accuracy requirement translates into subpixel level. Since image quality could influence measurement accuracy, we also studied the effects of reduced image quality on the intensity-weighted centroid approach. In this way we derive the practical limit of measurement accuracy of current technologies used in radiation oncology clinics.

Intensity-Weighted Centroid in Digital Image
In the physical space, an object may be located by its centroid This definition is readily applied to images where the function ( ) , , x y z ρ expresses the intensity of a 3-dimensional image.
In an ideal noiseless, zero-background image, voxel size is infinitesimal and the image of an object is congruent regardless of its position and orientation. Thus the centroid of the object image can be accurately calculated with Equation (1). In reality, voxels of a digital image have finite dimensions and the image intensity is a stepwise function of spatial coordinates. To simplify the mathematical expressions to follow, let a voxel be a unit cube with coordinates ( ) , , i j k x y z at the center. Because the image is now digitized, the x-coordinate, for example, of the centroid of the imaged object can be calculated with the following equation: It follows that the x-coordinate is independent of the image intensity distribution on y-z plane, therefore the 3dimensional (hereafter 3-D, and similarly 2-D and 1-D) problem is reduced to 1-D problem. Similar arguments apply to the y and z coordinates. By Equation (1), in an ideal 1-D image the actual centroid of an object is Once the image is digitized, from Equation (2) the measured centroid of the object is When utilized in a 2-D image, which is the scenario to be investigated in this project, Equation (2) Example analytical solutions for the detection accuracy of simple-geometry objects are given in the Results.

Acquisition of Test Images
The intensity-weighted centroid method was tested using BB phantoms on a True Beam STx linac system (Varian Medical Systems, Palo Alto, CA). High resolution single exposure images were used throughout the measurements. The imaging panel has 0.39 mm pixel size and the default source to image distance (SID) was 150 cm. When projected to the linac isocenter plane, the pixel size is 0.26 mm, which will be regarded as the default pixel size thereafter. Three types of measurements were performed with the MV portal imager. Firstly, to test the reproducibility of the BB position measurement, a BrainLab ball bearing phantom (i.e., the phantom pointer, BrainLab AG, Feldkirchen, Germany) was placed at the linac isocenter position. The phantom has a single BB of 5-mm diameter that is normally used for the Winston-Lutz test. The linac gantry was rotated to 90˚, because we assumed that at this gantry angle the linac and imager system is more prone to mechanical instability such as vibrations. The linac system and the BB phantom remained untouched during the imaging study. Three (3) monitor units (MUs) were delivered for each image, with the linac jaws set at 10 cm × 10 cm. The images were taken at various dose rates, from 5 to 600 MU/min, in an attempt to reflect the low-frequency mechanical instability. A series of 20 images were taken at each dose rate.
Secondly, to verify the measured BB displacement versus known values, MV images were taken for the phantom pointer when it was translated by predefined distances. The imaging protocol and machine settings were identical to the above step. The BB was moved by a micrometer upwards by 0.01 mm each step for a total distance over two pixels. A series of images were taken for the BB after each step in order to examine the resolution of BB center measurement in clinically realistic operations of a given linac system.
Lastly, to evaluate the BB position accuracy versus image noise, MV images were taken for an IsoCal phantom (Varian Medical Systems). The IsoCal phantom is equipped for imager geometric calibration [9]. The phantom has 16 BBs of 4-mm diameter embedded in a hollow cylinder. It was positioned with laser alignment at the linac isocenter. During the imaging process, the gantry, collimator, and table angles remained at zero, and the table was shifted in the horizontal plane to 20 random positions. A 20 cm × 20 cm field was used to take MV images of the phantom. At each position, eight images were taken with 0.03, 0.05, 0.1, 0.3, 0.5, 1.0, 3.0, and 5.0 MUs. The purpose of this step was to measure the detection accuracy of the BBs in a linac MV imaging system and to study the effects of image noise on the accuracy of centroid computation. The theory behind this method is elaborated in the Appendix. An ionization chamber was used to verify the linearity of imaging MUs.

Image Processing and Data Analysis
The images derived as described in the above section were processed using MatLab (The Math Works, Inc.). ImageJ (http://imagej.nih.gov/ij/) was used to manually verify part of the results. Image processing took the following essential steps, as shown in Figure 1. Noise was first removed via a 2-D adaptive Wiener estimation method [15]. For exceptionally noisy images a larger rectangle and subsequent median filtering were used. Morphological reconstruction was used to find a preliminary estimate of the background. Removing this background gave a preliminary image of the BBs. This image was then used to construct a mask covering the BBs using Otsu's method [16] to determine an appropriate grayscale threshold. Artifacts were removed from this mask by removing connected components with low intensity areas and those connected to the image border. This mask was then used to remove the BBs from the noise-removed image. The background was estimated again by morphologically opening the masked image and removed from the original image. The mask was then used to remove the remainder of the image, resulting in a "net image" of the BB (Figure 2). The coordinates of the BB were computed using a MatLab intensity-weighted centroid function.
Image contrast was quantified by taking the average of nine central pixels of the BB image and comparing to nearby background readings. The reported contrast-to-noise ratio (CNR) was calculated with a randomly selected image from each series. A reference noise level was obtained by a rectangular region of interest near the BB projection.
In order to evaluate the absolute BB position accuracy, we propose using the standard deviation of the measured distance between two BBs [13]. As shown in the Appendix section A.1, the relationship between the standard deviation of the measured BB distance and that of the individual coordinates is   To satisfy the conditions of Equation (5), the BBs must be located on a plane parallel to the imager, so that the BB projections maintain a theoretically constant distance in the images. Two such BBs were chosen on the IsoCal phantom.

Analytical Solutions for the Detection Accuracy
In this section we will firstly derive the detection accuracy of a linear rod that aligns with an array of pixels, thus the rod is considered a 1-D object. We assume an ideal situation where the background intensity is zero and the image noise can be ignored. We use i x to denote the center of the i th pixel. For convenience and simplicity, the pixel size is set to a unit length.
Suppose that the intensity function ( ) x ρ of a rod is uniform along its long axis. Assume also that in an image the rod covers n (>1) pixels, stretching from 1 x a − to n x b + (note that when pixel size is 1, where parameters a and b are within (−1/2, 1/2) in the unit of pixel size. It is easy to see that the actual centroid of the object is From Equation (4), the centroid measured from the digitized image is ( ) ( ) ( ) The error in rod centroid measurement is then It can be derived from Equation (8) that, the theoretical upper limit of measurement error for a uniform-intensity object is ( ) 1 4 2 1 n − pixels. As a matter of fact, Du et al. [14] presented the special case where a short 1-D object occupies 2 pixels, showing that the object center is still detected with subpixel accuracy. Having derived the localization accuracy for a 1-D rod under ideal conditions, i.e., on an image without noise, distortion, and beam divergence, we will tackle the more difficult case of the theoretical detection accuracy of a uniform sphere (such as a BB) in a 2-D image. To simplify the formula, we use an approximation of linear attenuation, so that the intensity function of the sphere's image has the form of ( ) over the range that the BB extends, after an integration with respect to y. Assume that the BB has a diameter of n pixels, and the reference position is when it extends from the center of pixel 1 x to the center of pixel This error is measured in the unit of pixel size. As predicted by the above formula, the theoretical error of the BB center measured using the intensity-weighted centroid reaches a maximum when 1 12 δ = ± pixels. The maximum error of BB center is 2 1 6 3n and numerically calculated for five different diameters. The results are listed in Table 1.
The BBs used in quality assurance usually have diameters of a few millimeters, extending roughly 10 to 20 pixels in a typical portal image. Thus, given the assumptions we made above, the BB positions in a phantom can be determined with a high precision using the intensity-weighted centroid method.

BB Position Reproducibility
Clearly, reproducibility also plays a role in determining the measurement accuracy of the method expounded in this manuscript. To systematically examine BB position reproducibility, a series of images were taken by varying exposure time. The results are presented in Table 2.
Initially, it was assumed that longer exposures would have the tendency to average out possible mechanical vibrations in the measurement system, whereas a shorter exposure would be representative, or at least could be assumed to contain, such errors. The imaging system was demonstrated to be quite stable however, for all exposure times studied, and in the worst case yielded an uncertainty smaller than 0.02 mm. The uncertainties seem to be inversely correlated with the CNR. That different dose rates result in various CNRs might be caused by nonlinear and different detector responses. However, this needs further research and is beyond the scope of the present study. Figure 3 shows the measured BB displacement as a function of expected displacement given by the micrometer, with a standard deviation of 0.006 mm for the discrepancies. The linearity of Figure 3 (R 2 = 0.999) indicates that the intensity-based centroid measurement of BB center is highly accurate for fine submillimeter displacements. Combined with the reproducibility demonstrated in the above section, these results are encouraging as the lower limit of detectability approaches 0.01 mm for the clinical imaging system utilized in this study. This is an improvement to the Varian center detection function built in to the clinical imaging applications that yields a resolution of 0.1 mm. Furthermore, the system tracks the actual displacement well over a range of 2 pixels. Table 1. The theoretical maximum error in ball bearing center measurement using intensity-weighted centroid method on digital images. The unit is pixel size.  Table 2. BB position reproducibility. Images were acquired with 3 MU each at varying dose rates. Vertical and longitudical coordinates are denoted with x and y. CNR is contrast-to-noise ratio.

BB Position Accuracy versus Noise
The  Figure 4. Linear regression reveals a correlation coefficient of 0.999. Important to the intensity-based method articulated in this manuscript is an understanding of how image noise could influence the measurement of BB position. We systematically varied the MU per image in order to study the impact on measured position. As Table 3 shows, increasing the image noise (decreasing CNR) does negatively affect the resultant measure of BB position accuracy (Figure 5). In the table, d stands for the distance between two selected BB projections; d σ is regarded as the overall accuracy of BB centroid measurement (see the Appendix); and , x y σ stands for the accuracy of the individual coordinates. Even at 0.03 MU, however, the lowest MU deliverable, the error is still around 0.1 mm, well within clinically meaningful tolerances.

Discussion
The intensity-weighted centroid method described in this manuscript can achieve subpixel accuracy in detecting the position of an object in digital image. The methodology is straightforward to understand and implement. When applied to a commercial linac-based imaging system, a system with non-uniform background, noise, non-parallel X-rays, scatters, and possible mechanical instabilities, such as the one used in this study, positional measurements can be as precise as a few microns. This represents an improvement over the resolution, 0.1 mm, of the current vendor's detection of circular objects and creates an opportunity to utilize this method for linac mechanical accuracy measurements [17].
One advantage of this approach is that the methodology is not restricted by marker shape. Although the experiments in this study were carried out with phantoms containing spherical BBs, which have the most convenient shape and are commonly found in the clinic, this need not be the case. There might be situations in which a cuboid or other special marker shape is appropriate for imaging and detection. The centroid method could accommodate such cases without modification whereas the recently reported Hough-transform algorithm would require prior knowledge of imaged shape. Additionally, the accuracy of Hough-transform could be affected by the size of the available pixels. However, the Hough-transform approach was robust against image noise and artifacts. While this could be one downside of the intensity-weighted centroid method, our results indicate that the method performs very well with systematically varying image noise. Even when contrast-to-noise ratio decreased by a factor of 10, the uncertainty in the measured BB position still remained within clinical tolerance. At clinically utilized MUs for portal imaging, usually on the order of 2 -3 MU/image, the detection uncertainty was much less and on the order of tens of microns.
Furthermore, it does not appear that mechanical instabilities in the imaging system influence measurement   reproducibility. Comparing short and long exposure times, from 0.3 sec to 36 sec, although the uncertainty in the measurement changes by a factor of 2, in the worst case it is still on the order of tens of microns.

Conclusion
We have proposed an intensity-based centroid method to detect the position of an object in a digital image. When applied with a clinical, linac-based imaging system, the methodology produces an accuracy on the order of a few microns. This scheme is straightforward to implement, has high reproducibility, and is robust to image noise as measured by severely reduced imaging MUs. This level of subpixel accuracy exceeds that required for most clinical utilization.
A new principle is applied in the present study to evaluate the centroid detection precision of an object, which is observing the distance between two such objects measured from consecutive images. These images should be taken for objects of fixed distance at varying locations otherwise without moving, the measurement result would merely be the imaging reproducibility. For generalization, the following derivation is for 3-D images. Under the assumption that two objects are placed apart by distance d, and in image number m their real centroid coordinates are ( ) Equation (A1) allows for relative motion among images because the coordinate offsets are cancelled by the subtraction. When the errors in centroid coordinates are taken into account, the measured distance has an error relative to its real value. This error in distance can be derived through Taylor expansion: