Algorithm 1.
Automated image registration procedure (Fig 4) to find the least off-center patch from a given commodity camera video frame. The whole slide image is split into N overlapping 800 × 800 px patches. “Three or fewer patches spatially removed” means any In must be (i) Iprior, (ii) adjacent to Iprior, (iii) adjacent to a patch adjacent to Iprior, or (iv) adjacent to a patch adjacent to an Iprior-adjacent patch. In this way, In is restricted to a spatial neighborhood localized around the prior match, typically improving image registration performance because most slide movements are small. On lens change, (i) the patch at lower magnification and (ii) the patches at higher magnification covering the same area as the current magnification’s neighborhood are considered for registration only.