Returns a SPE object with the minimum distance from cells of interest (CoI) to the identified bordering cells.

calculate_distance_to_margin(spe_object)

Arguments

spe_object

SpatialExperiment object. It should contain information of the detected bordering cells (`colData()` has `Region` column).

Value

An spe_object with a `Distance.To.Border` column is returned.

Examples

spe_border <- identify_bordering_cells(SPIAT::defined_image,
reference_cell = "Tumour", feature_colname = "Cell.Type", n_to_exclude = 10)
#> [1] "The alpha of Polygon is: 63.24375"

spe_dist <- calculate_distance_to_margin(spe_border)
#> [1] "Markers had been selected in minimum distance calculation: "
#> [1] "Non-border" "Border"