Struggling with automatic definition of semilandmarks using define.sliders

469 views
Skip to first unread message

Pedro Rocha

unread,
Sep 20, 2017, 3:02:59 PM9/20/17
to geomorph R package
Hello everyone,

I'm somewhat a (advanced) beginner to R and definitely new to geomorph, so sometimes small issues can be quite challenging and demanding. 
The issue I'm currently stuck with is related to the definition of semilandmarks using define.sliders. I've attached a TPS file containing a subset of my dataset of coordinates, which I've managed to import to R and calculate GPA alignment considering all coordinates as landmarks:

# Read tps file
land <-  readland.tps("ShapeTPS.tps", specID = "ID")

# Generalized Procrustes analysis without sliders
gpa <- gpagen(land,PrinAxes=FALSE, print.progress = FALSE)

However, when I try to define the semilandmarks automatically, it doesn't work and R returns the error "Error in La.svd(MY, k, k) : infinite or missing values in 'x'".

# Define sliders
sliders = rbind(define.sliders(1:27), define.sliders(27:52))

# Generalized procrustes analysis considering semilandmarks
gpa <- gpagen(land,PrinAxes=FALSE, print.progress = FALSE, curves = sliders)

I believe there is an issue with my result of define.sliders, as my matrix looks odd compared to the examples available:
> head(sliders)
     before slide after
[1,]      1     2     3
[2,]      2     3     4
[3,]      3     4     5
[4,]      4     5     6
[5,]      5     6     7
[6,]      6     7     8


Using the image attached as reference, I'd like points 1 and 27 to be fixed landmarks, whereas 2:26 and 28:52 are meant to slide.

Given that it is possible to define the semilandmarks automatically, I'd rather not have to do it manually. 

I'll appreciate any help.

ShapeTPS.tps
shape-polygon.jpeg

Adams, Dean [EEOBS]

unread,
Sep 20, 2017, 6:56:36 PM9/20/17
to geomorph-...@googlegroups.com

Pedro,

 

The problem is somewhere in your landmark data, not your sliders designation.  I confirmed this by generating random landmark data and applying your approach:

 

land<-matrix(rnorm(52*2*56),ncol=2)

land<-arrayspecs(land,p=52,k=2)

 

With this, gpagen with sliders runs without error.

 

I suggest you look closely at your original landmarks, specimen by specimen. In a very quick glance of this I noticed that there are many repeat X-values for coordinates. A bit odd. Also, in some specimens the corresponding Y-values are ‘out of order’ implying that the sliding might try to move things ‘past’ one another in the scheme you have devised.

 

Dean

 

Dr. Dean C. Adams

Professor

Department of Ecology, Evolution, and Organismal Biology

       Department of Statistics

Iowa State University

www.public.iastate.edu/~dcadams/

phone: 515-294-3834

--
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 post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/14560535-4d1b-4d36-835b-a9df3e8e91bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pedro Rocha

unread,
Sep 21, 2017, 1:13:00 PM9/21/17
to geomorph R package
Dean,

I managed to define the semilandmarks using the random landmark data, so I agree that there is an issue with my data. 

land<-matrix(rnorm(52*2*56),ncol=2)
land<-arrayspecs(land,p=52,k=2)
sliders = rbind(define.sliders(1:27), define.sliders(c(27:52,1)))
gpaSLM <- gpagen(land,PrinAxes=FALSE, print.progress = FALSE, curves = sliders)

Call:
gpagen(A = land, curves = sliders, PrinAxes = FALSE, print.progress = FALSE) 

Generalized Procrustes Analysis
with Partial Procrustes Superimposition

2 fixed landmarks
50 semilandmarks (sliders)
2-dimensional landmarks
6 GPA iterations to converge


The shape I'm analyzing is a cross correlation with some energy graphs (it can be though as a level curve in a mountain peak). The y coordinates of landmarks are calculated using energy from south to north (minimum to maximum y values) of the "mountain". For each calculated y value, I have two correlated x values in the level curve, except for the minimum and maximum y values, which have one correlated x value each. 
Therefore, all x and y values in my landmark data are automatically calculated and their acquisition order is always the same (Max y value, decreasing y with correlated x1, min y value, increasing y values with correlated x2). I checked all of my images and the landmarks are definitely in the same order. I've even tried to change the order, but it returned the same error (see new polygon attached). 

I looked into the gpagen function but failed to understand what is causing the error, or how could I go around it. If the problem is truly with how I'm acquiring my data, then I would probably need to go back to square one...However, I do believe there is a way of adapting gpagen to my data, we just need to figure out how. 

Any thoughts?

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph...@googlegroups.com.

shape-polygon2.jpeg

Adams, Dean [EEOBS]

unread,
Sep 21, 2017, 3:23:56 PM9/21/17
to geomorph-...@googlegroups.com

Pedro,

 

The problem is definitely with your data and how it was acquired: it is not a problem with gpagen.

 

After much digging I found at least one problem: specimen 32 has several landmarks which have precisely the same x & y coordinates. Having two landmarks in the same configuration with identical coordinates will cause all sorts of issues computationally: for instance, the tangents for sliding will be undefined, which will cause the numerical analyses based on those tangents to not be completed. 

 

Then one must ask what it means biologically (or in any quantitative context) to have the same coordinates for ‘different’ anatomical landmarks in the same shape configuration.  That doesn’t seem to make any conceptual sense either.

 

Note that there may be other specimens further in the dataset with similar issues; I stopped looking for you once I identified this one.

 

I suggest you refine your automated landmarking procedure, as it does not appear to be fool-proof.

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

--

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 post to this group, send email to geomorph-...@googlegroups.com.

Pedro Rocha

unread,
Sep 22, 2017, 1:36:03 PM9/22/17
to geomorph-...@googlegroups.com
Dean, 

You got it right, the landmarks with identical coordinates were causing the error. I made some changes in the way I was acquiring the values and reduced the number of landmarks to avoid those duplicates. It did the trick!

Thanks a lot for your help.

Best,

Pedro

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

--
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-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph-r-package@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "geomorph R package" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geomorph-r-package/L53wULYgSvg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geomorph-r-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph-r-package@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Pedro Rocha
Bacharel em Ciências Biológicas - UFMG
Mestrando em Biologia Animal - UFV
(31) 98545 7075
Reply all
Reply to author
Forward
0 new messages