R: 'SpatialImage' methods

SpatialImage-methods {SeuratObject} | R Documentation

## `SpatialImage` methods

### Description

Methods defined on the `SpatialImage` class. Some of these methods must be overridden in order to ensure proper functionality of the derived classes (see Required methods below). Other methods are designed to work across all `SpatialImage`-derived subclasses, and should only be overridden if necessary

### Usage

    ## S3 method for class 'SpatialImage'
    Cells(x)

    ## S3 method for class 'SpatialImage'
    DefaultAssay(object, ...)

    ## S3 replacement method for class 'SpatialImage'
    DefaultAssay(object, ...) <- value

    ## S3 method for class 'SpatialImage'
    GetImage(object, mode = c("grob", "raster", "plotly", "raw"), ...)

    ## S3 method for class 'SpatialImage'
    GetTissueCoordinates(object, ...)

    ## S3 method for class 'SpatialImage'
    IsGlobal(object, ...)

    ## S3 method for class 'SpatialImage'
    Key(object, ...)

    ## S3 replacement method for class 'SpatialImage'
    Key(object, ...) <- value

    ## S3 method for class 'SpatialImage'
    Radius(object)

    ## S3 method for class 'SpatialImage'
    RenameCells(object, new.names = NULL, ...)

    ## S3 method for class 'SpatialImage'
    x[i, ...]

    ## S3 method for class 'SpatialImage'
    dim(x)

    ## S3 method for class 'SpatialImage'
    subset(x, cells, ...)

    ## S4 method for signature 'SpatialImage'
    show(object)

### Arguments

`x, object` | A `SpatialImage`-derived object
`...` | Arguments passed to other methods
`value` | Depends on the method: `DefaultAssay<-` Assay that the image should be associated with `Key<-` New key for the image
`mode` | How to return the image; should accept one of “grob”, “raster”, “plotly”, or “raw”
`new.names` | vector of new cell names
`i, cells` | A vector of cells to keep

### Value

[Override] `Cells`: should return cell names

`DefaultAssay`: The associated assay of a `SpatialImage`-derived object

`DefaultAssay<-`: `object` with the associated assay updated

[Override] `GetImage`: The image data from a `SpatialImage`-derived object

[Override] `GetTissueCoordinates`: ...

`IsGlobal`: returns `TRUE` as images are, by default, global

`Key`: The key for a `SpatialImage`-derived object

`Key<-`: `object` with the key set to `value`

`Radius`: The spot radius size; by default, returns `NULL`

[Override] `RenameCells`: `object` with the new cell names

`[`, `subset`: `x`/`object` for only the cells requested

[Override] `dim`: The dimensions of the image data in (Y, X) format

`show`: Prints summary to `stdout` and invisibly returns `NULL`

### Functions

- `Cells.SpatialImage`: Get the cell names from an image ([Override])

- `DefaultAssay.SpatialImage`: Get the associated assay of a `SpatialImage`-derived object

- `DefaultAssay<-.SpatialImage`: Set the associated assay of a `SpatialImage`-derived object

- `GetImage.SpatialImage`: Get the image data from a `SpatialImage`-derived object

- `GetTissueCoordinates.SpatialImage`: Get tissue coordinates for a `SpatialImage`-derived object ([Override])

- `IsGlobal.SpatialImage`: Globality test for `SpatialImage`-derived object

- `Key.SpatialImage`: Get the key for a `SpatialImage`-derived object

- `Key<-.SpatialImage`: Set the key for a `SpatialImage`-derived object

- `Radius.SpatialImage`: Get the spot radius size

- `RenameCells.SpatialImage`: Rename cells in a `SpatialImage`-derived object ([Override])

- `[.SpatialImage`: Subset a `SpatialImage`-derived object

- `dim.SpatialImage`: Get the plotting dimensions of an image ([Override])

- `subset.SpatialImage`: Subset a `SpatialImage`-derived object ([Override])

- `show,SpatialImage-method`: Overview of a `SpatialImage`-derived object

### Provided methods

These methods are defined on the `SpatialImage` object and should not be overridden without careful thought

- `DefaultAssay` and `DefaultAssay<-`

- `Key` and `Key<-`

- `GetImage`; this method can be overridden to provide image data, normally returns empty image data. If overridden, should default to returning a `grob` object

- `IsGlobal`

- `Radius`; this method can be overridden to provide a spot radius for image objects

- `[`; this method can be overridden to change default subset behavior, normally returns `subset(x = x, cells = i)`. If overridden, should only accept `i`

### Required methods

All subclasses of the `SpatialImage` class must define the following methods; simply relying on the `SpatialImage` method will result in errors. For required parameters and their values, see the `Usage` and `Arguments` sections

`Cells`

  Return the cell/spot barcodes associated with each position

`dim`

  Return the dimensions of the image for plotting in `(Y, X)` format

`GetTissueCoordinates`

  Return tissue coordinates; by default, must return a two-column `data.frame` with x-coordinates in the first column and y-coordinates in the second

`Radius`

  Return the spot radius; returns `NULL` by default for use with non-spot image technologies

`RenameCells`

  Rename the cell/spot barcodes for this image

`subset`

  Subset the image data by cells/spots

These methods are used throughout Seurat, so defining them and setting the proper defaults will allow subclasses of `SpatialImage` to work seamlessly

### See Also

`DefaultAssay`

`GetImage`

`GetTissueCoordinates`

`IsGlobal`

`Key`

`RenameCells`

[Package SeuratObject version 4.0.3 Index]