process-methods {Cardinal} | R Documentation

## Delayed Processing of Imaging Datasets

### Description

Queue pre-processing steps on an imaging dataset and apply them, possibly writing out the processed data to a file.

### Usage

    ## S4 method for signature 'MSImagingExperiment'
    process(object, ..., delay = FALSE,
        outpath = NULL, imzML = FALSE)

    ## S4 method for signature 'SparseImagingExperiment'
    process(object, fun, ...,
        kind = c("pixel", "feature", "global"),
        moreargs = NULL,
        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`.
`delay` | Should the function `fun` be applied now, or queued and delayed until `process()` is called again?
`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.
`imzML` | Should the output file be an imzML file? Note: some processing methods are not be supported with this option.
`kind` | What kind of processing to perform? Over pixels, over features, or global processing of the dataset as a single unit.
`moreargs` | Additional arguments to be passed to `fun`. This is primarily useful if some of the arguments to `fun` conflict with arguments to `process`.
`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.
`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`.
`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.

The method for `MSIMagingExperiment` allows writing the output directly to an imzML file, with certain restrictions. Some pre-processing methods are not supported with this option, and the experiment must not contain multiple runs.

### 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.4.0 Index]