Calculates the average intensity of the target_marker within a radius from the cells positive for the reference marker. Note that it pools all cells with the target marker that are within the specific radius of any reference cell. Results represent the average intensities within a radius, but not a vector of metrics for each cell.

average_marker_intensity_within_radius(
  spe_object,
  reference_marker,
  target_marker,
  radius = 20
)

Arguments

spe_object

SpatialExperiment object in the form of the output of format_image_to_spe.

reference_marker

String specifying the marker that is used for reference cells.

target_marker

String specifying the marker to calculate its average intensity.

radius

Numeric specifying the radius of search for cells around the reference cells.

Value

A single number is returned

Examples

average_marker_intensity_within_radius(SPIAT::simulated_image,
                                       reference_marker ="Immune_marker3",
                                       target_marker = "Immune_marker2",
                                       radius=30)
#> [1] 0.5995357