slice-methods: Slice an image

Description Usage Arguments Details Value Author(s) Examples

Description

Slice an imaging dataset as a "data cube".

Usage

1
2
## S4 method for signature 'SparseImagingExperiment'
slice(x, ..., drop=TRUE)

Arguments

x

An imaging dataset.

...

Conditions describing features to slice, passed to features().

drop

Should redundant array dimensions be dropped? If TRUE, dimensions with only one level are dropped using drop.

Details

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.

Value

An array representing the sliced image(s).

Author(s)

Kylie A. Bemis

Examples

 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])

Cardinal documentation built on Nov. 8, 2020, 11:10 p.m.