pixels-methods {Cardinal} | R Documentation |
These are generic functions to retrieve pixel or feature row indices in an iSet
-derived object's pixelData
or featureData
slots based on metadata variables.
## S4 method for signature 'iSet' pixels(object, ...) ## S4 method for signature 'iSet' features(object, ...) ## S4 method for signature 'MSImageSet' pixels(object, ..., coord) ## S4 method for signature 'MSImageSet' features(object, ..., mz)
object |
An imaging dataset object. |
... |
Variables that appear in |
mz |
A vector of m/z values. |
coord |
A list or |
It is often more convenient to specify a pixel or feature by identifying metadata such as pixel coordinates or m/z-values than by their row indices in the pixelData
and featureData
slots. However, many functions expect indices rather than coordinates or m/z-values. These generic functions make it easy to retrieve indices based on such metadata.
It is important to note that when passing multiple variables via ..., the 'AND' operator is used to resolve the query. However, when vectors are passed, all combinations of the given values will be used.
For convenience, MSImageSet
uses a special implementation for the 'mz' variable, which uses a bisection search so that exact precision is not required when searching based on m/z-values.
A numeric vector of pixel or feature indices.
Kylie A. Bemis
## Create an MSImageSet object spectra <- matrix(1:27, nrow=3) mz <- 101:103 coord <- expand.grid(x=1:3, y=1:3) msset <- MSImageSet(spectra=spectra, mz=mz, coord=coord) # Find pixel indices pixels(msset, x=2, y=2) pixels(msset, coord=list(x=2, y=2)) pixels(msset, coord=list(x=c(2,3), y=c(2,3))) # Find feature indices features(msset, mz=102) features(msset, mz=c(101,103)) features(msset, mz=c(102.2))