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 = numeric(), numClusters = 4,
kernelSize = c(3, 3, 3, 3), numCores = 1, verbose = TRUE)
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. Tolerance in PPM to match the mzQueryRef
values in the m/z vector. Only valid when useFullMZ = FALSE
.
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 clusters.
logical (default = `TRUE``). Show additional output.
ms.image-class object representing the binary mask image.