Object measurement
In this step, object-level (e.g. single-cell) data will be extracted from segmented images.
Various types of data can be extracted, each of which is described in the following.
Object data
The commands below will create object data tables in CSV format (see File types, one file per image). The default destination directory paths are mentioned in brackets.
Collecting object data
To collect all object data from all images into a single file, see Data export.
Intensities
To extract mean object intensities per channel (intensities
):
steinbock measure intensities
Pixel aggregation
By default, pixels belonging to an object are aggregated by taking the mean. To specify a different numpy function for aggregation, use the --aggr
option (e.g. specify --aggr median
to measure "median object intensities").
Region properties
To extract spatial object properties ("region properties", regionprops
):
steinbock measure regionprops
Region property selection
By default, the following scikit-image region properties will be computed:
area
centroid
major_axis_length
minor_axis_length
eccentricity
An alternative selection of scikit-image region properties can be specified in the regionprops
command, e.g.:
steinbock measure regionprops area convex_area perimeter
Spatial object graphs
Spatial object graphs can be constructed based on distances between object centroids or object borders, or by pixel expansion. For distance-based graphs, the maximum distance and/or number of neighbors can be specified.
The following commands will create directed edge lists in CSV format (see File types, one file per image). For undirected graphs, i.e., graphs constructed by distance thresholding/pixel expansion, each edge will appear twice. The default destination directory is graphs
.
Centroid distances
To construct object graphs by thresholding on distances between object centroids:
steinbock measure graphs --type centroid --dmax 15
To construct k-nearest neighbor (kNN) graphs based on object centroid distances:
steinbock measure graphs --type centroid --kmax 5
Distance metric
By default, the Euclidean distance distance is used. Other metrics can be specified using the --metric
option, e.g.:
steinbock measure graphs --type centroid --dmax 15 --metric cityblock
Available distance metrics are listed in the documentation for scipy.spatial.distance.pdist.
Distance-thresholded kNN graphs
The options --dmax
and --kmax
options can be combined to construct distance-thresholded kNN graphs, e.g.:
steinbock measure graphs --type centroid --dmax 15 --kmax 5
Border distances
To construct object graphs by thresholding on Euclidean distances between object borders:
steinbock measure graphs --type border --dmax 4
To construct k-nearest neighbor (kNN) graphs based on Euclidean object border distances:
steinbock measure graphs --type border --kmax 5 --dmax 20
Computational complexity
The construction of spatial kNN graphs based on Euclidean distances between object borders is computationally expensive. To speed up the computation, always specify a suitable --dmax
value like in the example above.
Pixel expansion
To construct spatial object graphs by pixel expansion (morphological dilation):
steinbock measure graphs --type expand --dmax 4
Pixel expansion versus border distance
Graphs constructed by pixel expansion are a special case of spatial object graphs constructed based on Euclidean distances between object borders, in which, after pixel expansion, only touching objects (i.e., objects within a 4-neighborhood) are considered neighbors.
CellProfiler (legacy)
Legacy operation
The output of this operation is not actively supported by downstream processing steps.
Pipeline preparation
To prepare a CellProfiler measurement pipeline:
steinbock measure cellprofiler prepare
Data/working directory
Within the container, your data/working directory containing the CellProfiler pipeline is accessible under /data
.
By default, this will create a CellProfiler pipeline file cell_measurement.cppipe
and collect all images and masks into the cellprofiler_input
directory.
CellProfiler plugins
The generated CellProfiler pipeline makes use of custom plugins for multi-channel images, which are pre-installed in the steinbock Docker container. It can be inspected using CellProfiler as described in the following section.
Modifying the pipeline
To interactively inspect, modify and run the pipeline, open it in CellProfiler (see Apps):
steinbock apps cellprofiler
More detailed instructions on how to create CellProfiler pipelines can be found here.
Batch processing
After the pipeline has been configured, it can be applied to a batch of images and masks:
steinbock measure cellprofiler run
By default, this will generate (undocumented and unstandardized) CellProfiler output as configured in the pipeline and store it in the cellprofiler_output
directory.