I'm struggling with trying to digitise curves on a template? I can successfully create the curves, but adding the curves into the template keeps popping up with an error. How can I successfully add curves into my template, that will be applied to the other specimens? I have tried define.sliders and digit.curves but neither of which I seem to be able to add onto the template.
locate.lm=choose.dir(caption="template/lm")
locate.sur=choose.dir(caption="template/sur")
file.lm=list.files(locate.lm)
path.lm=paste(locate.lm,file.lm,sep="//")
dat=NULL;aa=NULL;bb=NULL
aa=strsplit(readLines(path.lm)[15:32]," ")
lm.temp=matrix(as.numeric(unlist(aa)),nrow=18,ncol=3,byrow=T)
file.sur=list.files(locate.sur)
path.sur=paste(locate.sur,file.sur,sep="\\")
sur.temp=ply2mesh(path.sur,readnormals=T)
template=buildtemplate(sur.temp,fixed=lm.temp,surface.sliders=Nsl,center=T)
relax_patch=TRUE
{
folder.lm=choose.dir(caption="Select the folder where the reference landmarks are stored")
folder.sur=choose.dir(caption="Select the folder where the reference surfaces are stored")
fil=list.files(folder.lm)
pat=paste(folder.lm,fil,sep="\\")
dat=NULL;aa=NULL;bb=NULL
for(i in 1:length(pat)){
aa=strsplit(readLines(pat[i])[15:32]," ")
bb=c(t(matrix(unlist(aa),nrow=Nlm,ncol=3,byrow=T)))
dat=rbind(dat,as.numeric(bb))
}}
rownames(dat)=as.factor(gsub("\\.landmarkAscii","",fil))
array.slide=arrayspecs(dat,Nlm,3)
atl=createAtlas(sur.temp,template[1:Nlm,],template[(Nlm+1):(Nlm+Nsl),])
SL=placePatch(atlas=atl,dat.array=array.slide,path=folder.sur,fileext=".ply",relax.patch=relax_patch)