Skip to contents

Reconstruct structure from spatial experiment object per image id

Usage

reconstructShapeDensitySPE(
  spe,
  marks,
  image_col,
  mark_select,
  dim = 500,
  bndw = NULL,
  thres,
  ncores = 1
)

Arguments

spe

SpatialExperiment; a object of class SpatialExperiment

marks

character; name of column in colData that will correspond to the ppp marks

image_col

character; name of a column in colData that corresponds to the image

mark_select

character; name of mark that is to be selected for the reconstruction

dim

numeric; x dimension of the final reconstruction. A lower resolution speed up computation but lead to less exact reconstruction. Default = 500

bndw

numeric; bandwith of the sigma parameter in the density estimation, if no value is given the bandwith is estimated using cross validation with the bw.diggle function.

thres

numeric; intensity threshold for the reconstruction

ncores

numeric; number of cores for parallel processing using mclapply. Default = 1

Value

simple feature collection

Examples

spe <- imcdatasets::Damond_2019_Pancreas("spe", full_dataset = FALSE)
#> see ?imcdatasets and browseVignettes('imcdatasets') for documentation
#> loading from cache
spe_sel <- spe[, spe[["image_name"]] %in% c("E02", "E03", "E04")]
all_islets <- reconstructShapeDensitySPE(spe_sel,
    marks = "cell_category",
    image_col = "image_name", mark_select = "islet", bndw = sigma, thres = 0.0025
)
all_islets
#> Simple feature collection with 8 features and 1 field
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 81.38922 ymin: 70.148 xmax: 562.7857 ymax: 519.656
#> CRS:           NA
#>   image_name     st_cast.stCast...POLYGON..
#> 1        E02 POLYGON ((203.6163 516.42, ...
#> 2        E03 POLYGON ((181.8026 207.1209...
#> 3        E03 POLYGON ((394.6466 375.9907...
#> 4        E03 POLYGON ((254.8497 518.3958...
#> 5        E04 POLYGON ((149.8029 191.672,...
#> 6        E04 POLYGON ((285.1585 239.096,...
#> 7        E04 POLYGON ((491.6499 368.524,...
#> 8        E04 POLYGON ((353.3303 295.412,...