compImage: Performs channel compensation on multi-channel images

View source: R/compImage.R

compImageR Documentation

Performs channel compensation on multi-channel images

Description

Corrects the intensity spillover between neighbouring channels of multi-channel images using a non-negative least squares approach.

Usage

compImage(object, sm, overwrite = FALSE, BPPARAM = SerialParam())

Arguments

object

a CytoImageList object containing pixel intensities for all channels. The channelNames must be in the form of (mt)(mass)Di (e.g. Sm152Di for Samarium isotope with the atomic mass 152) and match with the column names in sm.

sm

numeric matrix containing the spillover estimated between channels. The column names must be of the form (mt)(mass)Di (e.g. Sm152Di for Samarium isotope with the atomic mass 152) and match to the channelNames of object.

overwrite

(for images stored on disk) should the original image array be overwritten by the compensated image array? By default (overwrite = FALSE), a new entry called "XYZ_comp" will be written to the .h5 file (see below).

BPPARAM

parameters for parallelised processing.

Value

returns the compensated pixel intensities in form of a CytoImageList object.

The input object

The channelNames of object need to match the column names of sm. To adapt the spillover matrix accordingly, please use the adaptSpillmat function.

Images stored on disk

Image compensation also works for images stored on disk. By default, the compensated images are stored as a second entry called "XYZ_comp" in the .h5 file. Here "XYZ" specifies the name of the original entry. By storing the compensated next to the original images on disk, space usage increases. To avoid storing duplicated data, one can specify overwrite = TRUE, therefore deleting the original images and only storing the compensated images. However, the original images cannot be accessed anymore after compensation.

Author(s)

Nils Eling (nils.eling@dqbm.uzh.ch)

References

Chevrier, S. et al., Compensation of Signal Spillover in Suspension and Imaging Mass Cytometry., Cell Systems 2018 6(5):612-620.e5

See Also

nnls, for the underlying algorithm

compCytof, for how to compensate single-cell data

Examples

data("pancreasImages")

# Generate example spillover matrix
metals <- c("Dy161Di", "Dy162Di", "Dy163Di", "Dy164Di", "Ho165Di")
sm <- matrix(c(1, 0.033, 0.01, 0.007, 0,
               0.016, 1, 0.051, 0.01, 0,
               0.004, 0.013, 1, 0.023, 0,
               0.005, 0.008, 0.029, 1, 0.006,
               0, 0, 0, 0.001, 1), byrow = TRUE,
             ncol = 5, nrow = 5, 
             dimnames = list(metals, metals))
             
# Rename channels - just used as example
channelNames(pancreasImages) <- metals

# Perform channel spillover
comp_images <- compImage(pancreasImages, sm) 


BodenmillerGroup/SingleCellMapper documentation built on July 2, 2024, 4:31 p.m.