Learn R Programming

Morpho (version 2.12)

computeTransform: calculate an affine transformation matrix

Description

calculate an affine transformation matrix

Usage

computeTransform(
  x,
  y,
  type = c("rigid", "similarity", "affine", "tps"),
  reflection = FALSE,
  lambda = 1e-08,
  weights = NULL,
  centerweight = FALSE,
  threads = 1
)

Value

returns a 4x4 (3x3 in 2D case) transformation matrix or an object of class "tpsCoeff" in case of type="tps".

Arguments

x

fix landmarks. Can be a k x m matrix or mesh3d.

y

moving landmarks. Can be a k x m matrix or mesh3d.

type

set type of affine transformation: options are "rigid", "similarity" (rigid + scale) and "affine",

reflection

logical: if TRUE "rigid" and "similarity" allow reflections.

lambda

numeric: regularisation parameter of the TPS.

weights

vector of length k, containing weights for each landmark (only used in type="rigid" or "similarity").

centerweight

logical or vector of weights: if weights are defined and centerweigths=TRUE, the matrix will be centered according to these weights instead of the barycenter. If centerweight is a vector of length nrow(x), the barycenter will be weighted accordingly.

threads

number of threads to use in TPS interpolation.

Details

x and y can also be a pair of meshes with corresponding vertices.

See Also

rotonto, link{rotmesh.onto}, tps3d

Examples

Run this code
data(boneData)
trafo <- computeTransform(boneLM[,,1],boneLM[,,2])
transLM <- applyTransform(boneLM[,,2],trafo)

Run the code above in your browser using DataLab