This function uses img_update() for all samples. That is, it loops through every sample and edits the image with img_edit() and then updates the imgData().

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

Arguments

spe

A SpatialExperiment-class object. See fetch_data() for how to download some example objects or read10xVisiumWrapper() to read in spaceranger --count output files and build your own spe object.

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()

Examples

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

    ## Reduce brightness to 25% for the 'lowres' image for all samples and
    ## update the imgData()
    imgData(img_update_all(spe, brightness = 25))
}
#> 2024-12-13 19:41:27.303743 loading file /github/home/.cache/R/BiocFileCache/103d2e431726_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1
#> DataFrame with 24 rows and 4 columns
#>       sample_id      image_id   data scaleFactor
#>     <character>   <character> <list>   <numeric>
#> 1        151507        lowres   ####   0.0450045
#> 2        151508        lowres   ####   0.0450045
#> 3        151509        lowres   ####   0.0450045
#> 4        151510        lowres   ####   0.0450045
#> 5        151669        lowres   ####   0.0450045
#> ...         ...           ...    ...         ...
#> 20       151672 edited_lowres   ####   0.0450045
#> 21       151673 edited_lowres   ####   0.0450045
#> 22       151674 edited_lowres   ####   0.0450045
#> 23       151675 edited_lowres   ####   0.0450045
#> 24       151676 edited_lowres   ####   0.0450045