img_update: Update the image for one sample

View source: R/img_update.R

img_updateR Documentation

Update the image for one sample

Description

Edit the image with img_edit() then update the imgData().

Usage

img_update(
  spe,
  sampleid,
  image_id = "lowres",
  new_image_id = paste0("edited_", image_id),
  overwrite = FALSE,
  ...
)

Arguments

spe

Defaults to the output of fetch_data(type = 'spe'). This is a SpatialExperiment-class object with the spot-level Visium data and information required for visualizing the histology. See fetch_data() for more details.

sampleid

A character(1) specifying which sample to plot from colData(spe)$sample_id (formerly colData(spe)$sample_name).

image_id

A character(1) with the name of the image ID you want to use in the background.

new_image_id

A character(1) specifying the new image_id to use.

overwrite

A logical(1) specifying whether to overwrite the image_id if it already exists.

...

Parameters passed to img_edit().

Value

A SpatialExperiment-class object with an updated imgData() slot.

See Also

Other Image editing functions: img_edit(), img_update_all()

Examples

if (enough_ram()) {
    ## Obtain the necessary data
    if (!exists("spe")) spe <- fetch_data("spe")

    ## Reduce brightness to 25% and update the imgData()
    imgData(img_update(spe, sampleid = "151507", brightness = 25))
}

LieberInstitute/spatialLIBD documentation built on April 21, 2024, 6:47 p.m.