Compute and plot the cross functions between two specified cell types. This function implements the cross functions from [spatstat] package.

calculate_cross_functions(
  spe_object,
  method = "Kcross",
  cell_types_of_interest,
  feature_colname,
  plot_results = TRUE,
  dist = NULL
)

Arguments

spe_object

SpatialExperiment object in the form of the output of format_image_to_spe.

method

String that is the method for dependence calculation. Options: "Gcross", "Kcross", "Kcross.inhom", "Lcross", "Jcross". Default method is "Kcross".

cell_types_of_interest

String Vector. Cell types of interest.

feature_colname

String that is the name of the column of the types.

plot_results

Boolean. TRUE if result to be plotted, FALSE if not. In either case, an object with the results is returned

dist

Number (OPTIONAL) The largest distance between two cell types at which K function is evaluated. If NULL, use the default distances set by cross functions.

Value

An object of class "fv" defined in `spatstat` package.

Examples

df_cross <- calculate_cross_functions(SPIAT::defined_image, 
method = "Kcross", cell_types_of_interest = c("Tumour","Immune3"),
feature_colname ="Cell.Type", dist = 100)