Description Usage Arguments Details Value Author(s) Examples
Slice an imaging dataset as a "data cube".
1 2 |
x |
An imaging dataset. |
... |
Conditions describing features to slice, passed to |
drop |
Should redundant array dimensions be dropped? If TRUE, dimensions with only one level are dropped using |
Because SparseImagingExperiment
objects may be pixel-sparse, their data is always internally represented as a matrix rather than an array, where each column is a feature-vector. Only columns for non-missing pixels are retained. This is simpler and more space-efficient if the image is non-rectangular, non-gridded, or has many missing values.
However, it is often necessary to index into the data as if it were an actual "data cube", with explicit array dimensions for each spatial dimension. slice()
allows this by slicing the object as a "data cube", and returning an image array from the object.
For non-rectangular data, this may result in missing values. For non-gridded data, images must be projected to an array (with a regular grid), and the result may not represent the underlying values exactly.
An array representing the sliced image(s).
Kylie A. Bemis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | setCardinalBPPARAM(SerialParam())
set.seed(1)
x <- simulateImage(preset=1, npeaks=10, dim=c(10,10), representation="centroid")
m <- mz(metadata(x)$design$featureData)
# slice image for first feature
slice(x, 1)
# slice by m/z-value
slice(x, mz=m[1])
# slice multiple
slice(x, mz=m[1:3])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.