spatialDGMM-methods: Spatially-aware Dirichlet Gaussian mixture model

Description Usage Arguments Value Author(s) References Examples

Description

Fits spatially-aware Dirichlet Gaussian mixture models to each feature and each run in an imaging experiment. Each image is segmented and the means and variances of all Gaussian components are estimated. A linear filter with a spatial kernel is applied to the component probabilities to achieve spatial smoothing. Simulated annealing is used in the EM-algorithm to avoid local optimia and achieve more accurate parameter estimates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S4 method for signature 'SparseImagingExperiment'
spatialDGMM(x, r = 1, k = 3, groups = run(x),
    method = c("gaussian", "adaptive"),
    dist = "chebyshev", annealing = TRUE,
    init = c("kmeans", "gmm"), p0 = 0.05,
    iter.max = 100, tol = 1e-9,
    BPPARAM = getCardinalBPPARAM(), ...)

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

Arguments

x

The imaging dataset to segment or classify.

r

The spatial neighborhood radius of nearby pixels to consider. This can be a vector of multiple radii values.

k

The maximum number of segments (clusters). This can be a vector to try initializing the clustering with different numbers of maximum segments. The final number of segments may differ.

groups

Pixels from different groups will be segmented separately. For the validity of downstream statistical analysis, it is important that each distinct observational unit (e.g., tissue sample) is assigned to a unique group.

method

The method to use to calculate the spatial smoothing weights. The 'gaussian' method refers to spatially-aware (SA) weights, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) weights.

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).

annealing

Should simulated annealing be used during the optimization process to improve parameter estimates?

init

Should the parameter estimates be initialized using k-means ('kmeans') or Gaussian mixture model ('gmm')?

p0

A regularization parameter applied to estimated posterior class probabilities to avoid singularities. Must be positive for successful gradient descent optimization. Changing this value (within reason) should have only minimal impact on values of parameter estimates, but may greatly affect the algorithm's speed and stability.

iter.max

The maximum number of EM-algorithm iterations.

tol

The tolerance convergence criterion for the EM-algorithm. Corresponds to the change in log-likelihood.

...

Passed to internal methods.

object

A fitted model object to summarize.

BPPARAM

An optional instance of BiocParallelParam. See documentation for bplapply.

Value

An object of class SpatialDGMM, which is a ImagingResult, where each element of the resultData slot contains at least the following components:

estimates:

A list giving the parameter estimates for the means and variances for each Gaussian component.

class:

The predicted Gaussian component.

probability:

The probability of class membership for each Gaussian component.

Author(s)

Dan Guo and Kylie A. Bemis

References

Guo, D., Bemis, K., Rawlins, C., Agar, J., and Vitek, O. (2019.) Unsupervised segmentation of mass spectrometric ion images characterizes morphology of tissues. Proceedings of ISMB/ECCB, Basel, Switzerland, 2019.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
setCardinalBPPARAM(SerialParam())

set.seed(2)
x <- simulateImage(preset=3, dim=c(10,10), npeaks=6,
    peakheight=c(4,6,8), representation="centroid")

res <- spatialDGMM(x, r=1, k=5, method="adaptive")

summary(res)

image(res, model=list(feature=3))

Cardinal documentation built on Nov. 8, 2020, 11:10 p.m.