digitising curves with semi landmarks

312 views
Skip to first unread message

A

unread,
Nov 4, 2016, 6:19:59 AM11/4/16
to geomorph R package

Hi there

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. 

So far I have this: 

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)
  
  Y.gpa<-gpagen(SL,PrinAxes=TRUE,ProcD=TRUE,Proj=T,print.progress=T)


Thank you!

Emma Sherratt

unread,
Nov 8, 2016, 6:52:16 PM11/8/16
to geomorph R package
I cannot understand what you are doing here without more context. It appears you are using functions from both R packages Morpho and geomorph, but I do not know what your aim is and what you are digitizing, and what kind of landmarks you wish to place on your object. Please provide this information so that I know how I can help.

Emma

A

unread,
Nov 9, 2016, 7:13:01 AM11/9/16
to geomorph R package
Apologies for not making myself clear. 

I am trying to place semi landmarks along a curve on a surface on one specimen, that I can then use as a template to place on all specimens. I have successfully placed a patch of semi landmarks to use as a template so far, but I would like to digitise specific curves with semi landmarks in addition to this patch. Is it possible to do digitise a curve with semi landmarks on just one specimen, that can be used as a template so that all of the specimens can be digitised with said curve? I have previously tried using digit.curves and define.sliders, but i cannot successfully use these as a template that will be applied to all specimens, not just the one I have digitised. Is it possible? 

Thank you for you help! 

Emma Sherratt

unread,
Nov 21, 2016, 8:17:20 PM11/21/16
to geomorph R package
Ok, I see.

So digit.curves is a slightly misleading name for you I think, because it is not a function to manually digitize semilandmarks on a 2D or 3D curve of an object. Instead, it takes a matrix of coordinates that together describe an outline (such as from tpsDIG2 oir imageJ), or a curve such as comes from IDAV Landmark/Checkpoint, and subsamples that to n equidistant semilandmarks that will together be a curve.

In order to digitize a set of points that will together be a curve for gpagen you have to:

In R, use digit.fixed() to manually place landmarks on the 3D surface in a line along the contour you wish to capture*. Then use digit.curves to resample that "curve" into equidistant semilandmarks. Then use define.sliders to make the sliders matrix needed for gpagen
Then you can use that curve in your template. 

Em

* We do not have implemented the curve functionality of IDAV Landmark, which places 3 points on the surface and then samples semilandmarks along and imaginary line over the surface. You may wish to use that instead, depending on the contour.
Reply all
Reply to author
Forward
0 new messages