
Create a react app for digital unrolling
osddu.Rd
This function is used to start an interactive widget for digital unrolling. It requires a static files server to be hosted in order to find load the necessary files.
Usage
osddu(
sampleID = 1,
host = "127.0.0.1",
port = "8080",
width = NULL,
height = NULL,
elementId = NULL,
quit = FALSE
)
Arguments
- sampleID
A section ID
- host
A host address
- port
A valid port
- width, height
Width and height of container
- elementId
The element id of the widget
- quit
A logical specifying is the app should quit
Examples
library(semla)
library(magick)
se_mcolon <- readRDS(system.file("extdata/mousecolon",
"se_mcolon",
package = "semla"))
# Load images
se_mcolon <- se_mcolon |>
LoadImages()
#>
#> ── Loading H&E images ──
#>
#> ℹ Loading image from /private/var/folders/z8/nrcst881607gn95xh3_4qvb00000gp/T/Rtmpf80zo9/temp_libpath1c4b5544360a/semla/extdata/mousecolon/spatial/tissue_lowres_image.jpg
#> ℹ Scaled image from 541x600 to 400x444 pixels
#> ℹ Saving loaded H&E images as 'rasters' in Seurat object
# fetch path for one H&E image
im <- GetStaffli(se_mcolon)@imgs[1] |>
image_read()
# Get spatial network
spatnet <- GetSpatialNetwork(se_mcolon)[[1]]
if (FALSE) {
# Tile image
tilepath <- TileImage(im = im, outpath = tempdir())
# Export spatial network as JSON
# Make sure that sampleID matches the ID of the H&E image
export_graph(se_mcolon, sampleID = 1, outdir = tilepath$datapath)
if (interactive()) {
# Host file server
file_server(hostDir = tilepath$datapath)
# Run widget
osddu(sampleID = 1,
host = "127.0.0.1",
port = 8080L,
width = '800px',
height = '800px',
quit = FALSE)
beakr::stopAllServers()
}
}