For a QPTIFFImage: renders up to 10 channels as an additive
colour composite on a black background. Each channel is assigned a distinct
colour; its per-pixel intensity (min-max normalised to [0, 1]) drives the
channel's contribution - high-intensity pixels appear fully saturated while
low-intensity pixels are transparent (black). Channels that overlap in
space produce mixed additive colours (e.g. cyan + red -> white), matching
the standard composite view in FIJI / napari. When no markers are
provided the first 10 channels (by index) are displayed.
Arguments
- x
A
QPTIFFImageor aSpatialExperiment.- markers
Character vector of channel names to display, or
NULLto use the first 10 channels (forQPTIFFImage) or all features (forSpatialExperiment). At most 10 channels are shown forQPTIFFImageinput; excess channels are dropped with a warning.- resolution
Positive integer; pixel downsample factor for
QPTIFFImageinput (ignored forSpatialExperiment).- palette
Viridis palette name used for
SpatialExperimentinput only. Default"magma".- assay.type
Assay to visualise when
xis aSpatialExperiment. Default"bgnorm".- scale
Character; intensity scaling for
QPTIFFImageinput (ignored forSpatialExperiment). One of:"marker"(default) Per-channel min and 99.9th-percentile; each marker is stretched to full brightness independently.
"sample"Global min and 99.9th-percentile computed across all channels in the image; preserves relative intensities between markers.
"none"No scaling; values are clamped to
[0, 1].
- point_size
Base point size for
SpatialExperimentscatter.- pixels
Integer
c(width, height)for scattermore rasterisation. Defaultc(1024L, 1024L).- flip_y
Logical; reverse y-axis for
SpatialExperiment? DefaultTRUE.- large_data_threshold
Cell count above which scattermore is used automatically. Default
10000L.- ncol
Ignored for
QPTIFFImage(single composite panel). Number of facet columns forSpatialExperiment.
Details
For a SpatialExperiment: plots each cell
at its spatial coordinates, coloured by its (per-channel scaled) intensity
from the requested assay using a viridis colour scale and dark theme. When
the cell count exceeds large_data_threshold and scattermore is
installed, the scatter layer is rasterised automatically.
Examples
path <- system.file("extdata", "PA_HNC_sample.ome.tiff", package = "bgnormR")
img <- read_qptiff(path)
#> Reading TIFF directory structure ...
#> Reading OME-TIFF metadata ...
#> Reading IFD page layouts ...
#> Loading 5 channel(s) ...
#> Loading 5 channel(s) ...
plot_qptiff(img, markers = c("PanCK", "CD20"))
# \donttest{
# After normalisation: plot background-adjusted intensities
res <- bgnorm_pixels(img, sample_prop = 0.1)
plot_qptiff(res, markers = c("PanCK", "CD20"), scale = "sample")
# }