The initial guess was obtained through the identification of 36 nodal points spanning the whole width of the scan and connected with linear interpolation. Due to the bright, linear, and quasi-horizontal appearance of the retinal layers in the scans, these points were selected from those of the horizontal edges, conventionally defined by the magnitude of vertically oriented gradients of intensity. To detect the edges, the image was preprocessed using Gaussian filtering (sigma = 3 pixels, kernel size = 6 pixels) to remove noise (
Fig. 4a), and then the magnitude of the vertical component of the gradient was calculated using the Sobel gradient operator.
20 The result of this operation was a new image of the same size of the original one, where the value at each pixel was the magnitude of the vertical gradient at the corresponding location in the original image (
Fig. 4b). Then, 36, 14-pixel wide columns (
ci, i = {1, …, 36}), equally spaced and spanning the whole image-width, were selected. The left and right halves of the first and last columns, centered on the edges of the image, were discarded. Then, all values in each column were averaged across the rows to obtain 36 vertical profiles of the averaged gradient (
vpi) (
Fig. 4c). The average was used to weaken the impact of localized, vertical gradients. These vertical profiles were analyzed to identify their peaking values. The peaking values were used in the selection of 36 points
p(
i)
, i = {1, …, 36}
, centered in the middle of the respective column
ci and vertically located at the location of the peak. Peaks were identified separately for the initial guesses of the ILM, RPE, and ISOS, to obtain three sets of 36 nodal points:
pILM(
i),
pRPE(
i) and
pISOS(
i), respectively (
Fig. 5). Of the two highest peaks in each
vpi, the one closer to the top edge of the image was selected as
pILM(
i) (
Fig. 5a). The closest peak to the bottom of the image, of those below the ILM and higher than half the highest peak below the ILM, was defined as
pRPE(
i) (
Fig. 5c). To detect the points of the ISOS, each
vpi was multiplied by a gamma probability density function (
gpdf), with the origin shifted 20 μm above the RPE, oriented toward the top of the image and defined by the shape parameter k = 1.84 and scale parameter θ = 58 μm. The resulting statistical mode of such
gpdf was approximately equal to 80 μm. The
gpdf was designed so that the multiplication
vpi *
gpdf would strengthen the peaks of
vpi close to the peak of
gpdf and cancel out peaks below or closer than 20 μm to the RPE. Then, the points
pISOS(
i) were selected as the highest peaks in the profiles
vpi *
gpdf (
Fig. 5e). If the algorithm could not identify any of these peaks, the relative points for the initial guess were discarded. Finally, the initial guesses for the ILM, RPE, and ISOS were obtained by linear interpolation of the identified nodal points
pILM(
i),
pRPE(
i), and
pISOS(
i).