To calculate the average coordinates of all of the
endocasts:
Files you need:
gpaspecimens_slid_coords - from aligning all of the specimens' original and mirrored
endocasts and sliding the semi-landmarks:
First separate out the coordinates that go to the original and flipped endocasts:
-
if you look
here you can see the order my
endocasts are in for the gpaspecimens_slid_coords file, so I need to extract every even set of coordinates for the original
endocasts and every odd set for the
flipped.
-
created a
variable of odd numbers using
seq(from #, to #, by #) so from 1 to 60, every 2:
x =
seq(1,60,2)
y =
seq(2,60,2)
because I had some duplicate
endocasts for error testing I actually want:
x1 =
seq(1,8,2)
x2 =
seq(13,60,2)
y1 =
seq(2,8,2)
y2 =
seq(14,60,2)
Then I pull out the coordinates for the original and flipped
endocasts:
gpaspecimens_slid_coords_original <- gpaspecimens_slid_coords
[,,y]
gpaspecimens_slid_coords_flipped <- gpaspecimens_slid_coords
[,,x]
or for me:
gpaspecimens_slid_coords_original <- gpaspecimens_slid_coords[,,c(y1,y2)]
gpaspecimens_slid_coords_flipped <- gpaspecimens_slid_coords[,,c(x1,x2)]
now you have 2 3D arrays with just the original and just the flipped coordinates after
gpa alignment and semi-landmark sliding.
To create the average landmark coordinates for a set of specimens:
you will need the
mshape() function from
geomorph:
library(geomorph)
mean_original_shape <-
mshape(gpaspecimens_slid_coords_original)
mean_flipped_shape <-
mshape(gpaspecimens_slid_coords_flipped)
You can also find the specimen closest to the average shape:
using geomorph:
findMeanSpec(gpaspecimens_slid_coords) - from all
endocasts, both original and flipped
or
findMeanSpec(gpaspecimens_slid_coords_original) - just original
findMeanSpec(gpaspecimens_slid_coords_flipped) - just flipped
it will output the name of the specimen and the specimen number (where it appears in the array)
No comments:
Post a Comment