The vertical white lines in the target image in Fig. 2 mark the image discontinuities due to microsaccades accounted for by the strip-based affine registration; however, localized mismatch still remains in the aligned images after this affine registration step. The next step in our algorithm is to compensate for the smoother tremor and drift motions represented by image warping and distortion, by using nonrigid registration. Prior to nonrigid registration, a averaging filter was applied to both the template and the aligned strip to smooth any fine speckle that may affect the nonrigid registration. The template and aligned strips were both then zero padded by 15 pixels. For each pixel, in the strip, the normalized cross-correlation31 was calculated, defined as Display Formula
(3)where is the matrix field centered on the pixel of the template image, is the mean of the image in the region under the mask, is the mask matrix centered on the pixel of the strip, and is the mean of the mask. This was also done for , , , 5 deg, 10 deg, and 15 deg rotated field matrices. The pixel located at the index of the maximum normalized cross-correlation was then used as the registered pixel for the strip. Figure 2 shows a pictorial schematic of the registration pipeline described in this section. A smaller field of view demonstration of the coarse, affine, and nonrigid registration steps is shown in Fig. 3. The stack of registered strips could then either be combined by taking the mean or median to generate a higher quality image.