Methods

The methods that are used in polarityjam are listed on this page. Whenever necessary, a brief summary of the methodology is provided.

Segmentation

Segmentation can currently be performed using the following methods: - Cellpose cellpose - Segment Anything segmentanything - Mesmer deepcell mesmer deepcell - microSAM microSAM

Polarity-JaM natively uses Cellpose. Cellpose is a generalist algorithm for cell and nucleus segmentation. Cellpose uses a neural network that was trained to predict horizontal and vertical gradients of topological maps, together with a binary map indicating whether or not a pixel is inside a region of interest. The topological maps were previously created with the help of ground-truth masks. Following the combined gradients in a process known as gradient tracking, grouping together pixel that converge to the same point and combining results with the information from the binary mask, precise cell shapes can be recovered.

Alternatively, the user can try the following segmentation methods: Segment Anything Model (SAM) is a new AI model from Meta AI that can “cut out” any object, in any image, with a single click. For more information, please visit segmentanything.

Mesmer deepcell is a deep learning model for cell segmentation (whole-cell and nuclear). For more information, please visit mesmer deepcell.

microSAM is a tool for segmentation and tracking in microscopy build on top of SegmentAnything. For more information, please visit microSAM.

Cell properties

Most cell properties are extracted from a scikit-image python library. More specifically, we use the regionprops module of scikit-image. It allows the user to measure properties of labeled image regions.

Region adjacency graph (neighborhood statistics)

Our neighborhood statistic is calculated with the aid of a python module called pysal in combination with the scikit-image graph implementation. Each cell is modelled as a node in the graph. Additionally, a feature of interest (FOI) can be specified. This feature is included in the graph structure and a morans I correlation analysis can be performed.

Other

Coding: python
Documentation: sphinx
Calculations: numpy
Datasets: pandas
Plot: matplotlib and cmocean
Logging: python logging
Testing: python unittest