alignImage | R Documentation |
Aligns an image with the reference image. See details for more information about the process.
alignImage(object, ...)
## S4 method for signature 'SPATA2'
alignImage(
object,
img_name,
opt = "set",
angle = NULL,
flip_h = NULL,
flip_v = NULL,
stretch_h = NULL,
stretch_v = NULL,
transl_h = NULL,
transl_v = NULL
)
## S4 method for signature 'SpatialData'
alignImage(
object,
img_name,
opt = "set",
angle = NULL,
flip_h = NULL,
flip_v = NULL,
stretch_h = NULL,
stretch_v = NULL,
transl_h = NULL,
transl_v = NULL
)
## S4 method for signature 'HistoImage'
alignImage(
object,
opt = "set",
angle = NULL,
flip_h = NULL,
flip_v = NULL,
stretch_h = NULL,
stretch_v = NULL,
transl_h = NULL,
transl_v = NULL
)
alignImageAuto(object, ...)
## S4 method for signature 'SpatialData'
alignImageAuto(
object,
img_name,
step = 0.01,
stop_at = 25,
plot_progress = TRUE,
verbose = TRUE
)
alignImageInteractive(object, ...)
## S4 method for signature 'SPATA2'
alignImageInteractive(object)
## S4 method for signature 'SpatialData'
alignImageInteractive(object, window_size = "800px")
object |
An object of class |
... |
Used to absorb deprecated arguments or functions. |
img_name |
Character value. The name of the image of interest.
If |
opt |
Character value. Either 'add' or 'set'. Decides whether the input adjustments are added to the existing ones or set (replacing them). |
angle |
Numeric value ranging between 0-359. Determines if/how much the image is supposed to be rotated. Always rotates in clockwise direction. |
flip_h , flip_v |
Logical values. Determine if the image is supposed to be flipped around the horizontal or vertical axis. |
stretch_h , stretch_v |
Numeric values. Determine if and how the image is supposed to be stretched along the horizontal or vertical axis. |
transl_h , transl_v |
Numeric values. Determine if and how the image is supposed to be translated along the hhorizontal or vertical axis. |
step |
Numeric value specifying the accuracy of the alignment
via vertical and horizontal translation. If |
verbose |
Logical. If (Warning messages will always be printed.) |
stop_after |
Numeric value specifying the maximum number of consecutive iterations
during optimization of the image translation without improvement. If |
The transformations required to align image X with the reference
image are stored as instructions in the HistoImage
container of the
respective image. More precisely, in slot @transformations. The image itself
remains as is after being loaded
. The transformations
are applied upon extraction of the image. Use getImageTransformations()
to
otbain the instructions currently stored.
The updated input object, containing the added, removed or computed results.
library(SPATA2)
library(tidyverse)
data("example_data")
object <- example_data$object_UKF275T_diet
# ----- prepare
library(SPATA2)
library(EBImage)
library(tidyverse)
data("example_data")
object <- example_data$object_UKF275T_diet
img_bad <-
getImage(object) %>%
translate(v = c(25, 20), bg.col = "green")
#----- opt = "set" (the default)
object <- registerImage(object, img = img_bad, img_name = "bad", overwrite = T)
object <- activateImage(object, img_name = "bad")
plotSurface(object, pt_clr = "red", display_image = T)
object <- alignImage(object, img_name = "bad", opt = "set", transl_h = -25, transl_v = -20)
plotSurface(object, pt_clr = "red", display_image = T)
#----- opt = "add"
object <- registerImage(object, img = img_bad, img_name = "bad", overwrite = T)
object <- activateImage(object, img_name = "bad")
plotSurface(object, pt_clr = "red", display_image = T)
object <- alignImage(object, img_name = "bad", opt = "add", transl_h = -15, transl_v = -10)
plotSurface(object, pt_clr = "red", display_image = T)
object <- alignImage(object, img_name = "bad", opt = "add", transl_h = -10, transl_v = -10)
plotSurface(object, pt_clr = "red", display_image = T)
# ----- interactive
if(FALSE){ # diffused, run separately
object <- alignImageInteractive(object)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.