Corneal thickness measurement by secondary speckle tracking and image processing using machine-learning algorithms

Abstract. Corneal thickness (CoT) is an important tool in the evaluation process for several disorders and in the assessment of intraocular pressure. We present a method enabling high-precision measurement of CoT based on secondary speckle tracking and processing of the information by machine-learning (ML) algorithms. The proposed configuration includes capturing by fast camera the laser beam speckle patterns backscattered from the corneal–scleral border, followed by ML processing of the image. The technique was tested on a series of phantoms having different thicknesses as well as in clinical trials on human eyes. The results show high accuracy in determination of eye CoT, and implementation is speedy in comparison with other known measurement methods.


Introduction
Corneal thickness (CoT) measurement has gained relevance in recent years. Evaluation of CoT is performed in a wide range of disorders and procedures, such as refractive surgery, assessment of ocular hypertension, corneal disease, and glaucoma. 1,2 It is also an increasingly important measurement for precise evaluation of patients' intraocular pressure (IOP). 3 Ultrasound pachymetry (UP) is the most commonly used method to measure CoT. Although UP is accurate, easy to use, and relatively inexpensive, an invasive procedure necessitates a cooperative patient and use of anesthetic eye drops, and it may also be a source of infection. 4 An alternative way of measuring CoT is by noncontact imaging techniques. One such method is optical coherence tomography (OCT), which is similar to ultrasonography imaging but uses light instead of acoustic waves. Twodimensional cross-sectional microscopic images of tissue are created by OCT from multiple scans of backscatter light versus depth. [5][6][7][8][9] Another approach to CoT measurement is possible by the use of a rotating Scheimpflug camera, producing a 3-D scan of the anterior eye segment. 10,11 The use of a specular microscope to photograph and examine human endothelial cells is also possible in CoT evaluation. This method involves applanation of the cornea with a dipping cone mounted on the objective. [12][13][14] An additional noncontact way to measure CoT is by optical low-coherence reflectometry (OLCR). This allows measurement of the amplitude and relative phase of backscattered or reflected light, although the presence of high frequency noise affects the measurements. 15 OLCR consists of a Michelson optical interferometer, a light source, a beam splitter, and a light detector. 16 Noncontact methods do not require topical anesthesia and the procedures are relatively simple; however, the results differ substantially from those of UP [17][18][19][20][21] and the reduced precision of CoT measurement could also affect IOP evaluation.
To measure IOP, opthalmologists often use applanation tonometers. Various studies show that the precision of applanation tonometers depends on CoT. [22][23][24][25][26][27] Normally, thinner corneas lead to lower IOP readings and thicker corneas to higher ones. 3 Most of the current IOP measuring devices, such as the Goldmann applanation tonometer (GAT), the gold standard in IOP examination, enable the reading of IOP but lack the ability to measure CoT simultaneously, and have the additional drawback in needing two different devices to measure CoT and IOP. Combined measuring devices, such as noncontact tonometers that measure both IOP and CoT, have a lower precision level than that obtained by GAT. 28 The current work presents machine-learning (ML) networks able to learn and classify the laser-based secondary speckle patterns (SSP) reflected from the tissues. The method allows evaluation of peripheral CoT with high accuracy and faster than obtainable by traditional methods. Recently, we used reflected SSP technology for semicontinuous noninvasive IOP measurement. 29 It was noted that the measurement of corneal or scleral thickness is required to introduce corrections for noncontact IOP measurements. In the current research, CoT was measured for the first time using a novel technique based on speckle tracking and processing of information by ML algorithms. In this research, we combined CoT and IOP measurements on the same device using speckle-based technology. It allows including CoT for correction and accurate semicontinuous, noninvasive measurement of IOP.

Background of the Proposed Technology
The proposed technology contains further development for IOP evaluation, which is based on the tracking of tissue back reflected speckle patterns. A laser beam illuminates the tissue surface and the back scattered light is captured by a fast camera. When wavefronts are back reflected from a rough surface and are summed up on the detector plane, a random intensity pattern appears due to the interference phenomenon. Those patterns are known as secondary or subjective speckles. In our experiment, the diverse SSPs reflected from the series of phantoms having different thicknesses were captured by a fast imaging camera.
The underlying principle of the proposed method is that the tilting movement can be detect using only a laser and a defocused fast camera in order to transform this movement into a transversal shift of the speckle patterns. 30,31 By doing so, the tissue's vibrations cause the speckle patterns to shift in time, with the shift being proportional to the extent of tilting occurring in the illuminated surface.
The camera's requirement for focal length F is 30 E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 1 ; 6 3 ; 5 7 6 F ¼ where Δx is the pixel size in the detector, λ is the laser wavelength, Z 2 is the distance between the illuminated surface and the secondary speckle (due to defocusing), Z 3 is the distance between the secondary speckle and the imaging module, D is the diameter of the laser spot, and K is the minimum number of pixels, in which it is assumed that every speckle in this plane will be seen. The far-field approximation needs to be kept by Z 2 : E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 2 ; 6 3 ; 4 4 5 Z 2 > D 2 4λ : The assumption behind our technique is that increase of tissue thickness, contributes the light scattering from an object, and consequently causes reduction of the average speckle size throw the image (see Fig. 1 for illustration). Furthermore, the overall speckle image undergoes several changes. The ML algorithms can find those features.
The reason that the size of the defocused speckles, being collected by the camera, depends on the amount of scattering of the inspected medium, is related to the fact that larger scattering coefficients increase the average path of light (diffusion of light) and thus generate on the surface of the scattering medium a larger spot of diffused light. In the far-field plane (defocused speckles), the spot of light on the surface of the medium sets the size of the collected speckles (larger spot yields smaller defocused speckles): E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 3 ; 3 2 6 ; 7 3 0 Thus the size of the defocused speckles is inversely dependent on the size of the diffused spot of light generated on the surface of the scattering medium. This assumption is also supported in the scientific literature, 32,33 for instance by the model presented in Ref. 32 where the scattering coefficient of the medium sets an effective location of a master and slave light sources that properly fulfill the light diffusion equation where the position of the master source from the surface of the scattering medium is set by E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 4 ; 3 2 6 ; 5 9 2 and of the position of the slave source is set by E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 5 ; 3 2 6 ; 5 3 9 where E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 6 ; 3 2 6 ; 4 8 4 g is the scattering anisotropy of the inspected medium, μ s is the scattering coefficient, and n is an open parameter depending on the modeling as presented in Ref. 32. So the distance of the effective light source depends on the scattering properties of the inspected medium. This means that the size of the speckles varies since their dimensions depend on the effective distance as presented in Eq. (3). This assumption of the dependence between the speckle size and the amount of scattering is also experimentally supported by Ref. 33 (relevant measurements are presented in Fig. S6 of the reference).

Speckle Image Transformation Tracking
The variation in speckle pattern images captured by fast camera, being related to the illuminated surface structure or thickness, can be analyzed by several methods, including cross-correlation or ML algorithms, as described below.

Cross correlation
The cross-correlation method was used to calculate correlation across the different axes of the image, given that two speckle pattern images differ only by an unknown shift. The crosscorrelation function can be used to determine the image shift along the same axis. When the images match, the value of the cross-correlation function is maximized.
Autocorrelation is the cross correlation of a signal with itself. In order to calculate the average feature size, a normalized autocorrelation is defined 34 E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 7 ; 3 2 6 ; 1 2 8 where I represent the speckle intensity and u is the displacement. The width of the autocorrelation peak under A ¼ 0.5 was found to be related to the average speckle size (in pixels). 34 We tried cross correlation along the X axis for CoT partition and identified a correlation of 4 to 6 pixels only, which was found to be insufficient for successful CoT separation.

Machine-learning algorithms
ML 35 refers to computer systems used to effectively perform a given task without using specific instructions while relying only on captured data (which in our case are the speckle image). ML algorithms create a mathematical model of sample data, known as "training data," in order to make predictions or decisions on other types of data without being explicitly programmed to perform the assignment. We used two ML network architectures to recognize different CoT variations.
Convolution neural network with classification/regression layer architecture. For the first time, a convolution neural network (CNN) 36 with classification/regression architecture was used to analyze nonlinear image features and establish an accurate predictor based on CNN training using SSP images.
The functions described below were applied in the network.
Rectified linear units.
Rectified linear units (ReLU) were applied as nonlinear functions for network training. These grant flexibility during training and show a good fit to image data. Activation is simply defined as threshold at zero.
Fully connected layer.
The fully connected layer function is applied at the end of the network before classification to reduce the output size to the number of classifications while preserving all the neurons data. 37 It is the most accepted layer type for common neural networks: neurons between two adjacent layers are fully connected pairwise, yet no connection exists in a single layer.
The Softmax function takes an un-normalized vector and normalizes it into a probability distribution. In neural networks, it is employed to map un-normalized output to a probability distribution over a predicted output class.
ML methods were used to process and classify speckle pattern images with a goal of determining the object thickness. The CNN architecture used can be seen in Fig. 2.

Experimental Setup
A diagram of the experimental setup for phantoms having tissue-like properties is presented in Fig. 3.
The system contains a laser and a fast camera for monitoring SSP reflected back from the object. The camera's focal length was 55 mm, with an F number of 2.8, and the illuminating beam was 3-mm in diameter. In the tissue-like phantoms a HJ 532-nm green laser was used for illumination and the speckle patterns created were recorded by a PixeLINK high-sampling-rate digital camera. The camera was positioned 35 cm away from the tested object (phantoms/human eye) and has no position constraints due to the wide angle of speckle diffraction. The illumination beam was directed at the center of the liquid phantom, placed in a Petri dish. For testing human eyes, a JDS Uniphase CW 1550 nm WDM DFB laser was positioned directly opposite the eyeball at distance of 32 cm. The laser beam was fixed at a selected location on the cornea. The power of the infrared laser was limited to the safety range (750 μW) approved by European Standard EN 60825-1. The speckle patterns reflected back from the cornea were captured using an EHD Imaging InGaAs IK1112 digital camera.
The tested objects were illuminated for 3 s and the camera captured the speckle images with a frequency of 200 frames per second. A total of 600 random speckle images were captured for each CoT that was tested in order to have a representative database of pictures for postprocessing analysis. However, the duration of illumination and the number of images could  be reduced without affecting the accuracy of measurement. Increasing the camera frame rate will reduce the measurement time dramatically.

Liquid Phantom Preparation
The current work assumes that tissue-like phantoms (with the same scattering coefficient) having different thicknesses could be identified by analyzing SSP reflected from an object illuminated by a laser beam. At the first stage, we tried to prove that our ML network has a stable network architecture that can detect tissue-like phantom with different thicknesses.
It is well established that the phantoms and human cornea can differ in their optical properties, but if we have high accuracy throughout our ML test, we may conclude that this tool is suitable for estimation of CoT in vivo, which was proved later experimentally.
The technique was examined with different coherent light wavelengths, exposure times, and resolutions to determine which parameters influence the measurement precision. Liquid phantoms with different thicknesses were prepared and placed in a Petri dish (35- 40 Seventeen phantoms having thicknesses from 0.4 to 0.8 mm, with 0.025-mm increments, were created and the Petri dish was measured as a reference. The selected thickness range covers the entire CoT variation of the human eye. Three repetitions were conducted for each wavelength, exposure time, and image resolution. Six hundred frames were taken as a database for our ML algorithm. Finally, the results of the experiment were analyzed and compared for different resolutions, cases, wavelengths, and network architectures. The experiments showed that the wavelength and pixel resolution have a diminutive effect on the phantom thickness (PhT) measurement, compared with intensity and speckle pattern size and variation having significant influence on the results.
The experimental setup structure is presented in Table 1. Different wavelengths, exposure times, and resolutions were examined on different PhTs, and the mean absolute error was evaluated.
In order to show that our network is reliable and has good generalization to predict CoT, we let the network forecast several similar tests combined together. The predicted results are shown in Table 2.

Human Eye Measurements
Measurements of CoT were performed in the Bar-Ilan Optometry Department. The experimental protocol was approved by the internal board of ethics committee of Bar-Ilan University. The applied laser system has a laser safety certificate for biomedical measurements on human eyes.

Reference eye cornea measurement by pachymetry
Pachymetry measurements of CoT were performed by a qualified technician with a view to obtaining reference data. Our ML methods were later compared with the pachymetry results in order to evaluate the accuracy of the speckle-based CoT measurement under eye safe laser illumination. The device used for the measurements was TOMEY TMS-5. The device accuracy 41 according to the specification is 20 μm by the spherical accuracy factor. 10 eyes on subjects aged 23 to 72 were tested for CoT assessment. The left and right eye in each individual was tested three times and the median result was taken into account.
The CoT in the center and nasal side of the eye was analyzed using standard pachymetry equipment, as presented in Fig. 4.

In vivo human eye measurements
The 10 human eyes tested for CoT evaluation by pachymetry were also tested by our speckle-based method. The monitoring device was positioned at a distance of 32 cm from the eye. A diagram of the experimental setup for the measurement is presented in Fig. 5.
As shown in the previous phantom experiments (Sec. 3.2), the method has very low wavelength dependence and therefore the tested eyes were illuminated by a JDS Uniphase CW 1550 nm WDM DFB eye safe laser. An EHD Imaging InGaAs IK1112 digital camera in defocused mode was used to capture reflections from the cornea. Focusing was performed on a focal plane that fulfilled the far-field conditions of diffraction with respect to the reflecting surface, which in the current case was the nasal side of the eye at the cornea-sclera limit. The pupil of the eye absorbs most of the energy so we could not test the entire cornea surface due to safety regulations limiting laser power dispassion to be below 1 mW.
Each frame of the camera's output represents an SSP. The speckle patterns were analyzed with our ML algorithm using MATLAB (The MathWorks Inc., Massachusetts) to evaluate CoT.
The results were compared with those of the pachymetry measurements.

Corneal Thickness Evaluation by CNN with Classification Layer
A classification network containing speckle patterns recording was developed as a first step toward evaluation of the CoT by ML. Splitting videos captured from the illuminated phantoms were subdivided into 18 categories in the range of 400 to 800 μm (covering the human CoT range) with increments of 25 μm. A green laser with a wavelength of 532 nm and 32 × 32 pixels resolution camera were used for the experiment. All combinations of the three described types of network architecture and two training options were tested after being found suitable for the task. We trained and evaluated CNNs using the different architectures described above. CNN classifiers were tested to generate probability scores. The network contained the following sections: imageInputLayer, convolution2dLayer, batchNormalizationLayer, ReLU layer, and maxPooling2d-Layer, found to be the best for training (Fig. 6).
The blue curve represents the training data fit, and the black curve represents the test data fit. The result shows 70.83% Fig. 4 Result of eye CoT measurement by pachymetry. accuracy on test data (20% of data was used in the test). The maximum classification error of the network on test data was 75 μm, and the mean absolute error along the entire prediction vector was 8.125 μm.
We then evaluated the confusion matrix of test labels in comparison with the predictions on test data of our network. The results show a strong true label prediction match over different classes (strong confusion matrix diagonal), indicating good classification results of the test data.
As a result of our high-quality developed network, a very low absolute mean error was obtained on the test data-below 10 μm, matching the current standard equipment error.

Corneal Thickness Evaluation by CNN with Regression Layer
To analyze the nonlinear image features and to establish the most accurate predictor based on CNN network architecture, the regression network was applied. The regression layer could find the best fit to the nonlinear data while training. The experimental data were collected in a tensor and vector containing matching labels that describe the origin of the data. The tensor was constructed from the different videos recorded for different CoTs with one color channel (gray level image). The data were shuffled randomly so that the network would not "desire" obtaining one thickness from the others. The experimental data were split: 80% for training and 20% for test/validation purposes to examine if the CNN model with a total of 2160 random speckle pattern images were predicted on the test, which makes the prediction very reliable. The images ware normalized to the range (0, 1) for fast and accurate training. Normalization helps the network to train better on different features with a different scale of values because the steps are constant across the training on normalized values. The data were uniformly distributed across the training data after shuffling randomly. The image input was constructed to have 32 × 32 pixels with one color channel (the speckle is gray level-based because the laser is in one wavelength only).
The following network architecture was used for an input gray image of 128 × 128 pixels.
1. Five convolution layers were used for the network with filters of size 3 × 3 (pixels) convolving over the image to capture small features.
2. After each convolution layer, a batch normalization layer was used to speed up the training process (as explained regarding the gradient).
3. The ReLU nonlinear function was used to learn the nonlinear features of the image and obtain the best fit of data.
4. The network size was reduced by max pooling, which takes a 2 × 2 pixels window from the image and averages the pixels, decreasing the network by a factor of 2 in each dimension.

5.
A fully connected layer was used to connect all output neurons from the previous layer to one output and attach it to the regression layer, which is optimized to reduce the root-mean-square error (RMSE) of the network by optimizing the network weights across the training data.
The optimizer used for the regression layer was stochastic gradient descent and the network was trained for 30 epochs, with an initial learning rate of 1 × 10 −3 and a learning rate drop factor of 0.1 after 20 epochs.
The validation data were tested along the process and showed a small training-test gap, reflecting a low generalization error in the model. The training results with regression are presented in Fig. 7.
The training results of the regression network show a fit error as low as 0.04, with a low generalization gap between training and test results, indicating a high-quality network. The mean absolute prediction error obtained from the test results (20% of data, 2160 images) after 30 epochs was 24.740 μm, with an RMSE of 0.04.
The test data accuracy for different threshold values is presented in Fig. 8.
In 99.21% of the cases, the network predicts the correct value ∓100 μm absolute error from the real thickness of the tested cornea. This shows very high accuracy with the 2160 images tested after network training. The mean predictor error is only 24.74 μm and this can be improved by higher division of the CoT range in the experiment.
To make sure that the network is reliable and has good generalization of CoT, we predicted the data from an additional Journal of Biomedical Optics 126001-6 December 2019 • Vol. 24 (12) experiment, in which the network had not been trained. This means that the network was trained in the first data set and tested in the additional data set obtained separately. The results are presented in Table 3. Table 3 shows high-accuracy close to the original test data, low RMSE fit error, and good mean prediction error on test results when using the network on new experimental data. This demonstrates good generalization of the network, with reliability for future experiments and predictions.

Pachymetry eye thickness measurements
We used pachymetry as reference measurements in order to compare the results with the speckle-based technique. The eye thickness measurement was repeated three times and the mean value, variance, and median were extracted. The test results for the 10 eyes (nasal side) are presented in Table 4.
We used pachymetry as a reference to our measurements while comparing the results with our speckle-based technique. The center of the cornea has higher absorption than the nasal side of the eye and we could not use a laser safe tool to test the center of the cornea. Thus we used only the nasal side of the subject's eye. The eye thickness measurement was repeated three times and the mean value, variance, and median were extracted. The test results for 10 eyes (nasal side) are presented in Table 4.     Table 4 shows that the pachymetry device has a variance of 117.98 μm, with a low error rate of 15.5 μm (mean error of measurement between the minimum and maximum values from the three measurements conducted). This error can occur due to the human factor in measuring the CoT or due to the equipment itself, both being critical factors in the measurement, with no way to distinguish between the errors. The mean and median are equally good in estimating the experimental error.

4.3.2
In vivo speckle-based corneal thickness testing with machine-learning data processing All subjects tested by the pachymetry method were tested with the speckle-based method and ML algorithm. The secondary speckle images were recorded using the setup as explained.
In order to neglect eye motion factor, training was conducted on the delta between consecutive images. The delta also helps to focus only on the speckle pattern inside the image and eliminate any other constant objects that can affect the training process. Training only on the speckle pattern without the background prevents the network from converging into the object background instead of the speckle pattern in which we are interested. We took five eyes as training data with an equal number of images (600 frames for each subject). An equal distribution of training data along the different CoTs ensures equal training for each CoT without preferring one thickness over others.
The training network results are presented in Fig. 9, showing the RMSE fit of the network while training versus the number of iterations after 10 epochs of training on the entire dataset. A low RMSE gives a better fit for data.
The optimized RMSE value of 0.031 was found after 10 epochs of training, and the results of training and test data were good.
In order to test the quality of our model, a second test was performed, in which a prediction was made on two new eyes that had not been used for training (which the network was not familiar with). Those eyes were tested with the same network architecture trained in the previous test. For reference purposes, the CoT was evaluated by pachymetry, giving values of 716 and 719 nm. The testing part contained 1200 images with different random speckle patterns. Considering the generalization gap and the quality of prediction, the results show high accuracy of the method. The result showed the accuracy of the network along all test images while using different permissible thresholds of the allowed error. For example, if the threshold is set to 50 μm and the regression network predicts a CoT with a AE50-μm error, it is considered a good prediction and anything above is considered a false prediction. If 50% of the test data is below this threshold, the prediction accuracy is 50%. For a threshold of 75 μm, the accuracy is already above 95% of data inside this boundary. For a 100-μm threshold, we achieved 100% accuracy for all our data. A summary of the regression network on human eyes is presented in Table 5.
A comparison with known measurement tools such as OLCR, UP, specular microscopy (SM), and Pentacam (Scheimpflug method) can be seen in Table 6.
The time of our speckle-based measurement with ML was 1∕200 s per frame (it can be reduced dramatically) and shows a good fit for TOMEY TMS-5. We found a mean prediction absolute difference of 26 μm with a small ML eye database as described, and the device accuracy of TOMEY was found to be 20 μm.
Thus it can be assumed that the total true network error can be somewhere around 46 μm (measurement error of 26 μm at most, depending on the 20-μm optical lab accuracy as described).
To conclude, we developed a very accurate measurement tool for CoT estimation based on the ML network.

Conclusions
CoT measurement is an important factor for accurate evaluation of IOP. A technique using a recording of SSPs and evaluation by a regression network based on CNN architecture was introduced in order to estimate CoT on the scleral border. The technique was  also shown to apply successfully on human eye as an example of biological tissue. It was found that CoT evaluation could be treated as a classification problem. The different classes have different features as showed by our ML network and by the used scanning filters. The problem of CoT estimation can also be treated as a regression problem, giving accurate estimation. The ML-based method was demonstrated to be reliable in terms of accuracy (26 μm of mean fit error) being on the level of pachymetry precision. The measurement is simple and fast, with the test taking only a few seconds. The testing period can be shortened by selecting a camera with higher frequency. It was shown that speckle-based measurement of IOP and CoT could be done simultaneously on the same device, whereas the CoT value could be used as a correction factor for IOP evaluation.

Disclosures
The authors declare that there are no conflicts of interest related to the research presented in this article.