Missing landmarks are estimated by deforming a sample average or a weighted estimate of the configurations most similar onto the deficient configuration. The deformation is performed by a Thin-plate-spline interpolation calculated by the available landmarks.
fixLMtps(data, comp = 3, weight = TRUE, weightfun = NULL)
array containing all data, including fixed configurations - same order as input
meanshape - calculated from complete datasets
list containing information about missing landmarks
vector containing position of observations in data where at least one missing coordinate was found
array containing landmark data
integer: select how many of the closest observations are to be taken to calculate an initial estimate.
logical: requests the calculation of an estimate based on the procrustes distance. Otherwise the sample's consensus is used as reference.
custom function that operates on a vector of distances (see examples) and generates weights accordingly.
Stefan Schlager
This function tries to estimate missing landmark data by mapping weighted
averages from complete datasets onto the missing specimen. The weights are
the inverted Procrustes (see proc.weight
) distances between
the 'comp' closest specimen (using the available landmark configuration).
Bookstein FL. 1989. Principal Warps: Thin-plate splines and the decomposition of deformations IEEE Transactions on pattern analysis and machine intelligence 11.
proc.weight
, tps3d
if (require(shapes)) {
data <- gorf.dat
### set first landmark of first specimen to NA
data[1,,1] <- NA
repair <- fixLMtps(data,comp=5)
### view difference between estimated and actual landmark
plot(repair$out[,,1],asp=1,pch=21,cex=0.7,col=2)#estimated landmark
points(gorf.dat[,,1],col=3,pch=20)#actual landmark
}
## 3D-example:
data(boneData)
data <- boneLM
### set first and 5th landmark of first specimen to NA
data[c(1,5),,1] <- NA
repair <- fixLMtps(data,comp=10)
## view difference between estimated and actual landmark
if (FALSE) {
deformGrid3d(repair$out[,,1], boneLM[,,1],ngrid=0)
}
## Now use a gaussian kernel to compute the weights and use all other configs
gaussWeight <- function(r,sigma=0.05) {
sigma <- 2*sigma^2
return(exp(-r^2/ sigma))
}
repair <- fixLMtps(data,comp=79,weightfun=gaussWeight)
Run the code above in your browser using DataLab