NoRMCorre: An online algorithm for piecewise rigid motion correction of calcium imaging data

J Neurosci Methods. 2017 Nov 1;291:83-94. doi: 10.1016/j.jneumeth.2017.07.031. Epub 2017 Aug 3.


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 (FOV) into overlapping spatial patches along all directions. The patches are registered at a sub-pixel resolution for rigid translation against a regularly updated template. The estimated alignments are subsequently up-sampled to create a smooth motion field for each frame that can efficiently approximate non-rigid artifacts in a piecewise-rigid manner.

Existing methods: Existing approaches either do not scale well in terms of computational performance or are targeted to non-rigid artifacts arising just from the finite speed of raster scanning, and thus cannot correct for non-rigid motion observable in datasets from a large FOV.

Results: NoRMCorre can be run in an online mode resulting in comparable to or even faster than real time motion registration of streaming data. We evaluate its performance with simple yet intuitive metrics and compare against other non-rigid registration methods on simulated data and in vivo two-photon calcium imaging datasets. Open source Matlab and Python code is also made available.

Conclusions: The proposed method and accompanying code can be useful for solving large scale image registration problems in calcium imaging, especially in the presence of non-rigid deformations.

Keywords: Calcium imaging; Image registration; Motion correction.

MeSH terms

  • Algorithms*
  • Animals
  • Artifacts*
  • Calcium / metabolism*
  • Computer Simulation
  • Hippocampus / cytology
  • Hippocampus / metabolism
  • Mice
  • Models, Neurological
  • Motion*
  • Neurons / cytology
  • Neurons / metabolism
  • Parietal Lobe / cytology
  • Parietal Lobe / metabolism
  • Software
  • Voltage-Sensitive Dye Imaging / methods*


  • Calcium