process-methods {Cardinal}R Documentation

Delayed Processing of Imaging Datasets

Description

Queue pre-processing steps on an imaging dataset and apply them.

Usage

## S4 method for signature 'SparseImagingExperiment'
process(object, fun, ...,
    kind = c("pixel", "feature", "global"),
    prefun, preargs,
    postfun, postargs,
    plotfun,
    label = "",
    delay = FALSE,
    plot = FALSE,
    par = NULL,
    outpath = NULL,
    BPPARAM = bpparam())

Arguments

object

An imaging dataset.

fun

A function to apply to each feature-vector or image-vector.

...

Additional arguments to fun.

kind

What kind of processing to perform? Over pixels, over features, or global processing of the dataset as a single unit.

prefun

A pre-processing function to be applied to the entire dataset, taking the dataset as its first argument. This should return another object of the same class.

preargs

Additional arguments to prefun, as a list.

postfun

A post-processing function to be applied to the output, taking the result as its first argument, and the original dataset as its second argument. This should return another object of the same class as the original dataset.

postargs

Additional arguments to postfun, as a list.

plotfun

A function to be used to plot the output of fun, taking at least two arguments: (1) the resulting vector and (2) the input vector.

label

The label of the processing step. This is used to identify it in the queue, and is printed as it is being processed.

delay

Should the function fun be applied now, or queued and delayed until process() is called again?

plot

Plot the function for each pixel or feature while it is being processed? Only possible if BPPARAM=SerialParam().

par

Plotting parameters to be passed to plotfun.

outpath

The path to a file where the results will be written by pixelApply or featureApply. If NULL, then the results are returned in-memory.

BPPARAM

An optional instance of BiocParallelParam. See documentation for bplapply.

Details

This method allows queueing of delayed processing to an imaging dataset. All of the registered processing steps will be applied in sequence whenever process() is called next with delay=FALSE. The processing can be over feature-vectors (e.g., mass spectra), over image-vectors, or over the entire dataset as a unit. The processing is performed in parallel using the current registered parallel backend.

Value

An object of the same class (or subclass) as the original imaging dataset, with the data processing queued or applied.

Author(s)

Kylie A. Bemis

See Also

SparseImagingExperiment, MSImagingExperiment, pixelApply, featureApply, normalize, smoothSignal, reduceBaseline, peakPick, peakAlign, peakFilter, peakBin

Examples

register(SerialParam())

set.seed(2)
data <- simulateImage(preset=1, dim=c(10,10), baseline=1)
data_c <- data[,pData(data)$circle]

tmp <- process(data, function(s) log2(abs(s)))

tmp1 <- process(data, abs, delay=TRUE)

tmp2 <- process(tmp1, log2, delay=TRUE)

process(tmp2)

[Package Cardinal version 2.2.2 Index]