data(nose)
###create mesh for longnose
longnose.mesh <- warp.mesh(shortnose.mesh,shortnose.lm,longnose.lm)
### write meshes to disk
mesh2ply(shortnose.mesh, filename="shortnose")
mesh2ply(longnose.mesh, filename="longnose")
## create landmark array
data <- bindArr(shortnose.lm, longnose.lm, along=3)
dimnames(data)[[3]] <- c("shortnose", "longnose")
# define fix landmarks
fix <- c(1:5,20:21)
# define surface patch by specifying row indices of matrices
# all except those defined as fix
surp <- c(1:nrow(shortnose.lm))[-fix]
slide <- slider3d(data, SMvector=fix, deselect=TRUE, surp=surp,
sur.path=".",iterations=1,mc.cores=1)
# sur.path="." is the current working directory
# now one example with meshes in workspace
meshlist <- meshlist <- list(shortnose.mesh,longnose.mesh)
slide <- slider3d(data, SMvector=fix, deselect=TRUE, surp=surp,
iterations=1, meshlist=meshlist,
mc.cores=1,fixRepro=FALSE)
require(rgl)
## visualize sliding
deformGrid3d(slide$dataslide[,,1],shortnose.lm,ngrid = 0)
## these are fix
spheres3d(slide$dataslide[fix,,1],col=4,radius=0.7)
###finally an example with missing landmarks:
## we assume that coordinates 185:189, 205:209 and 225:229 are in the second config are missing
missingList <- createMissingList(2)
missingList[[2]] <- c(185:189,205:209,225:229)
slideMissing <- slider3d(data, SMvector=fix, deselect=TRUE, surp=surp,
iterations=1, meshlist=meshlist,
mc.cores=1,fixRepro=FALSE,missingList=missingList)
Run the code above in your browser using DataLab