binKmeans,msi.dataset-method {SPUTNIK} | R Documentation |
Return a binary mask generated applying k-means clustering on first 10 principal components of peaks intensities.
Description
Return a binary mask generated applying k-means clustering on first 10 principal components of peaks intensities.
Usage
## S4 method for signature 'msi.dataset'
binKmeans(object, ref = "detected", invert = FALSE, npcs = 10)
Arguments
object |
msi.dataset-class object |
ref |
string (default = "detected). Sample reference image used to align the clusters. |
invert |
boolean (default = FALSE). If FALSE, the clusters are inversely aligned to the sample reference image. |
npcs |
int (default = 10). Number of principal components to calculate. |
Value
ms.image-class object representing the binary mask image.
Examples
## Load package
library("SPUTNIK")
## Create the msi.dataset-class object
sz <- c(5, 4)
x <- matrix(rnorm(sz[1] * sz[2] * 20), sz[1] * sz[2], 20)
x[x < 0] <- 0
mz <- sort(sample(100, ncol(x)))
msiX <- msiDataset(x, mz, sz[1], sz[2])
## Generate binary mask by applying k-means on the entire dataset
roiImg <- refImageBinaryKmeans(msiX, npcs = 3)
## Plot the mask
# plot(roiImg)
[Package SPUTNIK version 1.4.2 Index]