Generalized Procrustes Analysis (GPA) is typically performed on sets
of ‘fixed’ landmarks. However, the algorithm has been extended to allow
one to incorporate sliding semilandmarks on curves and surfaces. Here we
demonstrate this capability in gpagen
:
library(geomorph)
## Loading required package: RRPP
## Loading required package: rgl
## Loading required package: Matrix
data(plethodon)
pleth.gpa <- gpagen(plethodon$land, print.progress = F)
plot(pleth.gpa)
plotAllSpecimens(pleth.gpa$coords, links = plethodon$links)
Now let’s add some points on curves. To do so, one must provide
gpagen
with a matrix that specifies which landmarks should
be treated as sliding semilandmarks. This information is found in the
‘sliders’ matrix, which is a \(\small{m \times
3}\) matrix for \(\small{m}\)
sliding semilandmarks as described in lecture (NOTE:
StereoMorph
objects retain this information differently and
it is provided automatically: see below). Here is an
example of such a matrix:
data(hummingbirds)
hummingbirds$curvepts
## before slide after
## [1,] 1 11 12
## [2,] 11 12 13
## [3,] 13 14 15
## [4,] 7 15 14
## [5,] 12 13 14
## [6,] 1 16 17
## [7,] 16 17 18
## [8,] 17 18 19
## [9,] 18 19 20
## [10,] 10 20 19
## [11,] 2 21 22
## [12,] 21 22 23
## [13,] 22 23 24
## [14,] 23 24 25
## [15,] 8 25 24
The function gpagen
currently performs sliding in two
ways: based on Bending Energy or based on Procrustes Distance. These may
be implemented as follows:
gpa.BE <- gpagen(hummingbirds$land, curves=hummingbirds$curvepts, ProcD=FALSE, print.progress = F)
plot(gpa.BE)
gpa.procD <- gpagen(hummingbirds$land, curves=hummingbirds$curvepts, ProcD=TRUE, print.progress = F)
plot(gpa.procD)
library(StereoMorph)
shapes <- readShapes("Data/example.digitized")
shapesGM <- readland.shapes(shapes,
nCurvePts = c(12, 12, 12, 8, 6, 6, 6, 12, 10))
Y.gpa <- gpagen(shapesGM, print.progress = FALSE)
plot(Y.gpa)
Semilandmarks on curves can also be included. Here, one must provide
gpagen
with a vector specifying which landmarks are surface
points:
data(scallops)
scallops$surfslide
## [,1]
## [1,] 17
## [2,] 18
## [3,] 19
## [4,] 20
## [5,] 21
## [6,] 22
## [7,] 23
## [8,] 24
## [9,] 25
## [10,] 26
## [11,] 27
## [12,] 28
## [13,] 29
## [14,] 30
## [15,] 31
## [16,] 32
## [17,] 33
## [18,] 34
## [19,] 35
## [20,] 36
## [21,] 37
## [22,] 38
## [23,] 39
## [24,] 40
## [25,] 41
## [26,] 42
## [27,] 43
## [28,] 44
## [29,] 45
## [30,] 46
#Using Procrustes Distance for sliding
gpa.scallop <- gpagen(A=scallops$coorddata, curves=scallops$curvslide, surfaces=scallops$surfslide, print.progress = F)
plot(gpa.scallop)
Comments on curves matrices
How does one generate matrices for the
curves
argument ingpagen
? There are a couple of options.Manually. Once the format is understood, making matrices ‘by hand’ is possible.
define.sliders
. This is an interactive geomorph function with several options. The help file nicely explains how to use this function.readland.shape
. When digitizing withStereoMorph
and reading in the data withreadland.shapes
, a curves matrix is auto-generated, based on the number of semilandmarks prescribed.