Abstracts
In this project we are developing an instrument for measuring the wavefront aberrations of the human eye using the HartmannShack sensor. A laser source is directed towards the eye and its diffuse reflection at the retina generates an approximately spherical wavefront inside the eye. This wavefront travels through the different components of the eye (vitreous humor, lens, aqueous humor, and cornea) and then leaves the eye carrying information about the aberrations caused by these components. Outside the eye there is an optical system composed of an array of microlenses and a CCD camera. The wavefront hits the microlens array and forms a pattern of spots at the CCD plane. Image processing algorithms detect the center of mass of each spot and this information is used to calculate the exact wavefront surface using least squares approximation by Zernike polynomials. We describe here the details of the first phase of this project, i. e., the construction of the first generation of prototype instruments and preliminary results for an artificial eye calibrated with different ametropias, i. e., myopia, hyperopia and astigmatism.
Corneal topography; Ophthalmological diagnostic techniques; Astigmatism; Equipment design; Optometry; Retina; Computerassisted image processing
Neste projeto estamos desenvolvendo instrumento para medidas das aberrações de frente de onda do olho humano usando um sensor HartmannShack. Uma fonte de luz laser é direcionada ao olho e sua reflexão difusa na retina gera frente de onda aproximadamente esférica dentro do olho. Esta frente de onda atravessa os diferentes componentes do olho (humor vítreo, lente, humor aquoso e córnea) trazendo informações sobre as aberrações ópticas causadas por estes componentes. No meio externo ao olho existe sistema óptico formado por uma matriz de microlentes e uma câmera CCD. A frente de onda incide nesta matriz e forma um padrão aproximadamente matricial de "spots" no plano do CCD. Algoritmos de processamento de imagens são utilizados para detectar os centróides de cada "spot" e esta informação é utilizada para deduzir a forma da frente de onda usando métodos de aproximação por mínimos quadrados e polinômios de Zernike. Descrevemos aqui detalhes da primeira fase deste projeto, em que foi realizada a construção da primeira geração de instrumentos protótipos e testes preliminares em olho artificial, calibrado com diferentes ametropias, i. e., miopia, hipermetropia e astigmatismo.
Topografia da córnea; Técnicas de diagnóstico oftalmológico; Astigmatismo; Desenho de equipamento; Optometria; Retina; Processamento de imagem assistida por computador
Preliminary results of a highresolution refractometer using the HartmannShack wavefront sensor Part I
Resultados preliminares com refratrômetro de alta resolução, usando sensor de frente de onda de HartmannShack  Parte I
Luis Alberto Carvalho^{I}; Antonio Carlos Romao^{II}; Marcos Stefani^{II}; Luiz Antonio Carvalho^{III}; Jarbas Caiado de Castro^{IV}; Fátima Yasuoka^{V}; Francisco Scannavino Júnior^{VI}; Juselino dos Santos^{VI}; Paulo Schor^{VII}; Wallace Chamon^{VIII }
^{I}Diretor de Software da Eyetec, Doutor pelo Instituto de Física de São Carlos/ Universidade de São Paulo (IFSC  USP), pósdoc na Universidade Federal de São Paulo, Escola Paulista de Medicina
^{II}Técnico em Mecânica, Diretor de P&D da Eyetec Equipamentos Oftálmicos Ltda, São Carlos  SP.
^{III}Doutor, Professor Titular da Universidade Estadual de Maringá  PR
^{IV}Doutor, Professor do Instituto de Física de São Carlos, São Carlos/Universidade de São Paulo, Brasil
^{V}Doutor, Opto Eletrônica pelo Instituto de Física de São Carlos/Universidade de São Paulo, Brasil
^{VI}Mestre, Instituto de Física de São Carlos/Universidade de São Paulo
^{VII}Professor Associado do Departamento de Oftalmologia da Universidade Federal de São Paulo, Escola Paulista de Medicina
^{VIII}Professor Livre Docente do Departamento de Oftalmologia da Universidade Federal de São Paulo, Escola Paulista de Medicina
^{Correspondence} Correspondence Caixa Postal 369 CEP 13560970, São Carlos (SP) Email: lavcf@ifsc.sc.usp.br
ABSTRACT
In this project we are developing an instrument for measuring the wavefront aberrations of the human eye using the HartmannShack sensor. A laser source is directed towards the eye and its diffuse reflection at the retina generates an approximately spherical wavefront inside the eye. This wavefront travels through the different components of the eye (vitreous humor, lens, aqueous humor, and cornea) and then leaves the eye carrying information about the aberrations caused by these components. Outside the eye there is an optical system composed of an array of microlenses and a CCD camera. The wavefront hits the microlens array and forms a pattern of spots at the CCD plane. Image processing algorithms detect the center of mass of each spot and this information is used to calculate the exact wavefront surface using least squares approximation by Zernike polynomials. We describe here the details of the first phase of this project, i. e., the construction of the first generation of prototype instruments and preliminary results for an artificial eye calibrated with different ametropias, i. e., myopia, hyperopia and astigmatism.
Keywords: Corneal topography/instrumentation; Ophthalmological diagnostic techniques; Astigmatism/diagnosis; Equipment design; Optometry; Retina/physiopathology; Computerassisted image processing
RESUMO
Neste projeto estamos desenvolvendo instrumento para medidas das aberrações de frente de onda do olho humano usando um sensor HartmannShack. Uma fonte de luz laser é direcionada ao olho e sua reflexão difusa na retina gera frente de onda aproximadamente esférica dentro do olho. Esta frente de onda atravessa os diferentes componentes do olho (humor vítreo, lente, humor aquoso e córnea) trazendo informações sobre as aberrações ópticas causadas por estes componentes. No meio externo ao olho existe sistema óptico formado por uma matriz de microlentes e uma câmera CCD. A frente de onda incide nesta matriz e forma um padrão aproximadamente matricial de "spots" no plano do CCD. Algoritmos de processamento de imagens são utilizados para detectar os centróides de cada "spot" e esta informação é utilizada para deduzir a forma da frente de onda usando métodos de aproximação por mínimos quadrados e polinômios de Zernike. Descrevemos aqui detalhes da primeira fase deste projeto, em que foi realizada a construção da primeira geração de instrumentos protótipos e testes preliminares em olho artificial, calibrado com diferentes ametropias, i. e., miopia, hipermetropia e astigmatismo.
Descritores: Topografia da córnea/instrumentação; Técnicas de diagnóstico oftalmológico; Astigmatismo/diagnóstico; Desenho de equipamento; Optometria; Retina/fisiopatologia; Processamento de imagem assistida por computador
INTRODUCTION
The technological advances in refractive surgery techniques in the past decade have been overwhelming. For the first time ever there is a plausible chance of using corneal topography and eye aberration data to develop algorithms for optimized excimer laser ablations. The main objective is to obtain the best possible visual acuity. The first excimer (from the words excited dimer) lasers for refractive surgery started to operate at mid 1980's and could only correct simple cases of myopia. With the evolution of these lasers we can talk today about pointbypoint corneal ablations with "flying spot" lasers and correction of many other corneal abnormalities, such as irregular astigmatism.
Corneal topography by itself doesn't measure myopia and hyperopia, and in terms of astigmatism, it can determine only the corneal contribution. Axial and tangential maps are good only for measuring differences in corneal refractive power^{(13)}, but not for determining total eye refraction^{(4)}. Data obtained with conventional autorefractors are incomplete because they determine only the best spherocylindrical lens, usually by measuring power in three different meridians^{(510)}. But this is crude information compared to the nonsymmetrical aberrations that occur in the eye, and also compared to the precision with which lasers can ablate the cornea and topographers can measure it. These two equipments can act on much more complicated surfaces than simple torics. The conclusion is evident: the actual autorefractors do not have the required precision; therefore it is necessary to search and develop techniques that can measure refractive error for all points over the entrance pupil.
In 1994, Liang and colleagues^{(11)} from the University of Heidelberg started this search, with an inspiration that came from astronomy. The main principle came from an instrument used in observatories for measuring optical aberrations in images of galaxies and stars, caused by the turbulence of our atmosphere. This instrument, called the HartmannShack (or ShackHartmann) sensor was modified during the 1970's by Shack, Platt^{(12)} after experiments of Hartmann^{(13)} in the beginning of this century.
Since 1994, many laboratories and companies started to research and develop their own techniques for measuring the higher order aberrations of the eye. Some of them use the Tscherning aberroscope technique, others use the HS technique. In this article we describe the first Brazilian instrument that uses principles of the HS sensor for measuring optical aberrations of a test eye, with calibrated optical aberrations.
THE HARTMANNSHACK SENSOR
In this section we will describe in more details the optical and mathematical principals of eye aberration measurements with the use of the HartmannShack (HS) sensor. In the year of 1971 Shack^{(12)} proposed the use of microlens arrays instead of regular Hartmann screens.
The principle of the HS sensor when applied to the eye is very similar to the ScheinerSmirnov aberroscope invented many centuries ago^{(14)}. In the ScheinerSmirnov aberroscope the subject had to tell whether paraxial light rays passing through two holes on a disk, positioned in front of the subject, were joined or not, because the examiner had no idea of what the light ray direction after they entered the eye. Now imagine an opposite direction of propagation of the light rays. Imagine that we could shine a single light beam onto the fovea and, instead of asking the patient what he or she was seeing, in some way we could detect how the light rays came out of the eye. If we take a look at Figure 1 we might understand better the point that we want to make here.
We may notice that a point of light scattered at the retina of a normal eye generates at the exit pupil what we call in physics a plane wavefront. As we all know, light may be described as rays, such as in geometrical optics, or as waves, in physical optics. When describing light as wave phenomena, it has, as any other wave in physics, a wavelength, a velocity, amplitude and a phase (see these parameters in Figure 2).
The phase of a wave is determined by the position of the wave crest. The wavefront of a bundle of rays is determined by the connection of crests of neighboring waves. In Figure 3 we may see two kinds of wavefronts, one that is said to be "in phase" and other that is said to be "out of phase", that is, with aberrations.
Now looking back at Figure 1 we may see that the wavefront that leaves a perfectly emmetropic eye is a plane; for a myopic the optical system is too strong so the wavefront is convergent, and for a hyperopic it is diverging. Notice then that by looking at the light that leaves the eye one can determine the same abnormalities that Smirnov did by shining light towards the eye. It is at exactly this point that the HS sensor makes a big difference, because it allows us to quantify objectively how converging, or diverging, or plane, or whatever format, is the wavefront leaving the eye. In this way it's possible to measure refraction at localized points over the pupil.
Imagine that we put a 15 by 15square array of very small spherical lenses (with 0.5 mm in diameter each) in front of the eyes in Figure 1. Since all lenses have the same focal distance f we may put some kind of light sensor behind them, like a photographic film or, even better, a CCD camera (see diagram in Figure 4). For the first eye, because light has a plane wavefront, when rays hit the HS lenses a symmetric group of equally space spots will form at the CCD plane. For the myopic eye a matrix of spots more gathered towards the center will be formed and for the hyperopic, a matrix of more separated spots.
The most interesting aspect about the HS sensor is that, by comparing the dot pattern of a distorted wavefront with those of a plane wavefront, one may precisely determine the exact shape of the distorted wavefront. This is so because the amount of displacement of each dot is directly proportional to the distortion of the wavefront (see Figure 4).
METHODS
We used the optical diagram depicted in Figure 5 to construct the instrument shown in Figure 6.
IMAGE PROCESSING
A 30 KHz frame grabber installed on an IBM compatible PC was used for digitalization of 640x480 pixel HS images. We used imageprocessing algorithms^{(1516)} for detection of center of mass of HS spots. The image is initially scanned in the horizontal and vertical directions in order to find the regions of higher probability of spot location. A second routine determines the absolute values of the slope of the mean vertical and horizontal signals. A threshold from these curves determines the vertical and horizontal lines that form the cells inside which there is a higher probability of finding a spot. After determination of cell locations, the center of "mass" of each spot is found according to equations:
where p is the gray level intensity of the pixel inside the spot and x an y are the horizontal and vertical positions, respectively, of the pixel. Results of the image processing algorithm may be seen in Figure 7.
The x and y coordinates in pixels are then input into the mathematical formulation that approximates the wavefront surface as the sum of a series of special polynomials, called Zernike polynomials.
WAVEFRONT CALCULATION FROM ZERNIKE POLYNOMIALS
The mathematics to calculate the wavefront distortion is not very trivial because it involves differential calculus and other advanced topics in mathematics. Nevertheless we will make a brief description of these calculations here, and one may skip this discussion without compromising the comprehension of the remaining sections of the manuscript.
In Figure 4 the local slope of the wavefront, in the vertical and horizontal directions of the CCD image plane, may be written as:
where and denote the partial derivatives of the wave aberration function; is the position of the n^{th} spot for calibration of the emmetropic eye (or calibration eye) and is the n^{th }position for the measured ametropic eye. So our goal is to find the aberration function (W). There are several techniques to find a function from a set of its derivatives, but the most popular method in this case has become the approximation using Zernike polynomials^{(17)} and the least square method^{(1819)}. We will not get into the mathematical aspects of why this technique became so popular for describing wave aberrations. What we may state is that one of the strongest reasons is that Zernike polynomials form an orthogonal basis and that it has ideal symmetries for describing optical aberrations. We will see later that each Zernike polynomial is associated with a typical optical aberration.
We may write the wave aberration function as:
where C_{i} are the coefficients of each polynomial and Z_{i} are the corresponding terms of each Zernike polynomial. The objective is to find these coefficients based on the slopes, so we apply the partial derivatives to equation (3):
We now use the least square method to find the best Zernike coefficients that interpolate the derivatives in (2) and to do that we substitute the values in (4) by the derivatives in (1). We may then write the coefficients as:
C = [MT].[DER] (5)where the coefficient matrix C is of the form:
C = [C_{0 }C_{1} C_{2}...C_{14}]^{T} (6)[DER] is the column matrix of derivatives, and [MT] is the transformation matrix obtained by the least square method.
As we may notice in Table 1, each Zernike polynomial is associated with one type of aberration. Besides the higher order aberrations, the low order refraction values may be obtained by coefficients C_{3}, C_{4 }and C_{5}, assuming that the wavefront of the spherocylinder equivalent lens may be written as:
W_{lens}(x,y) = 2C_{3 }xy + 2C_{4} (x^{2}+y^{2}) + C_{5 }(y^{2}  x^{2}) (7)
RESULTS
In Figure 8 we present the wavefront results for the three calibrated ametropies.
The quantitative values for the sphere (f_{D}), cylinder (f_{A}) and axis (a) of the equivalent spherocylinder lens is obtained through equation (7).
The values obtained for the four calibrated ametropies are shown in Table 2.
Mean deviation for sphere and cylinder was 0.68D, and for axis was 14^{o}. Although these values are much higher than the errors expected for spherocylinder measurements on auto refractors (0.125D and 5^{º})^{(8)} our primary goal in these preliminary measurements was not to obtain precision, but to validate the technique. These results are in agreement with the typical aberrations generated on the artificial eye, and some important clues to why the errors were higher than expected may be drawn from certain instrumentation aspects: the type of artificial eye used, the optical components, and other details that may be related to our homemade HS sensor. These and other aspects are discussed in the following section.
DISCUSSION
Preliminary results for the first phase of construction of a HS wavefront sensor, built at IFSCUSP in a venture project with a Brazilian technology industry, Eyetec Equip. Oftálmicos, was presented for calibrated ametropies on an artificial eye. Tests on in vivo eyes should be conducted in the second phase of this project for verification and validation of the technique.
A Heine artifical eye for use in retinoscopy was used. This eye is recommended by the manufacturer for use in retinoscopy training and ophthalmic laboratories. The manufacturer guarantees a precision of "better than 0.5D" [internet address: http://www.heine.com] but does not state an exact mean value. This is not a surprising fact given that other research groups have encountered problems using commercially available artificial eyes for the purpose of wavefront measurements^{(20)}. For this reason, these researchers have organized a task force group (called the VSIA Task Force Group) to implement, among other things, the construction of a standard artificial eye for specific use in wavefront measurements^{(20)}. They also propose a set of standards for the nomenclature and specification for each Zernike polynomial term. In the future they will build artificial eyes based on these standards and allow different laboratories throughout the world to test them, allowing other centers to improve their mathematical algorithms to a standard refraction eye. For this reason we have been unable to determine the absolute precision of our instrument. One of the current implementations taking place is the generation of known formats of wavefronts by the incidence of a plane wavefront on different lenses with wellknown spherical and astigmatic aberrations. This will allow us, even before we have access to a standard calibration eye, to objectively determine the precision of our HS sensor.
Other hypothesis for the imprecision, although less probable, is the need for better optics and more precise determinations of parameters such as focal distance, index of refraction of optical media, magnification. These should not represent major factors for wavefront deviation because almost a single frequency (short band width) is used for the incident light and therefore there is a low probability of monochromatic aberration and precise calibration images for the plane wavefront. Although these factors might be contributing a small amount of deviation to the objective measurements, we may only be sure of them if we are absolutely sure of the aberration of the wavefront that is incident on the HS sensor. We even think that such a precise system is so sensitive to small distance changes in optical components that maybe a calibration wavefront should always be used to reset the parameters of the system, such as the spherical surfaces used to calibrate current corneal topographers.
Our intention here was not to compare precision of the whole refractive instrumentation, therefore we also did not consider accommodation (obviously our artificial eyes do not have an internal lens). Furthermore our intention was to provide insight to how promising the wavefront technique may be when compared to conventional autorefractors, in terms of resolution. An accommodation system, when in wellfunctioning condition, may be applied to our instrument and then absolute precision comparisons with conventional autorefractors, for measurements in the human population, may be undertaken.
In terms of mathematical precision of the implemented algorithms, several theoretical tests were undertaken to assure that computer code was in agreement with expected calculations. An example of these tests may be seen in Figure 9. The upper left image is a theoretical threedimensional graph of an aberration with coma and tilt in the X direction, which is simply the sum of terms Z_{1} and Z_{7} of Table 1, with coefficients C_{1} = C_{7} =1.The central upper image is the retrieved wavefront calculated from the local slopes obtained from the previous graph, using the minimum square method described through equations (2)(7). We may see that they look identical, as they should actually be. The upper right graph and lower left are simply twodimensional contour and color plots of the central upper graph, and in the lower central are the obtained Zernike coefficients. Notice that only coefficients C_{1} and C_{7} are different from zero (equal to 1), as it should be. The lower right graph is the most impressive: it shows that the minimum square algorithm together with Zernike polynomials furnish errors of the order of 10^{15} mm, extremely low compared to the order of magnitude of the wavefront values (approximately 2 mm). These and other computer simulations showed to us that the algorithms used here are indeed very precise, a fact that again called our attention regarding the quality of the artificial eyes used.
An important factor in precision is the amount of micro lenses in the HS sensor. If we double the number of micro lenses in the row and column, the resolution is multiplied by a factor of 4. On the other hand, for highly distorted corneas this might be a disadvantage. In a previous study^{(21)} we have shown, theoretically, by implementing computer simulations of HS patterns for several corneal topographies, that for eyes with severe curvature changes on the corneal surface (such as keratoconus), the HS spots may overlap, preventing the software from the capacity of image processing and data analysis. In these specific cases, conventional trial lens tests with autoprojectors or Snellen tables may still be necessary.
There is a strong belief that the wavefront sensing technology represents the next generation of refractors and that they will gradually take place over conventional refraction, much in the same way that computerized corneal topography took place over traditional keratometry and the photokeratoscopy. Moreover, the wavefront technology will allow for precise corneal ablations, resulting in algorithms that may execute what is being called "customized corneal ablations".
Recebido para publicação em 08.02.2002
Aceito para publicação em 22.07.2002
Results presented here are under international patent pending. This project is financed in part by FAPESP grant #00/068104.
 1. Carvalho L, Tonissi SA, Castro JC. Preliminary tests and construction of a computerized quantitative surgical keratometer [commented on J Cataract Refract Surg 2000;26;11045]. J Cataract Refract Surg 1999;25:8216.
 2. Polisuk P. Introdução e histórico da topografia da córnea. In: Carvalho LAV, Schor P. Topografia de córnea: atlas clínico. Rio de Janeiro: Cultura Médica; 1999.
 3. Carvalho LAV, Tonissi SA, Romão AC, Santos LE, Yasuoka F, Oliveira AC, et al. Desenvolvimento de um instrumento computadorizado para medida do poder refrativo da córnea (videoceratógrafo). Arq Bras Oftalmol 1998; 61:64054.
 4. Klein SA, Mandell R. Shape and refractive powers in corneal topography. Invest Ophthalmol Vis Sci 1995;36:2096109.
 5. Campbell FW, Robson JG. High speed infrared optometer. J Opt Soc Am 1959;49:26872.
 6. Charman WN. A pioneering instrument: the Collin's electronic refractionometer, Opthalmol Opt 1976;16:345.
 7. Cornsweet TN, Crane HD. Servocontrolled infrared optometer. J Opt Soc Am 1976;60:54854.
 8. Ventura L, Sousa SJF, Castro JC. Detection system for ocular refractive error measurement. Phys Med Biol 1998;43:130316.
 9. Ventura L. Sistema de medidas automáticas de vícios de refração ocular [tese].São Carlos: Instituto de Física de São Carlos da Universidade de São Paulo;1995.
 10. Ventura L, Sousa SJ, Masili M, Santos L, Carvalho LAV, Castro JC, Desenvolvimento de um "software" para a determinação automatizada de miopia, hipermetropia e astigmatismo oculares. Rev Fis Apl Instrument 1996; 11:7783.
 11. Liang J, Grimm B, Goelz S, Bille JF. Objective measurement of wave aberrations of the human eye with the use of a HartmannShack wavefront sensor. J Opt Soc Am 1994;11:194957.
 12. Shack RV, Platt BC. Production and use of a lenticular Hartmann screen. In: Meeting of Optical Society of America. Tucson: University of Arizona; 1971. p.656.
 13. Hartmann J. Bemerkungen über den Bau und die Justierung von Spektrographen. Z Instrumentenkd 1900;20:47.
 14. Thibos LN. Principles of HartmannShack aberrometry. J Refract Surg 2000; 16:5405.
 15. Gonzales RC, Woods RE. Digital image processing. Califórnia: AddisonWesley;1992.
 16. Carvalho LAV, Corzine JC, Miller KL, Carney T, Klein SA, Polse KA. A computerbased image processing system for assessment of contact lens translation and rotation. In: Annual Meeting of ARVO (The Association for Research in Vision and Ophthalmology) Fort Lauderdale, Florida May 914; 1999.
 17. Born M. Appendix VII. In: Born M. Principles of optics. Cambridge: Pergamon Press;1975. p. 90507.
 18. DeVries PL. A first course in computational physics. New York: John Willey & Sons; 1994.
 19. Press WH, Flannery BP, Teukolsky SA, Vetterling WT. Numerical recipes in pascal  the art of scientific computing. London: Cambridge University Press;1989.
 20. Thibos LN, Applegate RA, Schwiegerling JT, Webb R. Report from the VSIA taskforce on standards for reporting optical aberrations of eye. J Refract Surg 2000;15:S6545.
 21. Carvalho LAV, Castro JC, Schor P, Chamon^{ }W. A software simulation of HartmannSchack patterns for real corneas. In: International Symposium. Adaptive optics: from telescopes to the human eye. Murcia, Spain; November 1314, 2000. Proceedings.
Publication Dates

Publication in this collection
13 Oct 2003 
Date of issue
June 2003
History

Received
08 Feb 2002 
Accepted
22 July 2002