warp2: Warping to Align 2D Signals

warp2R Documentation

Warping to Align 2D Signals

Description

Register two images by warping a "moving" image to align with the "fixed" image.

Usage

# Transformation-based registration
warp2_trans(x, y, control = list(),
    trans = c("rigid", "similarity", "affine"),
    metric = c("cor", "mse", "mi"), nbins = 64L,
    scale = TRUE, dimout = dim(y))

# Mutual information
mi(x, y, n = 64L)

Arguments

x, y

Images to be aligned by warping x (which is "moving") to match y (which is "fixed").

control

A list of optimization control parameters. Passed to optim().

trans

The type of transformation allowed: "rigid" means translation and rotation, "similarity" means translation, rotation, and scaling, and "affine" means a general affine transformation.

metric

The metric to optimize.

nbins, n

The number of histogram bins to use when calculating mutual information.

scale

Should the images be normalized to have the same intensity range?

dimout

The dimensions of the returned matrix.

Details

warp2_trans() performs a simple transformation-based registration using optim for optimization.

Value

A numeric vector the same length as y with the warped x.

Author(s)

Kylie A. Bemis

See Also

trans2d, optim

Examples

set.seed(1)
x <- matrix(0, nrow=32, ncol=32)
x[9:24,9:24] <- 10
x <- x + runif(length(x))
xt <- trans2d(x, rotate=15, translate=c(-5, 5))
xw <- warp2_trans(xt, x)

par(mfcol=c(1,3))
image(x, col=hcl.colors(256), main="original")
image(xt, col=hcl.colors(256), main="transformed")
image(xw, col=hcl.colors(256), main="registered")

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.