RT Journal Article SR Electronic T1 PatchWarp: Corrections of non-uniform image distortions in two-photon calcium imaging data by patchwork affine transformations JF bioRxiv FD Cold Spring Harbor Laboratory SP 2021.11.10.468164 DO 10.1101/2021.11.10.468164 A1 Ryoma Hattori A1 Takaki Komiyama YR 2021 UL http://biorxiv.org/content/early/2021/11/13/2021.11.10.468164.abstract AB Two-photon microscopy has been widely used to record the activity of populations of individual neurons at high spatial resolution in behaving animals. The ability to perform imaging for an extended period of time allows the investigation of activity changes associated with behavioral states and learning. However, imaging often accompanies shifts of the imaging field, including rapid (∼100ms) translation and slow, spatially non-uniform distortion. To combat this issue and obtain a stable time series of the target structures, motion correction algorithms are commonly applied. However, typical motion correction algorithms are limited to full field translation of images and are unable to correct non-uniform distortions. Here, we developed a novel algorithm, PatchWarp, to robustly correct slow image distortion for calcium imaging data. PatchWarp is a two-step algorithm with rigid and non-rigid image registrations. To correct non-uniform image distortions, it splits the imaging field and estimates the best affine transformation matrix for each of the subfields. The distortion-corrected subfields are stitched together like a patchwork to reconstruct the distortion-corrected imaging field. We show that PatchWarp robustly corrects image distortions of calcium imaging data collected from various cortical areas through glass window or GRIN lens with a higher accuracy than existing non-rigid algorithms. Furthermore, it provides a fully automated method of registering images from different imaging sessions for longitudinal neural activity analyses. PatchWarp improves the quality of neural activity analyses and would be useful as a general approach to correct image distortions in a wide range of disciplines.Competing Interest StatementThe authors have declared no competing interest.