Skip to contents

...

Usage

SpatialData(images, labels, points, shapes, tables)

# S4 method for class 'SpatialData'
x$name

# S4 method for class 'SpatialDataElement'
data(x)

# S4 method for class 'SpatialDataElement'
meta(x)

# S4 method for class 'SpatialData'
images(x)

# S4 method for class 'SpatialData'
labels(x)

# S4 method for class 'SpatialData'
shapes(x)

# S4 method for class 'SpatialData'
points(x)

# S4 method for class 'SpatialData'
tables(x)

# S4 method for class 'SpatialData'
imageNames(x)

# S4 method for class 'SpatialData'
labelNames(x)

# S4 method for class 'SpatialData'
shapeNames(x)

# S4 method for class 'SpatialData'
pointNames(x)

# S4 method for class 'SpatialData'
tableNames(x)

# S4 method for class 'SpatialData'
image(x, i = 1)

# S4 method for class 'SpatialData'
label(x, i = 1)

# S4 method for class 'SpatialData'
shape(x, i = 1)

# S4 method for class 'SpatialData'
point(x, i = 1)

# S4 method for class 'SpatialData'
table(x, i = 1)

# S4 method for class 'SpatialData,numeric,ANY,ANY'
x[[i]] <- value

# S4 method for class 'SpatialData,character,ANY,ANY'
x[[i]] <- value

# S4 method for class 'SpatialData,list'
images(x) <- value

# S4 method for class 'SpatialData,list'
labels(x) <- value

# S4 method for class 'SpatialData,list'
shapes(x) <- value

# S4 method for class 'SpatialData,list'
points(x) <- value

# S4 method for class 'SpatialData,list'
tables(x) <- value

# S4 method for class 'SpatialData,character,ImageArray'
image(x, i) <- value

# S4 method for class 'SpatialData,character,LabelArray'
label(x, i) <- value

# S4 method for class 'SpatialData,character,PointFrame'
point(x, i) <- value

# S4 method for class 'SpatialData,character,ShapeFrame'
shape(x, i) <- value

# S4 method for class 'SpatialData,character,SingleCellExperiment'
table(x, i) <- value

# S4 method for class 'SpatialData,numeric,ImageArray'
image(x, i = 1) <- value

# S4 method for class 'SpatialData,numeric,LabelArray'
label(x, i = 1) <- value

# S4 method for class 'SpatialData,numeric,PointFrame'
point(x, i = 1) <- value

# S4 method for class 'SpatialData,numeric,ShapeFrame'
shape(x, i = 1) <- value

# S4 method for class 'SpatialData,numeric,SingleCellExperiment'
table(x, i = 1) <- value

# S4 method for class 'SpatialData,missing,ImageArray'
image(x, i) <- value

# S4 method for class 'SpatialData,missing,LabelArray'
label(x, i) <- value

# S4 method for class 'SpatialData,missing,PointFrame'
point(x, i) <- value

# S4 method for class 'SpatialData,missing,ShapeFrame'
shape(x, i) <- value

# S4 method for class 'SpatialData,missing,SingleCellExperiment'
table(x, i) <- value

# S4 method for class 'SpatialData,ANY,NULL'
image(x, i) <- value

# S4 method for class 'SpatialData,ANY,NULL'
label(x, i) <- value

# S4 method for class 'SpatialData,ANY,NULL'
shape(x, i) <- value

# S4 method for class 'SpatialData,ANY,NULL'
point(x, i) <- value

# S4 method for class 'SpatialData,ANY,NULL'
table(x, i) <- value

# S4 method for class 'SpatialData,ANY,ANY'
image(x, i) <- value

# S4 method for class 'SpatialData,ANY,ANY'
label(x, i) <- value

# S4 method for class 'SpatialData,ANY,ANY'
shape(x, i) <- value

# S4 method for class 'SpatialData,ANY,ANY'
point(x, i) <- value

# S4 method for class 'SpatialData,ANY,ANY'
table(x, i) <- value

Arguments

images

list of ImageArrays

labels

list of LabelArrays

points

list of PointFrames

shapes

list of ShapeFrames

tables

list of SingleCellExperiments

x

SpatialData

name

character string for extraction (see ?base::`$`).

i

character string, scalar or vector of indices specifying the element to extract from a given layer.

value

(list of) element(s) with layer-compliant object(s), or NULL/list() to remove an element/layer completely.

j

ignored.

...

optional arguments passed to and from other methods.

Value

SpatialData

Examples

x <- file.path("extdata", "blobs.zarr")
x <- system.file(x, package="SpatialData")
(x <- readSpatialData(x, tables=FALSE))
#> class: SpatialData
#> - images(2):
#>   - blobs_image (3,64,64)
#>   - blobs_multiscale_image (3,64,64)
#> - labels(2):
#>   - blobs_labels (64,64)
#>   - blobs_multiscale_labels (64,64)
#> - points(1):
#>   - blobs_points (200)
#> - shapes(3):
#>   - blobs_circles (5,circle)
#>   - blobs_multipolygons (2,polygon)
#>   - blobs_polygons (5,polygon)
#> - tables(0):
#> coordinate systems:
#> - global(8): blobs_image blobs_multiscale_image ... blobs_polygons
#>   blobs_points
#> - scale(1): blobs_labels
#> - translation(1): blobs_labels
#> - affine(1): blobs_labels
#> - sequence(1): blobs_labels

# subsetting
# layers are taken in order of appearance
# (images, labels, points, shapes, tables)
x[-4] # drop layer
#> class: SpatialData
#> - images(2):
#>   - blobs_image (3,64,64)
#>   - blobs_multiscale_image (3,64,64)
#> - labels(2):
#>   - blobs_labels (64,64)
#>   - blobs_multiscale_labels (64,64)
#> - points(1):
#>   - blobs_points (200)
#> - shapes(0):
#> - tables(0):
#> coordinate systems:
#> - global(5): blobs_image blobs_multiscale_image blobs_labels
#>   blobs_multiscale_labels blobs_points
#> - scale(1): blobs_labels
#> - translation(1): blobs_labels
#> - affine(1): blobs_labels
#> - sequence(1): blobs_labels
x[4, -2] # drop element
#> class: SpatialData
#> - images(0):
#> - labels(0):
#> - points(0):
#> - shapes(2):
#>   - blobs_circles (5,circle)
#>   - blobs_polygons (5,polygon)
#> - tables(0):
#> coordinate systems:
#> - global(2): blobs_circles blobs_polygons
x["shapes", c(1, 3)] # subset layer
#> class: SpatialData
#> - images(0):
#> - labels(0):
#> - points(0):
#> - shapes(2):
#>   - blobs_circles (5,circle)
#>   - blobs_polygons (5,polygon)
#> - tables(0):
#> coordinate systems:
#> - global(2): blobs_circles blobs_polygons
x[c(1, 2), list(1, c(1, 2))] # multiple
#> class: SpatialData
#> - images(1):
#>   - blobs_image (3,64,64)
#> - labels(2):
#>   - blobs_labels (64,64)
#>   - blobs_multiscale_labels (64,64)
#> - points(0):
#> - shapes(0):
#> - tables(0):
#> coordinate systems:
#> - global(3): blobs_image blobs_labels blobs_multiscale_labels
#> - scale(1): blobs_labels
#> - translation(1): blobs_labels
#> - affine(1): blobs_labels
#> - sequence(1): blobs_labels