Corrects the intensity spillover between neighbouring channels of multi-channel images using a non-negative least squares approach.
compImage(object, sm, overwrite = FALSE, BPPARAM = SerialParam())
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
.
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
.
(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).
parameters for parallelised processing.
returns the compensated pixel intensities in form of a
CytoImageList
object.
The channelNames
of object
need to match the column names
of sm
. To adapt the spillover matrix accordingly, please use the
adaptSpillmat
function.
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.
nnls
, for the underlying algorithm
compCytof
, for how to compensate single-cell data
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)