spatialFastmap-methods {Cardinal} | R Documentation

## Spatially-aware FastMap projection

### Description

Performs spatially-aware FastMap projection.

### Usage

    ## S4 method for signature 'SparseImagingExperiment'
    spatialFastmap(x, r = 1, ncomp = 3,
        method = c("gaussian", "adaptive"),
        metric = c("average", "correlation", "neighborhood"),
        dist = "chebyshev", tol.dist = 1e-9,
        iter.max = 1, BPPARAM = bpparam(), ...)

    ## S4 method for signature 'SpatialFastmap2'
    summary(object, ...)

    ## S4 method for signature 'SImageSet'
    spatialFastmap(x, r = 1, ncomp = 3,
        method = c("gaussian", "adaptive"),
        metric = c("average", "correlation", "neighborhood"),
        iter.max = 1, ...)

### Arguments

`x` | The imaging dataset for which to calculate the FastMap components.
`r` | The neighborhood spatial smoothing radius.
`ncomp` | The number of FastMap components to calculate.
`method` | The method to use to calculate the spatial smoothing kernels for the embedding. The 'gaussian' method refers to spatially-aware (SA) weights, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) weights.
`metric` | The dissimilarity metric to use when comparing spectra, where ‘average’ (the default) means to use the differences of spatially-smoothed spectra, ‘correlation’ means to use the correlations of spatially-smoothed spectra, and ‘neighborhood’ means to use pairwise differences of each spectrum in the neighborhoods. Previous versions used ‘neighborhood’, which is the algorithm of Alexandrov & Kobarg; ‘average’ is the current default, because it handles non-gridded pixels better than ‘neighborhood’.
`dist` | The type of distance metric to use when calculating neighboring pixels based on `r`. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (the default).
`tol.dist` | The distance tolerance used for matching pixels when calculating pairwise distances between neighborhoods. This parameter should only matter when the data is not gridded. (Only considers ‘radial’ distance.)
`iter.max` | The number of iterations to perform when choosing the pivot vectors for each dimension.
`...` | Ignored.
`object` | A fitted model object to summarize.
`BPPARAM` | An optional instance of `BiocParallelParam`. See documentation for `bplapply`.

### Value

An object of class `SpatialFastmap2`, which is a `ImagingResult`, or an object of class `SpatialFastmap`, which is a `ResultSet`. Each element of the `resultData` slot contains at least the following components:

`scores`:

  A matrix with the FastMap component scores.

`correlation`:

  A matrix with the feature correlations with each FastMap component.

`sdev`:

  The standard deviations of the FastMap scores.

### Author(s)

Kylie A. Bemis

### References

Alexandrov, T., & Kobarg, J. H. (2011). Efficient spatial segmentation of large imaging mass spectrometry datasets with spatially aware clustering. Bioinformatics, 27(13), i230-i238. doi:10.1093/bioinformatics/btr246

Faloutsos, C., & Lin, D. (1995). FastMap: A Fast Algorithm for Indexing, Data-Mining and Visualization of Traditional and Multimedia Datasets. Presented at the Proceedings of the 1995 ACM SIGMOD international conference on Management of data.

### See Also

`PCA`, `spatialKMeans`, `spatialShrunkenCentroids`

### Examples

    register(SerialParam())

    set.seed(1)
    data <- simulateImage(preset=2, npeaks=20, dim=c(6,6),
        representation="centroid")

    # project to FastMap components
    fm <- spatialFastmap(data, r=1, ncomp=2, method="adaptive")

    # visualize first 2 components
    image(fm, superpose=FALSE)

[Package Cardinal version 2.4.0 Index]