Return a binary mask generated applying k-means clustering on peaks intensities. A finer segmentation is obtained by using a larger number of clusters than 2. The off-sample clusters are merged looking at the most frequent labels in the image corners. The lookup areas are defined by the kernel size.
# S4 method for msi.dataset
binKmeans2(
object,
mzQuery = numeric(),
useFullMZ = TRUE,
mzTolerance = Inf,
numClusters = 4,
kernelSize = c(3, 3, 3, 3),
numCores = 1,
verbose = TRUE
)
ms.image-class object representing the binary mask image.
msi.dataset-class object
numeric. Values of m/z used to calculate the reference image.
2 values are interpreted as interval, multiple or single values are searched
in the m/z vector. It should be left unset when using useFullMZRef = TRUE
.
logical (default = `TRUE``). Whether all the peaks should be used to calculate the reference image.
numeric (default = Inf). Tolerance in PPM to match the
mzQueryRef
. values in the m/z vector. It overrides useFullMZ
.
numeric (default = 4). Number of k-means clusters.
4D array (default = c(3, 3, 3, 3)). Array of sizes in pixels of the corner kernels used to identify the off-sample clusters. The elements represent the size of the top-left, top-right, bottom-right and bottom-left corners. A negative value can be used to skip the corresponding corner.
(default = 1). Multi-core parallel computation of k-means.
Each core corresponds to a repetition of k-means. If numCores = 1
, a
serial k-means with 5 repetitions is performed.
logical (default = `TRUE``). Show additional output.
Paolo Inglese p.inglese14@imperial.ac.uk