Last chance! 50% off unlimited learning
Sale ends in
maps landmarks or a triangular mesh via thin plate spline based on a reference and a target configuration in 2D and 3D
tps3d(x, refmat, tarmat, lambda = 1e-08, threads = 0, ...)tps2d(x, refmat, tarmat, lambda = 1e-08, threads = 0, ...)
matrix - e.g. the matrix information of vertices of a given surface or a triangular mesh of class "mesh3d"
reference matrix - e.g. landmark configuration on a surface
target matrix - e.g. landmark configuration on a target surface
numeric: regularisation parameter of the TPS.
threads to be used for parallel execution in tps deformation.
additional arguments, currently not used.
returns the deformed input
Bookstein FL. 1989. Principal Warps: Thin-plate splines and the decomposition of deformations. IEEE Transactions on pattern analysis and machine intelligence 11(6).
# NOT RUN {
data(nose)
## define some landmarks
refind <- c(1:3,4,19:20)
## use a subset of shortnose.lm as anchor points for a TPS-deformation
reflm <- shortnose.lm[refind,]
tarlm <- reflm
##replace the landmark at the tip of the nose with that of longnose.lm
tarlm[4,] <- longnose.lm[4,]
## deform a set of semilandmarks by applying a TPS-deformation
## based on 5 reference points
deformed <- tps3d(shortnose.lm, reflm, tarlm,threads=1)
# }
# NOT RUN {
##visualize results by applying a deformation grid
deformGrid3d(shortnose.lm,deformed,ngrid = 5)
data(nose)##load data
##warp a mesh onto another landmark configuration:
longnose.mesh <- tps3d(shortnose.mesh,shortnose.lm,longnose.lm,threads=1)
require(rgl)
shade3d(longnose.mesh,col=skin1)
# }
# NOT RUN {
data(boneData)
## deform mesh belonging to the first specimen
## onto the landmark configuration of the 10th specimen
# }
# NOT RUN {
warpskull <- tps3d(skull_0144_ch_fe.mesh,boneLM[,,1],
boneLM[,,10], threads=1)
## render deformed mesh and landmarks
shade3d(warpskull, col=2, specular=1)
spheres3d(boneLM[,,1])
## render original mesh
shade3d(skull_0144_ch_fe.mesh, col=3, specular=1)
spheres3d(boneLM[,,10])
# }
Run the code above in your browser using DataLab