| getShift | R Documentation |
Determine the optimal x-y shift to align the target image with the (nuclear) mask.
getShift(mask, target, parscale = c(25, 25), FUN = idiff, value = FALSE)
mask |
An object mask with connected pixels having the same integer value. |
target |
A fluorescent |
parscale |
A numeric vector of length 2 used as the
|
FUN |
Function to be minimized over |
value |
Logical value (default |
This optimization function FUN accepts three arguments
(x, mask, target) where x is a numeric vector of
length two representing the x and y position in the integer
Image mask (mask) and the Image object
(target). FUN must return a single value
representing the difference between the two images. The
optim function minimizes FUN with respect to
x[1] and x[2]. The default function is designed
to align nuclear masks with predominantly nuclear signals and
should be replaced for other localization patterns.
The argument parscale is used by optim to scale the
parameters in x such that a unit change in the parameter
amounts to unit change in the optimizing function empirically,
c(25, 25) seems to be in the middle of a robust range.
If value = FALSE, a list of subpixel translations named "dx"
and "dy" that can be applied to the argument target with
translate to maximize the alignment between mask and target.
If value = TRUE, a list of magnitude of the shift required for
each image.
path <- system.file("extdata", "by_folder/b2", package = "virustiter")
x <- getImages(path)
getShift(nucMask(x$nuc[[1]]), x$tgt[[1]], value = TRUE)
getShift(nucMask(x$nuc[[1]]), x$tgt[[1]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.