The Mathematics of Four or More N-Localizers for Stereotactic Neurosurgery

The mathematics that were originally developed for the N-localizer apply to three N-localizers that produce three sets of fiducials in a tomographic image. Some applications of the N-localizer use four N-localizers that produce four sets of fiducials; however, the mathematics that apply to three sets of fiducials do not apply to four sets of fiducials. This article presents mathematics that apply to four or more sets of fiducials that all lie within one planar tomographic image. In addition, these mathematics are extended to apply to four or more fiducials that do not all lie within one planar tomographic image, as may be the case with magnetic resonance (MR) imaging where a volume is imaged instead of a series of planar tomographic images. Whether applied to a planar image or a volume image, the mathematics of four or more N-localizers provide a statistical measure of the quality of the image data that may be influenced by factors, such as the nonlinear distortion of MR images.


Introduction
The N-localizer is a device that may be attached to a stereotactic frame ( Figure 1) in order to facilitate image-guided neurosurgery and radiosurgery using tomographic images that are obtained via computed tomography (CT), magnetic resonance (MR) or positron emission tomography (PET) [1]. The mathematics of the N-localizer have been discussed previously [2]. The remainder of this Introduction will review the mathematics of three N-localizers in preparation for the presentation of the mathematics of four or more N-localizers in the Materials and Methods. 1

FIGURE 1: Three N-Localizers Attached to a Stereotactic Frame
Three N-localizers are attached to this stereotactic frame and are merged end-to-end such that only seven rods are present. The vertical rod at the right rear of the frame is larger in diameter than the other rods. This large rod facilitates unambiguous interpretation of the fiducial circles and ellipses that the seven rods create in a tomographic image, as explained in the legend to Figure 5.
The N-localizer comprises a diagonal rod that extends from the top of one vertical rod to the bottom of another vertical rod ( Figure 2). Assuming for the sake of simplicity that the two vertical rods are perpendicular to the tomographic section, the cross section of each vertical rod creates a fiducial circle and the cross section of the diagonal rod creates a fiducial ellipse in the tomographic image, as shown in Figure 2b. As the tomographic section moves from the top of the N-localizer towards the bottom of the N-localizer, i.e. towards its point of attachment to the stereotactic frame ( Figure 1), the ellipse will move away from circle and toward circle . The relative spacing between these three fiducials permits precise localization of the tomographic section with respect to the N-localizer. The distance between the centers of circle and ellipse and the distance between the centers of circles and are used to calculate the ratio . This ratio represents the fraction of diagonal rod that extends from the top of vertical rod to the point of intersection of rod with the tomographic section. These linear geometric relationships exist due to the properties of similar triangles and are valid even if the vertical rods are not perpendicular to the tomographic section [3]. It is convenient to ignore the thickness of the tomographic section and to approximate the tomographic section as an infinitely thin plane. This "central" plane lies midway between the top and bottom halves of the tomographic section, analogous to the way that a slice of cheese is sandwiched between two slices of bread. The central plane approximation is susceptible to error because of the partial volume effect that derives from the several-millimeter thickness of the tomographic section [4][5]. The partial volume effect prevails because any structure that passes partially into the tomographic section but does not span the full thickness of that section may be visible in the tomographic image. Hence, the position of that structure is determined to only a several-millimeter error that is a well-known limitation of tomographic imaging. In the following discussion, the term "tomographic section" will be used as an abbreviation for the term "central plane of the tomographic section." The fraction is used to calculate the coordinates of the point of intersection between the long axis of rod and the tomographic section ( Figure 3) The attachment of three N-localizers to a stereotactic frame permits calculation of the , , and coordinates for the three respective points , , and in the three-dimensional coordinate system of the stereotactic frame ( Figure 4). These three points correspond respectively to the three analogous points , , and in the two-dimensional coordinate system of the tomographic image. In the following discussion, the symbols , , and will be used as a shorthand notation for , , and . The symbols , , and will be used as a shorthand notation for , , and .

FIGURE 4: Representation of the Tomographic Section in the Three-Dimensional Coordinate System of the Stereotactic Frame
The quadrilateral represents the tomographic section. The large oval depicts the circular base of the stereotactic frame (in perspective). The vertical and diagonal lines that are attached to the large oval represent the nine rods. The centers of the six fiducial circles and the three fiducial ellipses that are created in the tomographic image by these nine rods are shown as points that lie in the tomographic section. The tomographic section intersects the long axes of the three diagonal rods at the points , , and that coincide with the respective centers , , and of the three ellipses ( Figure 6). The , , and coordinates of the respective points of intersection , , and are calculated in the three-dimensional coordinate system of the stereotactic frame using Equations 1 and 2. Because these three points determine the spatial orientation of a plane in three-dimensional space, the spatial orientation of the tomographic section is determined with respect to the stereotactic frame. The target point lies in the tomographic section. The coordinates of this target point are calculated in the three-dimensional coordinate system of the stereotactic frame using Equation 5.   In order to facilitate calculation of the coordinates of the target point , it is convenient to project the , , and coordinates of the three centers , , and of the ellipses onto the plane in three-dimensional space by appending a third coordinate to create , , and coordinates. Thecoordinate may be set arbitrarily to any non-zero value, e.g., 1, so long as same value of is used for each of the three -coordinates. The equations that are presented in the remainder of this article assume that a value of has been used to project the , , and coordinates. If a value of were used instead of to project these coordinates, the equations that are presented in the remainder of this article would no longer apply and would require revision so that the calculations that these equations describe may produce correct results.
Because three points determine the orientation of a plane in three-dimensional space, the three coordinates , , and , together with the three coordinates , , and , determine the spatial orientation of the tomographic section with respect to the stereotactic frame. This spatial orientation or linear mapping is specified by the matrix elements through in the matrix equation represents concisely a system of nine simultaneous linear equations that determine the spatial orientation of the tomographic section with respect to the stereotactic frame. This equation transforms the , , and coordinates from the two-dimensional coordinate system of the tomographic image to create , , and coordinates in the three-dimensional coordinate system of the stereotactic frame.
In Equation 3, the matrix elements through as well as the matrix elements through are known. The matrix elements through are unknown; hence, Equation 3 may be inverted to solve for these unknown elements of the transformation matrix where the superscript operator -1 indicates the inverse of the matrix that contains the elements through . The inverse of this matrix is guaranteed to exist so long as the , , and coordinates of the centers of the three ellipses , , and are not collinear.
This non-collinearity is enforced by careful design of the stereotactic frame [7].
Once the transformation matrix elements through are known, the coordinates of the target point may be transformed from the two-dimensional coordinate system of the tomographic image to the three-dimensional coordinate system of the stereotactic frame to obtain the coordinates of the analogous target point Equation 5 has been used for the past 37 years to calculate the coordinates of the target point in the three-dimensional coordinate system of the stereotactic frame [2,8]. This equation applies to only three N-localizers; however, some applications of the N-localizer have incorporated four N-localizers [9][10][11][12][13] that produce four sets of fiducials in a tomographic image.

Materials And Methods
Four sets of fiducials are visible in the CT image of Figure 7. The transformation or linear mapping from the two-dimensional coordinate system of this tomographic image into the three-dimensional coordinate system of the stereotactic frame may be represented as

An important distinction between Equations 3 and 6 is that Equation 3 may be inverted via Equation 4
to solve for the transformation matrix elements through whereas Equation 6 may not be inverted to obtain these transformation matrix elements because Equation 6 includes non-square matrices [7].
One solution to this problem is to ignore one of the four sets of fiducials and to use the remaining three sets of fiducials for Equations 3 and 4. This solution raises a question concerning which set of fiducials to ignore. One approach to ignoring a set of fiducials is to attempt to minimize errors by choosing the three fiducial points that form a triangle that encloses the target point [9]. For example, in Figure 7, the target point lies within the triangle , so fiducial would be ignored for application of Equation 4. Although this approach aims to minimize errors, it requires that important data, i.e., one set of fiducials, be ignored.

FIGURE 7: CT Image with Four Sets of Fiducials
Four N-localizers create four sets of fiducials , , , and . The N-localizers are merged end-to-end such that , , , and . The black cross hairs indicate the centers of the fiducials and the white cross hairs indicate the target point that lies inside the triangle (see text for explanation). Adapted from [9].
It is possible to minimize error via the method of least squares [14] without ignoring any of the fiducials. The least-squares method applies to three or more sets of fiducials. The equations that are required for least-squares minimization are obtained by first expanding the matrix multiplication of In order to minimize these errors via the method of least squares, the values of , , and are squared to obtain the error functions , , and The following discussion illustrates minimization of the error function ; minimization of the error functions and is performed in an analogous manner. At the minimum of a function, all of the derivatives are equal to zero. Evaluating the derivatives , , and and setting the resulting expressions for these derivatives to zero yields Simplifying and rearranging the above equations for the derivatives yields a system of three simultaneous linear equations of the three unknowns , , and where is the number of sets of fiducials; in the case of Equation 6, . These simultaneous linear equations may be solved using Cramer's rule [15] or perferably Gauss elimination [16] to yield the matrix elements , , and that minimize the error function . The error functions and are minimized in a similar manner to obtain the matrix elements , , and and the matrix elements , , and , respectively.
Once the elements of the transformation matrix have been calculated as discussed above, the transformation matrix may be used as shown in Equation 5 to transform the coordinates of the target point from the two-dimensional coordinate system of the tomographic image to the three-dimensional coordinate system of the stereotactic frame to obtain the coordinates of the analogous target point .
The accuracy of the calculation of the transformation matrix elements, and hence, the accuracy of the transformation of the coordinates, is indicated by the correlation coefficient that is a measure of how well the coordinates fit the plane equation This correlation coefficient may be obtained by first calculating the three linear correlation coefficients , , and in the manner that is shown below for [17] then combining these linear correlation coefficients to obtain a coefficient of multiple correlation [18] Results Figure 7 is a CT image wherein four N-localizers have produced four sets of fiducials. A cursor was centered over the cross hairs for each of the eight fiducials and for the target point in order to read the coordinates of the fiducials and the target point. These coordinates are shown in   The coordinates for all four fiducials , , , and from Table 1 were used to construct a transformation matrix by solving Equation 11, assuming the stereotactic frame to be a cube whose sides are 30 cm long (see Appendix 1 for details). Then this transformation matrix was used to transform the coordinates of the target point that are shown in Table 1 into the coordinates of the analogous target point that are shown in Table 2. The correlation coefficient was calculated to indicate the accuracy of the transformation.
In order to assess the effect of ignoring one set of fiducials upon the accuracy of the transformation, a different transformation matrix was calculated via Equation 4 using the coordinates from  The coordinates in centimeters for the target point were calculated using all four fiducials , , , and from Figure 7. Also, the coordinates in centimeters for the four different target points were calculated using all four combinations of three fiducials. The Pythagorean distance from to each is indicated in millimeters.  Table   3.  The coordinates of the fiducials and the target point were measured by centering a cursor over the cross hairs in the MR image of Figure 8.
The coordinates for all four fiducials , , , and from Table 3 were used to construct a transformation matrix by solving Equation 11, assuming the stereotactic frame to be a cube whose sides are 30 cm long (see Appendix 2 for details). Then this transformation matrix was used to transform the coordinates of the target point that are shown in Table 3 into the coordinates of the analogous target point that are shown in Table 4. The correlation coefficient was calculated to indicate the accuracy of the transformation.
In order to assess the effect of ignoring one set of fiducials upon the accuracy of the transformation, a different transformation matrix was calculated via Equation 4 using the coordinates from Table 3 for each of the four combinations of fiducials , , , and . Then these four different transformation matrices were used to transform the coordinates of the target point that are shown in Table 3 into coordinates for the four different target points that are shown in Table 4. Also, the Pythagorean distance , which represents the transformation error, was calculated between each of these four target points and the target point . The mean transformation error is mm and the standard deviation is mm.  The coordinates in centimeters for the target point were calculated using all four fiducials , , , and from Figure 8. Also, the coordinates in centimeters for the four different target points were calculated using all four combinations of three fiducials. The Pythagorean distance from to each is indicated in millimeters.

Target Point and Fiducials
For the CT image of Figure 7, the correlation coefficient and the mean transformation error of mm indicate that only a small amount of error is present in the CT image. A possible source of this error is the fact that the coordinates of the centers of the fiducials were recorded manually using a cursor and hence these coordinates are accurate to only the nearest pixel. In practice, this source of error is greatly reduced by computer software that calculates the center of each fiducial at sub-pixel precision instead of relying on a human to identify the center of the fiducial manually.
The attempt to minimize the transformation error by ignoring one set of fiducials [9] does diminish the error, as can be seen from Figure 7 and Table 2. Assuming that , which was calculated using all four sets of fiducials, is the most accurate target point, it is evident that the Pythagorean distance from to varies with the position of relative to the triangle that is formed by the three that are used for application of Equation 4. Specifically, the distance increases as the position of progresses from well inside triangle to marginally inside triangle to marginally outside triangle to well outside triangle . Figure 8 and Table 4 show a similar trend of increasing Pythagorean distance from to as the position of progresses from well inside triangle to marginally inside triangle to marginally outside triangle to well outside triangle .
Because the Pythagorean distance represents the transformation error, these trends demonstrate that the transformation error may be minimized to some extent by choosing the three fiducials that form a triangle that encloses the target point . However, choosing three of the four fiducials ignores one set of fiducials and, hence, requires that important data be discarded, whereas least-squares minimization uses all four sets of fiducials and thus discards no data.
For the MR image of Figure 8, the correlation coefficient and the mean transformation error of mm indicate that substantially more error is present in the MR image of Figure 8 than in the CT image of Figure 7. A likely source of this error is nonlinear distortion of the MR image that may be caused by metallic elements of the stereotactic frame, inhomogeneity and temporal fluctuation of the magnetic field, and metallic equipment near the MR scanner [11,[19][20][21][22].
In view of the N-localizer's requirement for linearity, the susceptibility of MR to nonlinear distortion can potentially degrade the accuracy of MR-guided stereotactic surgery [7]. In the absence of nonlinear distortion, the centers of the two circles and and the ellipse are expected to be collinear, as shown in Figure 2b and Figure 6. On the other hand, the correlation coefficient that is calculated via Equation 14 is sensitive to any displacement of the centers of fiducials relative to the centers of fiducials and . Moreover, the correlation coefficient is sensitive to the displacement of the center of any fiducial relative to the center of any other fiducial. Such a displacement alters the calculation of the coordinates of one or more of the four via Equations 1 and 2, and these altered coordinates affect the correlation coefficient . The robustness and usefulness of the correlation coefficient underscore the superiority of least-squares minimization compared to ignoring one of the four sets of fiducials [9]. Table 5 shows that the four correlation coefficients are insensitive to the nonlinear distortion that is present in the MR image of Figure 8. The correlation coefficients that are calculated for each of the four sets of fiducials are substantially larger than the correlation coefficient that is calculated using the four fiducials , , , and . This disparity between and the four suggests that the distortion in the MR image of Figure  8 either causes the centers of the four fiducials to move along the lines that connect the centers of fiducials and , or causes the four sets of fiducials to move relative to one another in a manner that does not affect the collinear relationship within each set of fiducials .  The correlation coefficients that are calculated from the coordinates of the fiducials in the MR image of Figure 8 indicate that the correlation coefficients are insensitive to nonlinear distortion of this MR image, whereas the correlation coefficient is sensitive to that distortion.
Four or more N-localizers require the solution of Equation 11 instead of using Equation 4 to calculate the transformation matrix. For three N-localizers, either approach may be used to calculate the transformation matrix but for three N-localizers there is no advantage to solving Equation 11. The correlation coefficient that is calculated via Equation 14 is a valid statistical measure of the accuracy of the transformation for only four or more N-localizers. For three Nlocalizers, this correlation coefficient equals because three points determine the orientation of a plane in three-dimensional space.

Discussion
Magnetic resonance (MR) imaging differs from computed tomography (CT) imaging in the manner by which the images are obtained. CT obtains a volume of individual tomographic images of the patient by changing the position of the scanner bed between successive tomographic scans and, hence, is susceptible to errors in scanner bed positioning. MR obtains a volume image of the patient by applying magnetic field gradients [23] and, therefore, does not require changing the position of the scanner bed. Indeed, MR may obtain a volume image of the patient directly without obtaining a series of planar, tomographic scans. Because MR is not susceptible to errors in scanner bed positioning, the spatial accuracy of a MR volume image ought to be greater than the spatial accuracy of a volume of successive CT images, provided that the patient does not move during the imaging procedure.
A volume image comprises individual volume elements, or voxels, that are identified via their coordinates in the same manner that the individual picture elements, or pixels, from a planar, tomographic image are identified via their coordinates. A planar section of these voxels is a subset of the voxels wherein one of the coordinates is held constant. An axial plane has constant and varying coordinates. A sagittal plane has constant and varying coordinates. A coronal plane has constant and varying coordinates. In this context, the term "planar section" or "plane" designates an axial, sagittal or coronal plane, i.e., a subset of the voxels that one volume image comprises. Such a plane is to be distinguished from a tomographic image that comprises a set of pixels that are obtained via one planar, tomographic scan.
A MR localizer frame differs from a CT localizer frame in that the MR localizer frame is designed to create fiducials in sagittal and coronal planes in addition to axial planes [24]. A MR localizer frame comprises five N-localizers that subtend the anterior, posterior, left, right, and superior faces of a cube that encloses the patient's head (Figure 9).

FIGURE 9: MR Localizer Frame and Axial, Sagittal and Coronal Planes
A MR localizer frame comprises five N-localizers that subtend the anterior, posterior, left, right and superior faces of a cube. An axial plane (red) intersects the MR localizer frame at four N-localizers: anterior, posterior, left and right. A sagittal plane (green) intersects the MR localizer frame at three N-localizers: anterior, posterior and superior. A coronal plane (blue) intersects the MR localizer frame at three N-localizers: left, right and superior.
In a manner analogous to Equation 3, the spatial orientation of MR voxel data may be determined with respect to the stereotactic frame. The equation that applies to these voxel data requires four coordinates , , , and from the three-dimensional coordinate system of the stereotactic frame. This equation also requires four coordinates , , , and from the three-dimensional coordinate system of the voxel data. The coordinates are the centers of ellipses that are visualized in axial, sagittal or coronal planes of the voxel data, similar to the approach that is discussed for an axial tomographic section in Figure 6 The spatial orientation or linear mapping of the voxel data with respect to the stereotactic frame is specified using the matrix equation [25] Equation 15 represents concisely a system of 12 simultaneous linear equations that determine the spatial orientation of the voxel data with respect to the stereotactic frame. This equation transforms the , , , and coordinates from the three-dimensional coordinate system of the voxel data to create , , , and coordinates in the three-dimensional coordinate system of the stereotactic frame.
One important restriction applies to Equation 15. The four coordinates , , , and must not be coplanar; hence, these four coordinates must not be obtained from a single plane, such as an axial plane that comprises four fiducials. Thus, for example, an acceptable set of coordinates would comprise three coordinates from three N-localizers that intersect an axial plane and one coordinate from the superior N-localizer that intersects a coronal plane. This restriction is similar to the restriction that applies to Equation 3, i.e., three non-collinear coordinates must be used in Equation 3 [7].
In Equation 15, the matrix elements through as well as the matrix elements through are known. The matrix elements through are unknown; hence, it is possible (and tempting) to invert Equation 15 in order to solve for these unknown elements of the transformation matrix in a manner similar to Equation 4. However, a more useful solution may be obtained by applying the method of least squares [14] to more than four sets of fiducials because of the robustness of that method and the usefulness of the correlation coefficients that it provides.
For voxel data, a useful set of fiducials would comprise ten fiducials: four fiducials from an axial plane, three fiducials from a sagittal plane and three fiducials from a coronal plane, where the target point is visualized in all three planes. The following equation transforms ten coordinates from the three-dimensional coordinate system of the voxel data to create ten coordinates in the three-dimensional coordinate system of the stereotactic frame In Equation 16, the subscript selects one of the ten fiducials. The equations that are required for least-squares minimization are obtained by first expanding the matrix multiplication of Equation 16 and expressing the result for the matrix elements , , and In the presence of error, Equation 17 may be rearranged to express the errors in , , and as , , and , respectively In order to minimize these errors via the method of least squares, the equations for , and are squared to obtain the error functions , , and The following discussion illustrates minimization of the error function ; minimization of the error functions and is performed in an analogous manner. At the minimum of a function, all of the derivatives are equal to zero. Evaluating the derivatives , , , and and setting the resulting expressions for these derivatives to zero yields Simplifying and rearranging the above equations for the derivatives yields a system of four simultaneous linear equations of the four unknowns , , , and where is the number of sets of fiducials; in this case, . These simultaneous linear equations may be solved using Cramer's rule [15] or preferably Gauss elimination [16] to yield the matrix elements , , , and that minimize the error function . The error functions and are minimized in a similar manner to obtain the matrix elements , , , and and the matrix elements , , , and , respectively.
Once the elements of the transformation matrix have been calculated as discussed above, the transformation matrix may be used as follows to transform the coordinates of the target point from the three-dimensional coordinate system of the voxel data into the threedimensional coordinate system of the stereotactic frame to obtain the coordinates of the analogous target point The accuracy of the calculation of the transformation matrix elements, and hence the accuracy of the transformation of the coordinates, is indicated by three correlation coefficients , , and that express how well the right-hand sides of Equation 17 estimate the left-hand sides of that equation [26]. Taking the first of Equations 17 as an example, the correlation coefficient that measures the correlation between the right-hand side and the left-hand side is calculated as [17] The correlation coefficients and are calculated in an analogous manner. The three correlation coefficients , , and may be used to calculate the correlation coefficient , as shown in Equation 14.
The solution to Equation 21 provides a method for transforming coordinates from the three-dimensional coordinate system of voxel data, which are obtained via volume imaging, to the three-dimensional coordinate system of the stereotactic frame to produce coordinates.
These equations require the use of four or more pairs of non-coplanar and An additional application of the solution to Equation 21 is the calculation of the correlation coefficients , , , and that provide a measure of the accuracy of the transformation. The accuracy of the transformation is degraded by nonlinear distortion to which MR data are susceptible.
In view of the susceptibility of MR to nonlinear distortion, an assessment of the nonlinear distortion may be improved using additional and coordinates that may be obtained from axial, sagittal and coronal planes that do not include the target point . These MR scanners are equipped with small "shimming" electromagnets that are used to improve the homogeneity of the magnetic field and, hence, improve the linearity of MR images. Because the optimum shim settings differ between patients, the optimum shim settings should be determined for each patient individually. A MR localizer frame could assist in the determination of the optimum shim settings as follows. A volume image that comprises voxel data would be obtained for a patient wearing a MR localizer frame, then coordinates would be chosen from throughout the volume image. The corresponding coordinates would be calculated from the coordinates via Equation 2. The and coordinates would be used to construct Equation 21. The solution to Equation 21 would yield the matrix elements through . These matrix elements and the and coordinates would be used to calculate the correlation coefficients , , , and via Equations 23-24. These correlation coefficients would provide an analysis of the linearity of the voxel data and thus provide an indication of whether the quality of the shimming procedure was sufficient to permit MR-guided stereotactic surgery.

Conclusions
This article presents the mathematics that permit the transformation of coordinates from the two-dimensional coordinate system of a tomographic image to the three-dimensional coordinate system of the stereotactic frame to produce coordinates. In addition, this article describes the mathematics that permit the transformation of coordinates from the three-dimensional coordinate system of volume image data, which are obtained via MR imaging, to the three-dimensional coordinate system of the stereotactic frame to produce coordinates.
When applied to four or more N-localizers, these mathematics permit the calculation of the correlation coefficients , , , and that provide a statistical measure of the presence of nonlinear distortion in the image data. Because image data that are obtained via MR imaging are susceptible to nonlinear distortion, these correlation coefficients may be used to indicate whether a particular MR image is sufficiently free of nonlinear distortion to qualify for MR-guided stereotactic surgery.