Abstract
Background Motion correction is a challenging pre-processing problem that arises early in the analysis pipeline of calcium imaging data sequences. The motion artifacts in two-photon microscopy recordings can be non-rigid, arising from the finite time of raster scanning and non-uniform deformations of the brain medium.
New method We introduce an algorithm for fast Non-Rigid Motion Correction (NoRMCorre) based on template matching. NoRMCorre operates by splitting the field of view into overlapping spatial patches that are registered at a sub-pixel resolution for rigid translation against a continuously updated template. The estimated alignments are subsequently up-sampled to create a smooth motion field for each frame that can efficiently approximate non-rigid motion in a piecewise-rigid manner.
Existing methods Existing approaches either do not scale well in terms of computational performance or are targeted to motion artifacts arising from low speed scanning, whereas modern datasets with large field of view are more prone to non-rigid brain deformation issues.
Results NoRMCorre can be run in an online mode resulting in comparable to or even faster than real time motion registration on streaming data. We evaluate the performance of the proposed method with simple yet intuitive metrics and compare against other non-rigid registration methods on two-photon calcium imaging datasets. Open source Matlab and Python code is also made available.
Conclusions The proposed method and code provide valuable support to the community for solving large scale image registration problems in calcium imaging, especially when non-rigid deformations are present in the acquired data.