ZenReg: A modular Python platform for fast and memory-efficient N-dimensional microscopy image registration
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Motion artifacts are almost unavoidable in functional time-lapse and structural volumetric multiphoton microscopy. They arise from respiration, heartbeat, locomotion, awake behavior, instrument heating, mechanical vibration, and slow drift, while the recorded signal is often photon-limited, blurred by scattering, and biologically time varying. Consequently, motion correction is frequently an essential prerequisite for quantitative bioimage analysis rather than a merely cosmetic preprocessing operation. Edge- and landmark-centric registration strategies are often poorly matched to these data because useful structures may be sparse, diffuse, out-of-focus, or changing in fluorescence intensity. We present ZenReg, an open-source Python platform that formulates common 2D+t, 3D, and 3D+t microscopy registration tasks as a modular family of geometry-preserving alignment problems. ZenReg combines Fourier phase correlation, intensity-based StackReg-style alignment, NoRMCorre-style piecewise translation fields, projection-based rotation estimates, dense SimpleITK-based six-degree-of-freedom volume registration, and sparse point-based rigid-volume registration within one canonical microscopy stack model. The platform uses OMIO to normalize heterogeneous microscope files and to preserve metadata, while optional disk-backed Zarr arrays support chunked, memory-efficient processing of image stacks that exceed available memory or reside on remote storage. ZenReg writes registered images together with shift tables, correlation metrics, summary plots, and machine-readable settings. In synthetic benchmarks with known ground truth, ZenReg recovered global 2D and 3D translations with subpixel accuracy across moderate noise and drift regimes, while high-noise and large-drift tests separated the backend behavior: FFT-based methods failed abruptly once image information or shared support became insufficient, StackReg degraded more gradually under severe noise, and piecewise NoRMCorre improved spatially varying local-motion correction where a single global transform was inadequate. Parallel execution reduced runtime for large time series, and ZenReg provided practical full-volume rigid correction for dense and puncta-rich 3D+t stacks. By coupling a modular, extensible backend architecture to transparent sidecar outputs, ZenReg makes motion correction easier to extend, inspect, share, reproduce, and reuse as part of scientific image analysis.