Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

buildAffine

Build an affine matrix up from its constituent transformations


Description

This function does the opposite to decomposeAffine, building up an affine matrix from its components. It can be useful for testing, or for rescaling images.

Usage

buildAffine(translation = c(0, 0, 0), scales = c(1, 1, 1), skews = c(0,
  0, 0), angles = c(0, 0, 0), source = NULL, target = NULL,
  anchor = c("none", "origin", "centre", "center"))

Arguments

translation

Translations along each axis, in pixunits units. May also be a list, such as that produced by decomposeAffine, with elements for translation, scales, skews and angles.

scales

Scale factors along each axis.

skews

Skews in the XY, XZ and YZ planes.

angles

Roll, pitch and yaw rotation angles, in radians. If source is two-dimensional, a single angle will be interpreted as being in the plane as expected.

source

The source image for the transformation (required).

target

The target image for the transformation. If NULL (the default), it will be equal to source, or a rescaled version of it if any of the scales are not 1. In the latter case the scales will be reset back to 1 to produce the right effect.

anchor

The fixed point for the transformation. Setting this parameter to a value other than "none" will override the translation parameter, with the final translation set to ensure that the requested point remains in the same place after transformation.

Value

A 4x4 affine matrix representing the composite transformation. Note that NiftyReg affines logically transform backwards, from target to source space, so the matrix may be the inverse of what is expected.

Author(s)

Jon Clayden <code@clayden.org>

See Also


RNiftyReg

Image Registration Using the 'NiftyReg' Library

v2.7.0
GPL-2
Authors
Jon Clayden [cre, aut] (<https://orcid.org/0000-0002-6608-0619>), Marc Modat [aut], Benoit Presles [aut], Thanasis Anthopoulos [aut], Pankaj Daga [aut]
Initial release
2020-09-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.