Calculate cell statistics — epitools.analysis.cell_statistics
#
This module contains functions for calculating region-based properties of labelled images using skimage.
- epitools.analysis.cell_statistics.calculate_cell_statistics(image, labels, pixel_spacing)#
Calculate the region based properties of a timeseries of segmented images.
- Currently the following statistics are calculated for each frame of the timeseries:
area
perimeter
number of neighbours
skimage.measure.regionprops_table
is used to calculated the area and perimeter.skimage.graph.RAG
is used to create a graph of neighbouring cells at each frame, from which the number of neighbours of each cell is calculated.- Parameters
image (napari.types.ImageData) – Timeseries of images (TYX or TZYX) for which to calculate the cell statistics.
labels (napari.types.LabelsData) – Labelled input image, must be the same shape as
image
. Labels with value 0 are ignored.pixel_spacing (tuple[float]) –
- Return type
tuple[list[dict[str, npt.NDArray]], list[skimage.graph.RAG]]
Note
It is assumed that the first dimension of both
image
andlabels
corresponds to time.- Returns
- list[dict[str, np.NDArray]]
List of dictionaries, where each dictionary contains the cell statistics for a single frame. The dictionary keys are: area; perimeter; neighbours.
- list[skimage.graph.RAG]
List of the network graphs constructed for each frame of the timeseries
- Parameters
image (napari.types.ImageData) –
labels (napari.types.LabelsData) –
pixel_spacing (tuple[float]) –
- Return type
tuple[list[dict[str, npt.NDArray]], list[skimage.graph.RAG]]