align.extension | R Documentation |
Nuisance variation in landmark positions can be introduced by extension of certain structures. Fore example the extension of an insect's head relative to the rest of its body. This function moves a subset of landmarks in or out, such that all specimens will align to a median distance or to a designated reference specimen(s). This step should be run before Procrustes alignment, and it is robust to differences in the relative position, orientation and size of specimens.
align.extension( A, pts.1, pts.2 = NULL, reference.specimen = "all", show.plot = TRUE, threshold = 0.1, max.iter = 100, verbose = TRUE )
A |
A 3-dimensional array containing XY shape coordinates for multiple specimens, or a list containing such as an array and data provenance. |
pts.1 |
A vector or single value specifying the angle point of one subset. If more that one value is provided, the centroid of the landmarks described by the vector will be used; a single value identifies a specific landmark to use. |
pts.2 |
A vector or single value specifying the angle point of the second subset.
This could be the entire set of points of an articulated structure to be rotated.
If |
reference.specimen |
A number or numeric vector specifying which specimens should be taken as the reference for the angle
defined by |
show.plot |
A logical argument specifying whether to display a plot comparing the distributions of variance in landmark distances, corrected for centroid size, before and after alignment to the fixed angle. |
threshold |
A percentage value in the iterative improvement in centroid size-scaled landmark distances to serve as the threshold for completion. |
max.iter |
A numeric value to limit the number of iterations. |
verbose |
A logical argument specifying whether to display metrics each during each iteration. |
The input array should contain landmark coordinates with p, 2, and
n dimensions, where n is the number of specimens and p
is the number of landmarks). Dimension 2 must have two columns that contain
X and Y locations of the landmark. The function will pass extra arguments
to landmark.plot
, including links
.
Returns a list with coords
, provenance
, and
any other potential list elements from the input.
Dave Angelini david.r.angelini@gmail.com [aut, cre]
# Load the dataset data("Jadera", package = "borealis") # Define connecting lines { x <- 1:9 jhae.lines <- matrix(c(x[-length(x)], x[length(x)], x[-1], x[1]), ncol = 2) x <- c(10,11,17,16,15,12,13,14) jhae.lines <- rbind(jhae.lines, matrix(c(x[-length(x)], x[length(x)], x[-1], x[1]), ncol = 2) ) x <- c(17,18,15,16) jhae.lines <- rbind(jhae.lines, matrix(c(x[-length(x)], x[length(x)], x[-1], x[1]), ncol = 2) ) x <- c(19,21,22,20,26,25,32:34,31,35:39,29,40:42) jhae.lines <- rbind(jhae.lines, matrix(c(x[-length(x)], x[length(x)], x[-1], x[1]), ncol = 2) ) x <- c(19,23, 23,24, 23,28, 28,29, 19,24, 24,27, 27,28, 19,25, 27,30) jhae.lines <- rbind(jhae.lines, matrix(x, ncol = 2, byrow = TRUE) ) x <- c(1,3, 7,9, 14,16, 16,18) jhae.lines <- rbind(jhae.lines, matrix(x, ncol = 2, byrow = TRUE) ) } landmark.plot(Jadera, specimen.number = 1:4, axes = TRUE, links = jhae.lines) j2 <- align.extension(Jadera, pts.1 = 1:9, pts.2 = 10:18) landmark.plot(j2, specimen.number = 1:4, axes = TRUE, links = jhae.lines)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.