Cellocity: A Python package for analysis of confluent cell layer dynamics

Studying the coordinated cell and tissue movements within confluent cell layers can give insights into diverse biological phenomena, such as wound healing, cancer cell metastasis, and host cell responses to infection. Cellular dynamics studies typically rely on analysis of time lapse images, generated by live cell microscopy. As a result of recent progress in stem cell and developmental biology, it is now often possible to generate confluent cell layers of primary cells that recapitulate central features of intact tissues (Dutton et al., 2019). However, one disadvantage of such primary cell model systems is that it remains technically challenging to generate and image fluorescently labeled live samples. This complicates the use of segmentation and single-particle tracking as a means to study cellular movements (Danuser & Waterman-Storer, 2006). Consequently, optical flow-based analysis of bright field (black and white) microscopy images provides a competitive method to extract cell dynamics information from such sensitive and low-contrast experimental model systems (Vig et al., 2016). Because the study of confluent cell layer dynamics lies at the intersection of biophysics and cell biology, two research communities with different emphasis on mathematics, there is a need for a simple and easy-to-use framework that performs and visualizes Optical Flow analysis of microscopy data. We here present Cellocity, a Python package for Optical Flow and Particle Image Velocimetry (PIV) analysis, specifically catering to the bioimaging community.


Summary
Studying the coordinated cell and tissue movements within confluent cell layers can give insights into diverse biological phenomena, such as wound healing, cancer cell metastasis, and host cell responses to infection. Cellular dynamics studies typically rely on analysis of time lapse images, generated by live cell microscopy. As a result of recent progress in stem cell and developmental biology, it is now often possible to generate confluent cell layers of primary cells that recapitulate central features of intact tissues (Dutton et al., 2019). However, one disadvantage of such primary cell model systems is that it remains technically challenging to generate and image fluorescently labeled live samples. This complicates the use of segmentation and single-particle tracking as a means to study cellular movements (Danuser & Waterman-Storer, 2006). Consequently, optical flow-based analysis of bright field (black and white) microscopy images provides a competitive method to extract cell dynamics information from such sensitive and low-contrast experimental model systems (Vig et al., 2016). Because the study of confluent cell layer dynamics lies at the intersection of biophysics and cell biology, two research communities with different emphasis on mathematics, there is a need for a simple and easy-to-use framework that performs and visualizes Optical Flow analysis of microscopy data. We here present Cellocity, a Python package for Optical Flow and Particle Image Velocimetry (PIV) analysis, specifically catering to the bioimaging community.

Statement of need
To date, Optical Flow and PIV analysis of microscopy data has primarily relied on different plugins for ImageJ, such as PIV analyser, or on MATLAB scripts (Vig et al., 2016). However, these methods are limited in their accessibility, analysis capacity, metadata handling, and data visualization capabilities. Optical Flow and PIV are commonly used in the fields of fluid dynamics (Taylor et al., 2010) and computer vision (Bradski, 2000), and several open source frameworks exist to service these communities, e.g., openPIV, JPIV and OpenCV (Bradski, 2000). A corresponding framework for bioimaging and cell biology applications has so far been lacking.
Cellocity is an Python-based bioimage analysis tool for quantifying cell and tissue dynamics. It has been developed as a flexible framework for researchers interested in investigating dynamic behaviors within confluent cell layers, and to address the Optical Flow/PIV needs unique to the microscopy community. Cellocity allows users to test and evaluate a diverse set of preprocessing steps, analysis algorithms, packages, and parameters on their experimental data. It provides a uniform programming interface to work with the many aspects in a cell dynamics analysis pipeline, from reading and preprocessing raw microscopy data, to creating flow visualizations and figures with the help of Matplotlib (Hunter, 2007). Numpy (van der Walt et al., 2011) is used extensively by Cellocity for array processing, OpenPIV-python (Liberzon et al., 2020) provides the PIV analysis backbone, and the OpenCV implementation of Gunnar Farenbäck's optical flow algorithm (Farnebäck, 2003) is the basis of the optical flow analysis.
One unique feature of microscopy data is that the spatial resolution (pixel size) can be known to a high degree of accuracy, and together with frame time-stamps this can be used to calculate accurate flow velocities. A major problem when performing preprocessing of time lapse microscopy data, for example through temporal median filtering, is that such operations sometimes can change the time interval between frames and/or the pixel size. Cellocity is by design keeping track of and recalculating time and space units during operations, so as to not report back erroneous output data to the user. It is possible to configure Cellocity to give output in different units, such as µm/min or µm/h, depending on the time scale of the experiment being analyzed. Moreover, Cellocity can calculate derived parameters, including the i) Instantaneous Order Parameter (Malinverno et al., 2017), ii) Alignment Index (Malinverno et al., 2017), and/or iii) 5-sigma correlation length (Lång et al., 2018), and thereby provides the user with a comprehensive tool box to describe confluent cell layer dynamics phenomena.

Validation of the software
To validate and test the different modules and components of Cellocity, a validation dataset has been constructed. The dataset has been deposited in the BioStudies database under the accession number S-BSST461. It is comprised of a collection of files that were generated by translating and imaging a fixed monolayer of murine primary gut epithelium on a high-precision linear microscope stage, using a wide selection of magnifications. 10 images were acquired with the stage translated 1um in either the X, Y, or both directions simultaneously between frames. The dataset is described in detail in the validation section of the Cellocity documentation. Downloading this dataset allows users and contributors (to Cellocity and other software) to validate and test their installations and custom modules against a standard, comprised of real-world data where the flow is known and uniform, and the data has not been synthetically generated, but has passed through the optical transfer function (OTF) of an actual microscope setup.
The main advantages of Cellocity is its ability work on unlabeled Bright field time lapse microscopy data, and to both quantify and visualize abstract Optical Flow analyses to the user. Cellocity aims to make Optical Flow-based analysis of microscopy data easily accessible, by providing a framework that keeps track of image metadata, performs common pre-processing steps, and implements previously published analysis algorithms (Lång et al., 2018;Malinverno et al., 2017). The architecture of Cellocity is designed with extensibility and modularity in mind. Implementing new analysis modules, image readers, and visualizations is straight forward with the help of Cellocity's developer guide and API.