SparseImagingExperiment-class {Cardinal} | R Documentation

## SparseImagingExperiment: Pixel-sparse imaging experiments

### Description

The `SparseImagingExperiment` class specializes the virtual `ImagingExperiment` class by assuming that each pixel may be a high-dimensional feature vector (e.g., a spectrum), but the pixels themselves may be sparse. Therefore, the data may be more efficiently stored as a matrix where rows are features and columns are pixels, rather than storing the full, dense datacube.

Both 2D and 3D data are supported. Non-gridded pixel coordinates are allowed.

The `MSImagingExperiment` subclass adds design features for mass spectrometry imaging experiments.

### Usage

    ## Instance creation
    SparseImagingExperiment(
        imageData = matrix(nrow=0, ncol=0),
        featureData = DataFrame(),
        pixelData = PositionDataFrame(),
        metadata = list(),
        processing = SimpleList())

    ## Additional methods documented below

### Arguments

`imageData` | Either a matrix-like object with number of rows equal to the number of features and number of columns equal to the number of pixels, or an `ImageArrayList`.
`featureData` | A `DataFrame` with feature metadata, with a row for each feature.
`pixelData` | A `PositionDataFrame` with pixel metadata, with a row for each pixel.
`metadata` | A `list` with experimental-level metadata.
`processing` | A `SimpleList` with processing steps. This should typically be empty for new objects.

### Slots

`imageData`:

  An object inheriting from `ImageArrayList`, storing one or more array-like data elements with conformable dimensions.

`featureData`:

  Contains feature information in a `DataFrame`. Each row includes the metadata for a single feature (e.g., a color channel, a molecular analyte, or a mass-to-charge ratio).

`elementMetadata`:

  Contains pixel information in a `PositionDataFrame`. Each row includes the metadata for a single observation (e.g., a pixel), including specialized slot-columns for tracking pixel coordinates and experimental runs.

`metadata`:

  A `list` containing experiment-level metadata.

`processing`:

  A `SimpleList` containing processing steps (including both queued and previously executed processing steps).

### Methods

All methods for `ImagingExperiment` also work on `SparseImagingExperiment` objects. Additional methods are documented below:

`pixels(object, ...)`:

  Returns the row indices of `pixelData` corresponding to conditions passed via ....

`features(object, ...)`:

  Returns the row indices of `featureData` corresponding to conditions passed via ....

`run(object)`, `run(object) <- value`:

  Get or set the experimental run slot-column from `pixelData`.

`runNames(object)`, `runNames(object) <- value`:

  Get or set the experimental run levels from `pixelData`.

`coord(object)`, `coord(object) <- value`:

  Get or set the spatial position slot-columns from `pixelData`.

`coordLabels(object)`, `coordLabels(object) <- value`:

  Get or set the names of the spatial position slot-columns from `pixelData`.

`gridded(object)`, `gridded(object) <- value`:

  Get or set whether the spatial positions are gridded or not. Typically, this should not be set manually.

`resolution(object)`, `resolution(object) <- value`:

  Get or set the spatial resolution of the spatial positions. Typically, this should not be set manually.

`dims(object)`:

  Get the gridded dimensions of the spatial positions (i.e., as if projected to an image raster).

`is3D(object)`:

  Check if the data is 3D or not.

`slice(object, ...)`:

  Slice the data as a data cube (i.e., as if projected to an multidimensional image raster).

`processingData(object)`, `processingData(object) <- value`:

  Get or set the `processing` slot.

`preproc(object)`:

  List the preprocessing steps queued and applied to the dataset.

`pull(x, ...)`:

  Pull all data elements of `imageData` into memory as matrices.

`object[i, j, ..., drop]`:

  Subset based on the rows (`featureData`) and the columns (`pixelData`). The result is the same class as the original object.

`rbind(...)`, `cbind(...)`:

  Combine `SparseImagingExperiment` objects by row or column.

### Author(s)

Kylie A. Bemis

### See Also

`ImagingExperiment`, `MSImagingExperiment`

### Examples

    data <- matrix(1:9^2, nrow=9, ncol=9)
    t <- seq_len(9)
    a <- seq_len(9)
    coord <- expand.grid(x=1:3, y=1:3)

    idata <- ImageArrayList(data)
    fdata <- XDataFrame(t=t)
    pdata <- PositionDataFrame(coord=coord, a=a)

    x <- SparseImagingExperiment(
            imageData=idata,
            featureData=fdata,
            pixelData=pdata)

    print(x)

[Package Cardinal version 2.10.0 Index]