Conducts Procrustes superimposition to align 3D shapes with or without scaling to centroid size.

Share:

Description

Conducts Procrustes superimposition to align 3D shapes with or without scaling to centroid size. Skips any missing values in computation of Procrustes coordinates.

Usage

1
2
procrustes(A, scale = TRUE, scaleDelta = FALSE, maxiter = 1000,
  tolerance = 1e-05)

Arguments

A

N x 3 x M matrix where N is the number of landmarks, 3 is the number of dimensions, and M is the number of specimens

scale

Logical indicating whether objects should be scaled to unit centroid size

scaleDelta

Logical determining whether deltaa should be scaled by the total number of landmarks.

maxiter

Maximum number of iterations to attempt

tolerance

Difference between two iterations that will cause the search to stop.

Details

A number of computations are run until the difference between two iterations is less than tolerance. The more specimens and landmarks you have, the less each landmark is allowed to move before this tolerance is reached. Setting scaleDelta = TRUE will make the alignment run faster but have potentially less well aligned results. But the alignment between a large and small array of shapes should be more comparable with scaleDelta = TRUE. However, preliminary tests imply that run time scales linearly with scaleDelta set to TRUE or FALSE.

Value

A new (N x 3 x M) array, where each 3d vector has been rotated and translated to minimize distances among specimens, and scaled to unit centroid size if requested.

Examples

1
2
3
4
5
6
7
8
# Make an array with 6 specimens and 20 landmarks
A <- array(rep(rnorm(6 * 20, sd = 20), each = 6) + rnorm(20 * 3 * 6 ), 
      dim = c(20, 3, 6))

# Align the data (although it is already largely aligned)
aligned <- procrustes(A)

plotSpecimens(aligned)