smooth_image | R Documentation |
Apply iterative smoothing to Vesalius images
smooth_image(
vesalius_assay,
dimensions = seq(1, 3),
embedding = "last",
method = "iso",
iter = 1,
sigma = 1,
box = 20,
threshold = 0,
neuman = TRUE,
gaussian = TRUE,
na.rm = FALSE,
across_levels = "min",
verbose = TRUE
)
vesalius_assay |
a vesalius_assay object |
dimensions |
numeric vector of latent space dimensions to use. |
embedding |
character string describing which embedding should be used. |
method |
character describing smoothing method to use "median" , "iso" or "box" or a combination of them. |
iter |
numeric - number of smoothing iteration |
sigma |
numeric - standard deviation associated with isoblur (Gaussian) |
box |
numeric describing box size (centered around center pixel) for smoothing |
threshold |
numeric - discard pixels that are too low in value (cutoff threshold only applied in box/median blurs). |
neuman |
logical describing If Neumann boundary conditions should be used, Dirichlet otherwise (default true, Neumann) |
gaussian |
logical - use gaussian filter |
na.rm |
logical describing if NA values should be removed |
across_levels |
character - method used to account for multiple smoothing levels (see details). Select from: "min","mean", "max" |
verbose |
logical - progress message output. |
The smooth_image function provides a series of options to smooth your grey scale images contained within the vesalius_assay object.
You can select any number of dimensions to be smoothed. As default, we take the first 3 dimensions.
Vesalius provides 3 smoothing methods: * median: computes median color in box (box size defined by box) * box: computes max color value in box (box size defined by box) * iso: compute gaussian kernel using sigma (Gussian SD defined by sigma)
Vesalius can apply the same smoothing paramters over multiple iterations as defined by the iter argument. It is also possible to provide multiple values to box and sigma as numeric vectors. Vesalius will run the smoothing over all provided values and return either the maximum, minimum or mean color value as described by the across_levels argument.
Please note that unless specified the smoothing always applied to
the active embedding (default is last embedding computed). If you
want to start over you can simply set embedding
to which ever
embedding you want to work with.
This will take the raw embedding values before any image processing has been applied. No need to re-run the embedding if you are not satisfied with the smoothing.
For more information, we suggest reading through the imager vignette.
a vesalius_assay
## Not run:
data(vesalius)
# First we build a simple object
ves <- build_vesalius_object(coordinates, counts)
# We can do a simple run
ves <- build_vesalius_embeddings(ves)
# simple smoothing
ves <- smooth_image(ves, embedding = "PCA")
# multiple rounds
ves <- smooth_image(ves, iter = 3, embedding = "PCA")
# accross level
ves <- smooth_image(ves, box = seq(3,11),
accross_level = "mean",
embedding = "PCA")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.