readTemplate: readTemplate

Description Usage Arguments Value Examples

View source: R/readTemplate.R

Description

Read virtual template (in jpeg) into R. The spatially located regions must be coloured differently, and no borders should be used.

Usage

1
2
3
4
5
6
7
8
readTemplate(
  pathToImage,
  k,
  bgThr = 0.93,
  neighbours = c(20, 5),
  refineRound = 2,
  plot = TRUE
)

Arguments

pathToImage

Path to the jpeg or png image. The number of virtual cells will be determined by the size of the picture.

k

Number of spatial domains in the image

bgThr

Threshold (between 0 and 1) above which all the color channels (RGB) have to be above for the pixel to be considered background. Default:0.93

neighbours

Number of neighbours to be used to refine color cluster assignment. It must be the same length as the number of refinement rounds. Default: c(20, 5).

refineRound

Number of cluster refinement rounds. Default:2

plot

Boolean indicating whether to return the computed template colored by spatial sections. Default: TRUE.

Value

A virtual map data.frame containing the virtual cell coordinates, assigned spatial cluster (original and refined), and cluster color

Examples

1
virtualTemplate <- readTemplate(pathToJpeg, k=8, bgThr=0.93, neighbours=c(20,5), refineRound=2)

aertslab/ScoMAP documentation built on Oct. 8, 2021, 1:15 a.m.