Getting Strange Configurations After Sliding Semilandmarks

32 views
Skip to first unread message

Claudia

unread,
Jul 17, 2025, 11:45:08 PMJul 17
to geomorph R package
Hi, everyone - I am trying to slide semilandmarks while performing GPA using the gpagen function, by minimizing bending energy.  I'm not having any problems with coding, but after sliding semilandmarks, I'm getting some strange shape configurations.

In a recent post, another poster having trouble with getting strange shape configurations received the following advice from Mike Collyer:

"I bet if you did separate GPAs on each eye, you would not have these same issues.  If that were the case, one might consider doing GPA with sliding landmarks by eye, inflating the resulting configurations by centroid size, and then translating eyes back to their fixed landmark positions in the 4-eyed landmark configurations, before finalizing the analysis with GPA without sliding."

I understand the first part of this advice - perform a separate GPA on each specimen and slide semilandmarks for just that specimen while performing the GPA.  I also understand the lasts part of this advice - perform a GPA on all specimens, but don't slide semilandmarks for them (since you already did that for each individual specimen).  But I'm not sure I understand the advice that follows it.  I have two questions:

1) How would one inflate each resulting configuration by centroid size?
2) How would one translate each specimen back to its fixed landmark position?

I'm just not sure what practical steps one would take to do do these things.  Could someone please elaborate on this?

Thank you so much!

Best,
Claudia


Mike Collyer

unread,
Jul 18, 2025, 12:35:03 PMJul 18
to geomorph-...@googlegroups.com
Dear Claudia,

There are several ways this could be done.  Below is script for one way, using the larvalMorph data set (which has separate configurations of heads and tails, originally digitized together is same images).

library(geomorph)
data("larvalMorph")

n <- length(larvalMorph$family)

# 1, get mean locations

headmeans <- colMeans(larvalMorph$headcoords)
tailmeans <- colMeans(larvalMorph$tailcoords)

# 2, separate GPAs

headGPA <- gpagen(larvalMorph$headcoords, 
                  curves = larvalMorph$head.sliders,
                  PrinAxes = FALSE)
tailGPA <- gpagen(larvalMorph$tailcoords, 
                  curves = larvalMorph$tail.sliders,
                  PrinAxes = FALSE)

# 3, rescale configurations

headcoords <- headGPA$coords
headsize <- headGPA$Csize
for(i in 1:n) headcoords[,,i] <- headcoords[,,i] * headsize[i]

tailcoords <- tailGPA$coords
tailsize <- tailGPA$Csize
for(i in 1:n) tailcoords[,,i] <- tailcoords[,,i] * tailsize[i]

# 4, add back the mean locations

for(i in 1:n) headcoords[,,i] <- 
  t(t(headcoords[,,i]) + headmeans[, i])
for(i in 1:n) tailcoords[,,i] <- 
  t(t(tailcoords[,,i]) + tailmeans[,i])

# 5, combine landmark sets

coords <- list()
for(i in 1:n) coords[[i]] <- rbind(headcoords[,,i], tailcoords[,,i])
names(coords) <- dimnames(larvalMorph$headcoords)[[3]]
coords <- simplify2array(coords)

# 6, GPA of combined sets

GPA <- gpagen(coords)
plot(GPA)

Here is a plot of the result

PastedGraphic-1.tiff
So, in this example, head sliders only applied to heads and tail sliders only to tails, meaning a bending energy matrix did not have to be created that included both heads and tails (so landmarks in the head had no effect on the tails and vice versa).  One might call this localized sliding.  

Also, I should note that although this is better than using original configurations (see Collyer et al. 2020, Fig 1), for this particular example, it would be better to align the configurations separately, because the spatial relationships between heads and tails is not fixed.  This is why we have the combine.subsets function, which can make a composite of separate alignments but does not preserve sub-configuration locations.

Hope this helps!

Mike

Collyer, M. L., Davis, M. A., & Adams, D. C. (2020). Making heads or tails of combined landmark configurations in geometric morphometric data. Evolutionary Biology, 47, 193-205.



--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/geomorph-r-package/39f7c647-6b0b-4539-8c63-0ebade940d59n%40googlegroups.com.

Message has been deleted

Claudia

unread,
Jul 22, 2025, 8:07:49 AMJul 22
to geomorph R package
Thank you so much for your detailed reply, Mike!  I'm going to try this all out.

Best,
Claudia
Reply all
Reply to author
Forward
0 new messages