Closed Ruiqi-CUB closed 3 years ago
Hi, yes please send me the offending dataset and I'll have a look. A common error you might want to check is that the meshes and the landmarks are not in the same coordinate system.
Thank you Stefan! I shared it with you via Google Drive. The ply files are in the directory Projection. I also attached my R script in that folder.
Hi, I just had a look: you have weird singularities, loose parts and degenerate faces in your surfaces which might screw up the closest point search and the computation of the normal vector (to estimate the tangent plane, which you can't from a degenerate triangle). You can get rid of this by cleaning and smoothing the meshes. Here is a function to fix this and will write the cleaned meshes in a subfolder called "clean_meshes".
cleanMeshes <- function(x,folder="clean_meshes") {
tmp <- vcgImport(x)
tmp <- vcgIsolated(vcgSmooth(vcgClean(tmp,sel=0:6,iterate=T)),facenum = 10)
dir.create(folder,showWarnings = F)
vcgPlyWrite(tmp,paste0(folder,"/",basename(x)))
}
mymeshes <- list.files("../Projection/",pattern=".ply",full.names = T)
lapply(mymeshes,cleanMeshes)
Afterwards, you simply need to
LMs_slide<-slider3d(dat.array = DataSUR, SMvector = 1:4,outlines=curlist2,surp=113:320,sur.path="./clean_meshes",sur.type = "ply",deselect = T)
I also would urge you, to clean the atlas mesh:meshtempl1 <- vcgSmooth(vcgClean(meshtempl,sel=0:6,iterate = T))
Hi Stefan,
I was trying to use slider3d to minimize bending energy of the curve/surface semilandmarks.
There is an error messgae when running slider3d. I think it might because there are some issues of some specimens? Do you happen to know what is the specific issue? I checked with
checkLM(DataSUR,text.lm=T,point="p")
but the landmarks looks pretty good to me.Start sliding...
Iteration 1 .. Error in t.default(reprotmp$vb[1:3, ]) : argument is not a matrix
Projection finished
Inital procrustes fit ...in... 0.009305 secs
Start sliding...
Iteration 1 .. estimating sample mean shape...in... 0.00717783 secs
squared distance between means: 1.5800363915606e-05
Iteration 2 .. estimating sample mean shape...in... 0.007558107 secs
squared distance between means: 7.42220588217909e-06
viewing # 2 (return=next | p=previous | m=mark current | s=stop viewing)
Error in xyz.coords(x, y, z, recycle = TRUE) : 'x' is a list, but does not have components 'x', 'y' and 'z'