Edit the image with img_edit()
then update the imgData()
.
img_update(
spe,
sampleid,
image_id = "lowres",
new_image_id = paste0("edited_", image_id),
overwrite = FALSE,
...
)
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.
A character(1)
specifying which sample to plot from
colData(spe)$sample_id
(formerly colData(spe)$sample_name
).
A character(1)
with the name of the image ID you want to
use in the background.
A character(1)
specifying the new image_id
to use.
A logical(1)
specifying whether to overwrite the
image_id
if it already exists.
Parameters passed to img_edit()
.
A
SpatialExperiment-class object
with an updated imgData()
slot.
Other Image editing functions:
img_edit()
,
img_update_all()
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))
}
#> 2023-09-05 20:32:15.386633 loading file /github/home/.cache/R/BiocFileCache/152d33414640_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1
#> DataFrame with 13 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
#> ... ... ... ... ...
#> 9 151673 lowres #### 0.0450045
#> 10 151674 lowres #### 0.0450045
#> 11 151675 lowres #### 0.0450045
#> 12 151676 lowres #### 0.0450045
#> 13 151507 edited_lowres #### 0.0450045