Create a template (i.e., a set of curves describing the structure the landmarks are placed upon) to aid morphospace visualization, interactively.

build_template2d(image, nlands, ncurves)

Arguments

image

Character; the path to an image of the structure, in png format.

nlands

Integer; the number of landmarks to be placed.

ncurves

Integer; the number of curves to be drawn.

Value

A 2-column matrix with the landmark configuration (standardized for scale and position) followed by the coordinates defining the curves drawn, separated by NAs.

Details

This functions let the user create a template interactively. The user will be first asked to place the landmarks (the same place and order than the shape data of interest). Once nland landmarks have been placed, the user will be asked to place the number of curves specified in ncurves; the number of coordinates used to drawn each is arbitrary, and is up the user to decide when the curve is ready (press the 'Finish' button in the top-right corner of the Plots pane).

References

Claude, J. (2008). Morphometrics with R. Springer Science & Business Media, 316.

Examples

#generate template interactively
if (FALSE) {
temp <- build_template2d(image = "extdata/sample_wing.jpg", nlands = 9,
                         ncurves = 9)

plot(temp, type = "n", asp = 1)
points(temp[c(1:9),], col = "red", pch = 16)
points(temp[-c(1:9),], type = "l")
}