HEAD
resizeImage.Rd
Saves the instructions to use and store the resized version of an image to optimize resolution and memory usage.
=======This function allows for resizing images and reducing their dimensions and thus their required storage in the global environment.
>>>>>>> 99de33d (v3.1.0 restored 1)resizeImage(object, ...)
# S4 method for class 'SPATA2'
resizeImage(
object,
img_name,
resize_fct,
img_name_new = "{img_name}_{resize_fct}",
apply_to_transl = TRUE,
overwrite = FALSE,
verbose = NULL
)
# S4 method for class 'SpatialData'
resizeImage(
object,
img_name,
resize_fct,
img_name_new = "{img_name}_{resize_fct}",
apply_to_transl = TRUE,
overwrite = FALSE,
verbose = TRUE,
...
)
# S4 method for class 'HistoImage'
resizeImage(object, resize_fct, apply_to_transl = TRUE, verbose = TRUE, ...)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Used to absorb deprecated arguments or functions.
Character value. The image to be resized.
The value should be a positive number between 0 and 1, representing the proportion by which the image should be resized.
For example, 0.5
will resize the image to 50% of its original dimensions.
Character value. The name of the image to be resized.
A numeric value which should be a positive number between 0 and 1,
representing the proportion by which the image should be resized. For example, 0.5
will resize
the image to 50% of its original dimensions.
A character string or glue instruction, specifying the name for the resized image. <<<<<<< HEAD If character, a new, additional image is registered. Set to FALSE if you want the resized image to be registered under the original image name.
Defaults to img_name_new = {img_name}_{resize_fct}
.
Logical. If TRUE, the resizing will also be applied to
instructions on how to translate the image as set with alignImage()
and/or alignImageInteractive()
.
(If you have not conducted any alignment so far, this won't have an effect.)
FALSE
if you want the resized
image to be registered under the original image name.
Defaults to new_img_name = <img_name>_<resize_fct>
.
Logical. If TRUE
, the resizing will also be applied to instructions on how
to translate the image as set with alignImage()
and/or alignImageInteractive()
. (If you have not
conducted any alignment so far, this won't have an effect.)
Logical value. Must be TRUE
to allow overwriting.
Logical. If TRUE
, informative messages regarding
the computational progress will be printed.
(Warning messages will always be printed.)
The updated input object, containing the added, removed or computed results.
This function sets instructions on how to deal with the size of the image. By default, any
image registered in the SPATA2 object manually or during initiation with, for instance, initiateSpataObjectVisium()
is registered with the original size (width x height) as stored on the disk on your device. R is not
particularly efficient when it comes to handling images of a certain size. This resizing functionality
allows you to adjust the size in which the image is handled when used in order to optimize the ratio
between image resolution and computational performance.
This function sets instructions on how to deal with the size of the image.
By default, any image registered in the SPATA2
object manually or during initiation with,
for instance, initiateSpataObjectVisium()
is registered with the original size (width x height) as
stored on the disk on your device. R is not particularly efficient when it comes to handling
images of a certain size. This resizing functionality allows you to adjust the size in which
the image is handled when used in order to optimize the ratio between image resolution and
computational performance.
Note that you can register one and the same image multiple times with different instructions on resizing. See examples.
>>>>>>> 99de33d (v3.1.0 restored 1)
library(SPATA2)
library(SPATAData)
object <- downloadSpataObject("UKF313T")
# contains two images
getImageNames(object)
<<<<<<< HEAD
# Resize the "hires" image by a factor of 0.5 and update the object
object <- resizeImage(object, img_name = "hires", resize_with = 0.5)
# Now the object contains three images
getImageNames(object)
# Note how both 'registered images' draw from the same directory
# This is possible since the instruction to resize the image is applied
=======
object <- resizeImage(object, img_name = "hires", resize_with = 0.5)
# contains three images
getImageNames(object)
# note how both 'registered images' draw from the same directory
# this is possible since the instruction to resize the image is applied
>>>>>>> 99de33d (v3.1.0 restored 1)
# during loadImage()
getImageDir(object, img_name = "lowres") # dir 1
getImageDir(object, img_name = "hires") # dir 2
getImageDir(object, img_name = "hires_0.5") # dir 2
<<<<<<< HEAD
# ---> Check out writeImage() to store information of downloaded SPATA2 objects on your disk
# Show the results: plot the original and resized image
=======
# ---> check out writeImage() to store information of downloaded SPATA2 objects on your disk
# show results
>>>>>>> 99de33d (v3.1.0 restored 1)
plotImage(object, img_name = "hires") +
plotImage(object, img_name = "hires_0.5") # by default, resized images are renamed