grid_metrics: Split an image into grid and calculates a metric for each...

View source: R/grid_metrics.R

grid_metricsR Documentation

Split an image into grid and calculates a metric for each grid square

Description

Calculates a specified metric for each grid tile in the image and plots the metrics for the grid tiles.

Usage

grid_metrics(spe_object, FUN, n_split, ...)

Arguments

spe_object

SpatialExperiment object in the form of the output of format_image_to_spe.

FUN

Variable name specifying the metric to be calculated.

n_split

Integer specifying the number of splits for the calculation of metrics. This number is the splits on each side (e.g. 'n_split' = 3 means the image will be split into 9 tiles.)

...

Arguments of FUN

Value

A list of the metrics of all grid tiles

Examples

grid <- grid_metrics(SPIAT::defined_image, FUN = calculate_entropy, n_split = 5,
cell_types_of_interest=c("Tumour","Immune3"), feature_colname = "Cell.Type")

TrigosTeam/SPIAT documentation built on Aug. 22, 2024, 7:50 p.m.