Content Description

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:

Example 1: fixed points only

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)

Example 2: Points and Semilandmarks on Curves

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)

Example using StereoMorph Objects

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)

Example 3: Points, Curves and Surfaces

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 in gpagen? There are a couple of options.

  1. Manually. Once the format is understood, making matrices ‘by hand’ is possible.

  2. define.sliders. This is an interactive geomorph function with several options. The help file nicely explains how to use this function.

  3. readland.shape. When digitizing with StereoMorph and reading in the data with readland.shapes, a curves matrix is auto-generated, based on the number of semilandmarks prescribed.