## 1.

## Introduction

In the last few years, a large number of accurate devices for measuring corneal morphology have appeared. Among them, those based on Placido rings and Scheimpflug cameras are the most widely used.^{1, 2, 3, 4, 5, 6, 7} These devices can provide height data of the corneal surfaces that can be fitted to analytical surfaces through polynomial expressions (modal approach).^{8, 9, 10} These can be later used for aberration calculation and ray trace solving.^{11, 12, 13}

Zernike polynomials are often used as adjusting polynomials, but they have shown to be not precise when describing highly irregular corneas,^{14, 15, 16} since they do not fit properly to irregularities. In 2003, Smolek and Klyce^{14} concluded that Zernike polynomials did not fully characterize the surface features that affect vision. Later, Klyce, Karon, and Smolek^{15} found that using Zernike polynomials in normal eyes was acceptable, but for eyes after corneal surgery or eyes with corneal pathology such as keratoconus, the Zernike method fails to capture all clinically significant higher-order aberrations. Furthermore, it is very difficult to assess *a priori* how many terms are necessary to achieve an acceptable accuracy in the Zernike reconstruction for any given corneal shape.^{17}

Common measuring devices are based in imaging techniques. An image reflected from a pattern—linear or annular—is projected onto a charge-coupled device (CCD) and is digitally processed.^{18} From this information, a height map is obtained. Surfaces with radial structure do not fit well with squared detectors or matrices,^{19} since density of samples in the azimuthal coordinate depends on the radial coordinate, due to the fact that the number of different angular samples in the center of the matrix is lower than in the periphery. Unfortunately, acquiring devices are based on squared CCD, and little can be done to change this fact. Reconstruction methods may consider such limitations and obtain the best possible results. Traditional reconstruction of the optical surface with Zernike polynomials^{20} does not pay attention to the particular sampling distribution of the analyzed surfaces, and thus it does not provide optimum results in the central area around the apex, which is the most important zone under the optical point of view. One of the main limitations of the polynomial representation is that each term extends its influence over the entire pupil.

The goodness of fit of a surface model strongly depends on the number of samples and its distribution. Let us consider a spherical-like surface given by height samples in Cartesian coordinates. The number of points that contribute to the polynomial fit is proportional to the area of the considered surface. Thus the ratio between the number of samples included in an external annular region defined between radii ${R}_{1}$ and ${R}_{2}$ and the central part of aperture radius ${R}_{1}$ is quadratic, i.e., ${({R}_{2}\u2215{R}_{1})}^{2}-1$ . The effect is not very important for a spherical surface, but if the surface is affected by any irregularity in the periphery, it determines the coefficients in the central optical area, although the real effect of the irregularity on the retinal image is limited. Therefore, the fitting error is distributed over the entire surface, not just at those zones where the deformation is located.

B-spline polynomials are especially well suited for fitting complex-shaped surfaces.^{21, 22} They have the advantages of being locally defined and having great flexibility, which allows control of their smoothness and polynomial degree.^{23, 24} In Ref. 25, the authors propose an alternative technique for reconstructing the corneal shape from elevation data using sets of radial basis functions (RBFs) in a modal approach. Due to the fast decay of RBFs, the modal approach exhibits features of the zonal approach, eventually capturing small deformations of the surface, which are missed by the polynomial fitting. As Ref. 25 states, we think that there is no unique or best approach to corneal surfaces, and a combination of techniques can be a good strategy.

Light distributions propagated from the cornea can be numerically evaluated by means of a Fresnel propagation algorithm.^{26} Numerical calculation of convergent Fresnel patterns through fast Fourier transform usually requires a large number of samples
$(4\times {10}^{6})$
to fulfil the Nyquist condition around the focus.^{27} In Ref. 28, the authors present a simple method that permits subsampling the Fresnel pattern while maintaining the Nyquist condition, and thus preventing the appearance of aliasing effects in the calculation. Later, in Ref. 29, the authors proposed modifying the initial wavefront and relaxing the Nyquist condition, thus giving a more efficient numerical algorithm. Corneal height data sampling provided by corneal topographers is still lower than the one imposed by the Nyquist condition. Hence, we need a method that allows an accurate resample of corneal height data.

In this work, we propose a zonal Zernike fitting (combination of zonal and modal approaches) of corneal height data. It consists of obtaining Zernike coefficients over local areas. A local mask is applied on the surface, and polynomial fit is done for this part of the surface. The coefficients so obtained have no physical meaning due to the fact that Zernike polynomials are usually defined over a unit disk. However, we used the method as a reconstruction tool in a way similar to Lundström, Unsbo, and Gustafsson.^{30} The mask is then displaced over the surface and the process is repeated on each local area. The surface reconstruction takes into account the fittings in all zones, diminishing the influence of smooth areas over irregular ones and vice versa. The method limits the influence of the peripheral irregularities over the central corneal area calculation, thus giving accurate reconstruction of the central optical zone. This fact will be of special interest in the evaluation of wavefront aberrations of irregular corneas (e.g., keratoconus, pellucid marginal corneal degeneration, corneal etc.). Thus, we join the advantage of a simpler analytical form of the modal representation together with the benefit of local definition of the zonal one. We have compared zonal Zernike fitting with the modal approach, evaluating both techniques over two different surfaces: a theoretical irregular surface and height data of a real keratoconic cornea.

## 2.

## Methods

Zernike polynomials are often used as an expansion of corneal height data and to analyze of optical wavefronts, being low order terms directly related to classical Seidel aberrations.^{31} As a complete modal set, any surface can be approximated by a linear combination of circular polynomials as follows:^{32}

## Eq. 1

$$W(\rho ,\theta )\simeq \sum _{j=0}^{p-1}{c}_{j}{Z}_{j}(\rho ,\theta )=G(\rho ,\theta );\phantom{\rule{1em}{0ex}}j=\frac{1}{2}[n(n+2)+m],$$The modal fitting principle of the Zernike representation is shown in Eq. 1. The data
$W(\rho ,\theta )$
are approximated by a polynomial function extended over the whole domain (Fig. 1
). The best estimation of
${c}_{j}$
parameters is obtained by solving the linear least-squares problem described by the system of equations that can be deduced from Eq. 1. Our basic equation is
$W=\mathbf{Z}c$
, which is a linear transformation on
$c$
, where
$c$
are the expansions coefficients,
$W$
is a discrete set of elevation data, and
$\mathbf{Z}$
is a matrix of discrete Zernike polynomials. The problem is choosing the coefficients
$c$
to minimize, in some sense, the difference between the observed
$W$
discrete elevations and the prescribed output of the system
$\mathbf{Z}c$
. The function to be minimized is:^{33, 34}

^{35}To calculate the pseudoinverse, we used a method called singular value decomposition (SVD), implemented in MATLAB based in linear algebra package (LAPACK) routines.

^{36}This method provides a solution to Eq. 3, regardless of being a determined, undetermined, or overdetermined system.

Zonal Zernike fitting is developed in the same way as a modal one, but the equation $W=\mathbf{Z}c$ is not solved over the whole domain. The surface is divided into zones that overlap each other (see Video 1 ). It takes advantage of increasing the influence of the central zone in the adjustment, thus providing a better description of the more interesting optical area. On the contrary, in the modal fitting, periphery data have a heavier influence than central ones due to the fact that they are more numerous.

10.1117/1.3394260.1Let us call $\mathbf{W}(u,v)$ a surface described by an $\mathbf{N}\times \mathbf{N}$ matrix, with $u$ and $v$ being discrete indexes from 1 to $\mathbf{N}$ . A local area of $\mathbf{M}\times \mathbf{M}$ pixels, being $\mathbf{M}<\mathbf{N}$ , is selected in this matrix where we solve Eq. 1. Zernike decomposition for this region is obtained, thus having a local description of the surface. The calculation area is displaced along the entire surface, and a zonal Zernike polynomial fit is obtained each time. Reconstruction on one point is done by evaluating all Zernike decompositions, describing the local areas that overlap on this point and taking the mean value of the obtained height. Calculation windows for selecting local regions are implemented by constructing auxiliary matrices of size $\mathbf{N}\times \mathbf{N}$ , whose elements are equal to one in the region of interest and zero elsewhere. These matrices are described by:

## Eq. 4

$${\mathbf{O}}_{a,b}(u,v)=\{\begin{array}{ll}1;& u\u220a[a,a+(\mathbf{M}-1)]\wedge v\u220a[b,b+(\mathbf{M}-1)]\\ 0;& \text{otherwise}\end{array}\phantom{\}},$$## Eq. 5

$${\mathbf{W}}_{a,b}(u,v)=\{\begin{array}{ll}\sum _{j=0}^{p-1}{c}_{j}^{(a,b)}{Z}_{j}[{\rho}_{(u,v)},{\theta}_{(u,v)}];& u\u220a[a,a+(\mathbf{M}-1)]\wedge v\u220a[b,b+(\mathbf{M}-1)]\\ 0;& \text{otherwise}\end{array}\phantom{\}},$$^{30}who proposed a direct reconstruction method for elliptical pupils, we have solved the problem. The region of missing data between the mask and the whole pupil can be ignored, provided there are enough valid measured heights to perform a fit. Once the coefficients are determined, the surface can be reconstructed over the entire domain of the pupil, even though valid data used to compute the coefficients are available only in the limited area of the mask. There will thus be an extrapolated part of the surface outside the mask that has no physical relevance. When the reconstructed surface is evaluated, this part is removed.

As we said before, one point of the surface may belong to different local regions. Thus, it is necessary to take into account how many regions overlap on a single pixel. According to our previous description, the reconstructed surface can be written as

## Eq. 6

$$L(u,v)=\frac{\sum _{a=1}^{\mathbf{N}-(\mathbf{M}-1)}\sum _{b=1}^{\mathbf{N}-(\mathbf{M}-1)}{\mathbf{W}}_{a,b}(u,v)}{\sum _{a=1}^{\mathbf{N}-(\mathbf{M}-1)}\sum _{b=1}^{\mathbf{N}-(\mathbf{M}-1)}{\mathbf{O}}_{a,b}(u,v)}.$$## Eq. 7

$${f}_{\mathbf{N}}\left(\mathbf{M}\right)={\mathbf{M}}^{2}{[\mathbf{N}-2(\mathbf{M}-1)]}^{2}.$$^{9}

## Eq. 9

$$K(x,y)=\frac{3}{4}\phantom{\rule{0.2em}{0ex}}\mathrm{exp}\left\{\frac{-[{(9x-2)}^{2}+{(9y-2)}^{2}]}{4}\right\}+\frac{3}{4}\phantom{\rule{0.2em}{0ex}}\mathrm{exp}\{-[\frac{{(9x+1)}^{2}}{49}+\frac{{(9y+1)}^{2}}{10}]\}+\frac{1}{2}\phantom{\rule{0.2em}{0ex}}\mathrm{exp}\{-[{(9x-7)}^{2}+\frac{{(9y-3)}^{2}}{4}]\}+\frac{1}{5}\phantom{\rule{0.2em}{0ex}}\mathrm{exp}\{-[{(9x-4)}^{2}+{(9y-7)}^{2}]\}.$$## Eq. 10

$$l\mathrm{RMSD}=-\mathrm{log}\left({\left\{\frac{\sum _{u=1}^{\mathbf{N}}\sum _{v=1}^{\mathbf{N}}{[F(u,v)-W(u,v)]}^{2}}{{\mathbf{N}}^{2}}\right\}}^{1\u22152}\right),$$## 3.

## Results

Obtained $l\mathrm{RMSD}$ for a spherical surface of curvature radius of $6.5\phantom{\rule{0.3em}{0ex}}\mathrm{mm}$ plus a scaled Franke’s function defined on an area with a diameter of $4\phantom{\rule{0.3em}{0ex}}\mathrm{mm}$ sampled every $0.1\phantom{\rule{0.3em}{0ex}}\mathrm{mm}$ are shown in Fig. 2 . We have applied modal and zonal Zernike fittings with two different masks of size $21\times 21\phantom{\rule{0.3em}{0ex}}\mathrm{px}$ and $11\times 11\phantom{\rule{0.3em}{0ex}}\mathrm{px}$ , this last one being optimum according to Eq. 9. The best fit is obtained for the maximum $l\mathrm{RMSD}$ . We find different maxima for each fitting: zonal Zernike fitting with a $11\times 11\phantom{\rule{0.3em}{0ex}}\mathrm{px}$ mask at 43 polynomials, 96 polynomials for a $21\times 21\phantom{\rule{0.3em}{0ex}}\mathrm{px}$ mask, and 114 polynomials for modal fitting. Notice that zonal Zernike fitting provides a better adjustment than the modal one for any number of considered polynomials.

Figures 3, 4, 5 present the differences between the original surface and the reconstructed ones using the polynomial decomposition that provides the best adjustment for each method. All differences are set to the same scale to emphasize the influence of zonal Zernike fitting. Notice that for both zonal Zernike fitting cases, the reconstruction error is lower than for the global case. Moreover, as the local mask becomes smaller, the central area is better reconstructed.

Obtained $l\mathrm{RMSDs}$ for the height data of a real keratoconic cornea with a pupil diameter of $4\phantom{\rule{0.3em}{0ex}}\mathrm{mm}$ have been calculated and are shown in Fig. 6 . We have applied modal and zonal Zernike fittings using the same masks as before. Again, it is shown that zonal Zernike fitting provides a better adjustment than the global one, as we saw in the theoretical surface case.

Contrary to what one may think, increasing the number of terms in the Zernike polynomial decompositions does not gives a more realistic approximation in numerical image analysis. In practice, the SVD method can always provide a unique solution, although the matrix
${\mathbf{Z}}^{+}$
is ill-conditioned and numerically rank deficient. This rank deficiency may be diagnosed through the condition number. The problem arises when the condition number is too large, because the SVD provides a bad least-squares solution.^{22} This fact can be seen in the falls of the
$l\mathrm{RMSD}$
plotted in Fig. 6. There is a number of polynomials from which the solution obtained is degraded.

Figures 7, 8, 9 present the height differences between real keratoconic corneal data obtained from the Pentacam and the reconstructed ones using the polynomial decomposition that provides the best adjustment for each method. All differences are set to the same scale to emphasize the influence of zonal Zernike fitting. Results are quite similar to those obtained for the simulation. Again, results show that the keratoconic corneal height description through Zernike polynomials over the whole surface produces fitting errors in the whole area, whereas the zonal Zernike analysis proposed here provides a lower surface fitting error, mainly in the central region (see Fig. 7), which is optically the most important.

## 4.

## Conclusion

In this work, we develop a zonal Zernike fitting of corneal height data. It consists of obtaining Zernike coefficients over local areas. A local displacing mask is applied on the surface, and polynomial fit is done for this part of the surface. The surface reconstruction takes into account the fittings in all the zones, thus diminishing the influence of smooth areas over irregular ones and vice versa. Zonal Zernike fitting has the same advantage of the simple analytical form of the modal representation, together with the benefit of local definition of the zonal one. If we compare for the same polynomial order (28 coefficients) our results with those presented in Ref. 24, they achieve a RMSD around $3\cdot {10}^{-3}\phantom{\rule{0.3em}{0ex}}\mathrm{mm}$ for an irregular surface (modeling a keratoconic cornea) using radial basis functions, while our analysis on a similar case (see Fig. 6) shows that zonal Zernike fitting reaches between 2 and 4 orders of magnitude lower, depending on the size of the zonal mask we used. Furthermore, we compare our technique with that proposed in Ref. 22 on the same complex surface (Franke’s function), and we find that the rms of the reconstructed surface is four times lower in our model. Regarding the computational cost of our method, it is at least 2 orders of magnitude higher than the traditional Zernike calculation over the entire surface.

Our goal is to propose a combination of techniques that could be a good strategy for fitting, reconstructing, and resampling corneal height data. Local fitting reduces the influence of regions far from the calculation point. The implementation of the method also shows that the central corneal surface part is better evaluated than the outer parts, since calculation is more intensive in this zone and is not affected by peripheral irregularities. Thus, the presented method allows for better reconstruction of optical surfaces, mainly of the optical central zone, than the traditional one based on polynomial fitting of the whole surface.

## Acknowledgment

The authors acknowledge support of the Consellería de Educación project GV/2009/002 from the Generalitat Valenciana.

## References

**,” Br. J. Ophthamol., 84 842 –847 (2000). https://doi.org/10.1136/bjo.84.8.842 0007-1161 Google Scholar**

*EyeSys corneal topography measurement applied to calibrated ellipsoidal convex surfaces***,” Br. J. Ophthamol., 79 791 –792 (1995). https://doi.org/10.1136/bjo.79.9.791 0007-1161 Google Scholar**

*Information fidelity in corneal topography***,” J. Refract. Surg., 14 100 –104 (1998). 1081-597X Google Scholar**

*Accuracy of corneal elevation with four corneal topography systems***,” Eye Contact Lens: Sci. Clin. Prac., 30 74 –78 (2004). Google Scholar**

*Accuracy and precision of EyeSys and Orbscan systems on calibrated spherical test surfaces***,” Ophthalmology, 113 1629 –1632 (2006). https://doi.org/10.1016/j.ophtha.2006.03.046 0161-6420 Google Scholar**

*Comparison of Pentacam and Orbscan IIz on posterior curvature topography measurements in keratoconus eyes***,” J. Cataract Refractive Surg., 34 137 –145 (2008). https://doi.org/10.1016/j.jcrs.2007.09.033 0886-3350 Google Scholar**

*Validity of the keratometric index: evaluation by the Pentacam rotating Scheimpflug camera***,” Acta Ophthalmol. Scand., 79 576 –579 (2001). https://doi.org/10.1034/j.1600-0420.2001.790606.x 1395-3907 Google Scholar**

*Anterior chamber depth estimation by Scheimpflug photography***,” J. Opt. Soc. Am. A, 12 2105 –2113 (1995). https://doi.org/10.1364/JOSAA.12.002105 0740-3232 Google Scholar**

*Representation of videokeratoscopic height data with Zernike polynomials***,” J. Refract. Surg., 21 S552 –7 (2005). 1081-597X Google Scholar**

*Modal reconstruction methods with Zernike polynomials***,” Optom. Vision Sci., 86 542 –547 (2009). https://doi.org/10.1097/OPX.0b013e31819fa8ec 1040-5488 Google Scholar**

*Modeling videokeratoscopic height data with spherical harmonics***,” Optom. Vision Sci., 74 906 –916 (1997). https://doi.org/10.1097/00006324-199711000-00024 1040-5488 Google Scholar**

*Using corneal height maps and polynomial decomposition to determine corneal aberrations***,” J. Opt. Soc. Am. A, 17 955 –965 (2000). https://doi.org/10.1364/JOSAA.17.000955 0740-3232 Google Scholar**

*Corneal wave aberration from videokeratography: accuracy and limitations of the procedure***,” J. Biomed. Opt., 14 044003 (2009). https://doi.org/10.1117/1.3158996 1083-3668 Google Scholar**

*Corneal primary aberrations compensation by oblique light incidence***,” Invest. Ophthalmol. Visual Sci., 44 4676 –4681 (2003). https://doi.org/10.1167/iovs.03-0190 0146-0404 Google Scholar**

*Zernike polynomial fitting fails to represent all visually significant corneal aberrations***,” J. Refract. Surg., 20 S537 –541 (2004). 1081-597X Google Scholar**

*Advantages and disadvantages of the Zernike expansion for representing wave aberration of the normal and aberrated eye***,” Invest. Ophthalmol. Visual Sci., 46 1915 –1926 (2005). https://doi.org/10.1167/iovs.04-1222 0146-0404 Google Scholar**

*Accuracy of Zernike polynomials in characterizing optical aberrations and the corneal surface of the eye***,” IEEE Trans. Biomed. Eng., 48 87 –95 (2001). https://doi.org/10.1109/10.900255 0018-9294 Google Scholar**

*Optimal modeling of corneal surfaces with Zernike polynomials***,” J. Mod. Opt., 57 94 –102 (2010). https://doi.org/10.1080/09500340903050942 0950-0340 Google Scholar**

*Custom design dynamic videokeratometer***,” J. Opt. Soc. Am. A, 25 1875 –1884 (2008). https://doi.org/10.1364/JOSAA.25.001875 0740-3232 Google Scholar**

*Unitary transformation between Cartesian- and polar-pixellated screens***,” Optical Shop Testing, John Wiley and Sons, Hoboken, NJ (2007). Google Scholar**

*Zernike polynomial and wavefront fitting***,” Opt. Commun., 245 255 –269 (2005). https://doi.org/10.1016/j.optcom.2004.09.074 0030-4018 Google Scholar**

*Wavefront reconstruction with the adaptive Shack-Hartmann sensor***,” Adv. Abrasive Technol., 238–239 169 –174 (2003). Google Scholar**

*B-Spline based wavefront reconstruction for lateral shearing interferometric measurement of engineering surfaces***,” Appl. Opt., 45 6954 –6964 (2006). https://doi.org/10.1364/AO.45.006954 0003-6935 Google Scholar**

*Comparison of cubic B-spline and Zernike-fitting techniques in complex wavefront reconstruction***,” J. Opt. Soc. Am., 70 998 –1006 (1980). https://doi.org/10.1364/JOSA.70.000998 0030-3941 Google Scholar**

*Wave-front estimation from wave-front slope measurements***,” Invest. Ophthalmol. Visual Sci., 50 5639 –5645 (2009). 0146-0404 Google Scholar**

*Comparative analysis of some modal reconstruction methods of the shape of the cornea from corneal elevation data***,” J. Mod. Opt., 52 1161 –1176 (2005). https://doi.org/10.1080/09500340512331327598 0950-0340 Google Scholar**

*Complete algorithm for light pattern calculation inside the ocular media***,” Opt. Commun., 227 245 –258 (2003). https://doi.org/10.1016/j.optcom.2003.09.046 0030-4018 Google Scholar**

*Fast numerical calculation of Fresnel patterns in convergent systems***,” J. Mod. Opt., 53 259 –266 (2006). https://doi.org/10.1080/09500340500358458 0950-0340 Google Scholar**

*Scale corrections for faster evaluation of convergent Fresnel patterns***,” Opt. Lett., 33 1960 –1962 (2008). https://doi.org/10.1364/OL.33.001960 0146-9592 Google Scholar**

*Adaptive sampling in convergent beams***,” J. Biomed. Opt., 10 034002 –7 (2005). https://doi.org/10.1117/1.1920587 1083-3668 Google Scholar**

*Off-axis wave front measurements for optical correction in eccentric viewing***,” Opt. Lett., 7 262 –264 (1982). https://doi.org/10.1364/OL.7.000262 0146-9592 Google Scholar**

*Conversion of Zernike aberration coefficients to Seidel and higher-order power-series aberration coefficients***,” J. Refract. Surg., 18 S652 –660 (2002). 1081-597X Google Scholar**

*Standards for reporting the optical aberrations of eyes***,” Appl. Opt., 39 1272 –1278 (2000). https://doi.org/10.1364/AO.39.001272 0003-6935 Google Scholar**

*Three-dimensional reconstruction of dielectric objects by the coupled-dipole method***,” Proc. Cambridge Philos. Soc., 51 406 –413 (1955). https://doi.org/10.1017/S0305004100030401 0068-6735 Google Scholar**

*A generalized inverse for matrices*