Skip to contents

The function sweeps over circles of a range of radii surrounding reference cells and calculates the metrics at the radii. Metrics used with function need two conditions: 1) have a `radius` parameter. 2) return a single number. For metrics that do not return a single number, users can wrap them in a new function that returns a number and then pass the new function to `compute_gradient()`.

Usage

compute_gradient(sce_object, radii, FUN, ...)

Arguments

sce_object

SingleCellExperiment object in the form of the output of format_image_to_sce.

radii

Numeric Vector specifying the range of radii for the metrics to be calculated.

FUN

Variable name specifying the metric.

...

Arguments of FUN

Value

A list of the metrics under all radii

Examples

gradient_positions <- c(30, 50, 100)
gradient_entropy <- compute_gradient(SPIAT::defined_image, radii = gradient_positions,
FUN = calculate_entropy,  cell_types_of_interest = c("Immune1","Immune2"),
feature_colname = "Cell.Type")