unifyLandmarks(lm.array, min.common = dim(lm.array)[2])## S3 method for class 'unifyLandmarks':
summary(object, ...)
readLandmarksToArray.dim(lm.array)[2]."unifyLandmarks" (the output of unifyLandmarks())."unifyLandmarks" with the following elements:lm.array should be an array of 2D or 3D landmark matrices with row names, such as created by readLandmarksToArray. The first two dimensions of lm.array correspond to the rows and columns of each matrix, respectively. The last dimension of lm.array corresponds to each separate landmark matrix.unifyLandmarks() first aligns all pair combinations of landmark sets that share the minimum number of points specified by min.common. The two sets that align with the lowest root-mean-square (RMS) error are aligned and the mean positions of all points saved. If there are additional landmark sets, unifyLandmarks() aligns each of these with the combined matrix, again identifying the set that aligns with the least RMS error. The alignment with the least error is saved as the new combined landmark matrix. This is repeated for each remaining landmark set, sequentially aligning remaining landmark sets to the combined landmark matrix.
To align two 2D landmark sets, the sets must share at least two landmarks and to align two 3D landmark sets, the sets must share at least three landmarks. These are the default minimum number of points for alignment. A greater number of common points can be specified using the min.common parameter. Additionally, in the 3D case, these landmarks must not be collinear. If lm.array contains more than two landmark matrices, it is not necessarily required that each landmark set share these minimum number of points with every other landmark set. For example, it may be that two landmark sets do not each separately share the minimum number of landmarks required for alignment with a third landmark set. But if these two landmark sets are combined, they may then share the required number of landmarks with the third set. During each alignment step, unifyLandmarks() skips pairs of matrices that do not share the required number of landmarks. As long as there is some combination of alignments that provide a sufficient number of shared landmarks, all landmark sets can be combined into a single matrix.
If an array consisting of only one landmark matrix is input, the matrix is returned without an alignment operation.
For a step-by-step tutorial on how to use unifyLandmarks() see
findOptimalPointAlignment## FIND THE FILE DIRECTORY FOR EXTRA R PACKAGE FILES
fdir <- paste0(path.package("StereoMorph"), "/extdata/")
## SET LANDMARK FILES
file <- paste0(fdir, "lm_3d_even_a", 1:3, ".txt")
## READ LANDMARKS INTO ARRAY
lm.array <- readLandmarksToArray(file, row.names=1)
## UNIFY LANDMARKS
unify_lm <- unifyLandmarks(lm.array)
## PRINT UNIFICATION SUMMARY
print(summary(unify_lm))Run the code above in your browser using DataLab