Re: [MORPHMET] Help with placePatch

2019-06-18 Thread Pablo Fisichella
Dear Murat and Ryan,



Thank you very much for your help. Both solutions work fine although the
Murat´s suggestions produced the following error but I was able to fix
it. Error
in dimnames(data)[[3]] = list(c(("A860ho, USNM083262hy, USNM084655pan,
USNM143590po, USNM143593po, USNM174699pan, USNM174701pan, USNM174702pan,
USNM239883go, USNM260582go"))) :   length of 'dimnames' [3] not equal to
array extent



I used these functions and worked correctly



dimnames(data)[[3]]=str_remove(dimnames(data)[[3]],".landmarkAscii")
patched.specimens <-
placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix
='', fileext=".ply")



the result and my checking of patched.specimens (Removed 0 duplicate 51977
unreferenced vertices and 0 duplicate faces) show that effectively the 60
semilandmarks were projected to all my specimens.



Now I´m trying to run the checkLM function as follows:



<-
placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix
='', fileext=".ply")  but I got this error: Error in vcgImport(filename,
clean = clean, readcolor = readcol) :  file E:/Documents/hominoidA860ho.ply
does not exist



It seems that again the function can´t find my .ply models so I used this
option:


checkLM(patched.specimens, path="E:/Documents/hominoid",prefix =
c(("A860ho, USNM083262hy, USNM084655pan, USNM143590po, USNM143593po,
USNM174699pan, USNM174701pan, USNM174702pan, USNM239883go, USNM260582go"),
suffix = ".ply", atlas=atlas))



but despite the RGL device is started and the r console is working
correctly the results are never returned.



Maybe you have some additional suggestions on how run the checkLM function
properly



Thank you very much for your help, I really appreciate your time and
expertise to answer my questions,


with thanks,



Pablo



Libre
de virus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

El lun., 17 jun. 2019 a las 17:02, Ryan Felice ()
escribió:

> Hi Pablo,
>
> A small change should fix it. Remove the “prefix” argument. Whatever you
> set “prefix” to is pasted in front of each specimen name. Notice how the
> error says there is no such file "E:/Documents/hominoid/A860ho,
> USNM083262hy, USNM084655pan, USNM143590po, USNM143593po, USNM174699pan,
> USNM174701pan, USNM174702pan, USNM239883go,
> USNM260582goA860ho.landmarkAscii.ply”.
>
> This is your path ("E:/Documents/hominoid/“), then your “prefix”, then
> the name of the first specimen in “data”, which is “A860ho.landmarkAscii”,
> then the file extension, “.ply".
> Try it like this:
>
> dimnames(data)[[3]]=str_remove(dimnames(data)[[3]],".landmarkAscii”)
>
> patched.specimens <-
> placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix
> ='', fileext=".ply"))
>
> If the dimnames(data)[[3]] perfectly match the filenames of your ply
> files (without the “.ply”), it should work.
> Best
> Ryan
>
>
> Ryan N. Felice, Ph.D
> Lecturer in Human Anatomy
> University College London
> Department of Cell and Developmental Biology
> Anatomy Building Room G23
> rnfelice.com
> ryanfel...@gmail.com
>
> On Jun 17, 2019, at 8:38 PM, Pablo Fisichella 
> wrote:
>
> Dear All,
>
> I’m using the function placePatch in Morpho to transfer semilandmarks from
> a template to all specimens in my sample (n=10). Unfortunately I have
> failed to run successfully such function. I have read some discussions here
> in the past but some solutions that apparently functioned for other persons
> do not seem to work in my case. Thus maybe somebody can help me with an
> idea or advice.
>
> I obtained my landmarks and semilandmarks using Amira
>
> I created an atlas (see attached pictures) which looks fine. I obtained 19
> landmarks and 60 semilandmarks for the template.
>
> I created a k x 3 x n array using the function read.amira.dir from the
> Arothron package (data=read.amira.dir("E:/Documents/landmarks","auto") my
> array is 19*3*10
>
> Finally I used the placePatch function as follows:
>
> placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix
> = c(("A860ho, USNM083262hy, USNM084655pan, USNM143590po, USNM143593po,
> USNM174699pan, USNM174701pan, USNM174702pan, USNM239883go, USNM260582go"),
> fileext=".ply"))
>
> I obtained a pxkxn array with only missing values -NAs- and I got 10
> errors like this for each one of my .ply models:
>
> In place.patch(dat.array, path, atlas.mesh = atlas$mesh,  ... :matching
> for specimen 1 failed with: Error in vcgImport(tmp.name): file
> E:/Documents/hominoid/A860ho, USNM083262hy, USNM084655pan, USNM143590po,
> USNM143593po, USNM174699pan, USNM174701pan, USNM174702pan, USNM239883go,
> USNM260582goA860ho.landmarkAscii.ply does not exist
>
> Evidently the function can’t find my .ply models. As I supposed this issue
> is related to the dimnames of my array 

Re: [MORPHMET] Help with placePatch

2019-06-17 Thread Ryan Felice
Hi Pablo, 

A small change should fix it. Remove the “prefix” argument. Whatever you set 
“prefix” to is pasted in front of each specimen name. Notice how the error says 
there is no such file "E:/Documents/hominoid/A860ho, USNM083262hy, 
USNM084655pan, USNM143590po, USNM143593po, USNM174699pan, USNM174701pan, 
USNM174702pan, USNM239883go, USNM260582goA860ho.landmarkAscii.ply”. 

This is your path ("E:/Documents/hominoid/“), then your “prefix”, then the name 
of the first specimen in “data”, which is “A860ho.landmarkAscii”, then the file 
extension, “.ply".
Try it like this:

dimnames(data)[[3]]=str_remove(dimnames(data)[[3]],".landmarkAscii”)

patched.specimens <- 
placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix ='', 
fileext=".ply"))

If the dimnames(data)[[3]] perfectly match the filenames of your ply files 
(without the “.ply”), it should work.

Best
Ryan


Ryan N. Felice, Ph.D
Lecturer in Human Anatomy
University College London
Department of Cell and Developmental Biology
Anatomy Building Room G23
rnfelice.com
ryanfel...@gmail.com

> On Jun 17, 2019, at 8:38 PM, Pablo Fisichella  
> wrote:
> 
> Dear All,
> 
> I’m using the function placePatch in Morpho to transfer semilandmarks from a 
> template to all specimens in my sample (n=10). Unfortunately I have failed to 
> run successfully such function. I have read some discussions here in the past 
> but some solutions that apparently functioned for other persons do not seem 
> to work in my case. Thus maybe somebody can help me with an idea or advice.
> 
> I obtained my landmarks and semilandmarks using Amira
> 
> I created an atlas (see attached pictures) which looks fine. I obtained 19 
> landmarks and 60 semilandmarks for the template.
> 
> I created a k x 3 x n array using the function read.amira.dir from the 
> Arothron package (data=read.amira.dir("E:/Documents/landmarks","auto") my 
> array is 19*3*10
> 
> Finally I used the placePatch function as follows:
> 
> placePatch(atlas=atlas,dat.array=data,path="E:/Documents/hominoid",prefix = 
> c(("A860ho, USNM083262hy, USNM084655pan, USNM143590po, USNM143593po, 
> USNM174699pan, USNM174701pan, USNM174702pan, USNM239883go, USNM260582go"), 
> fileext=".ply"))
> 
> I obtained a pxkxn array with only missing values -NAs- and I got 10 errors 
> like this for each one of my .ply models:
> 
> In place.patch(dat.array, path, atlas.mesh = atlas$mesh,  ... :matching for 
> specimen 1 failed with: Error in vcgImport(tmp.name ): file 
> E:/Documents/hominoid/A860ho, USNM083262hy, USNM084655pan, USNM143590po, 
> USNM143593po, USNM174699pan, USNM174701pan, USNM174702pan, USNM239883go, 
> USNM260582goA860ho.landmarkAscii.ply does not exist
> 
> Evidently the function can’t find my .ply models. As I supposed this issue is 
> related to the dimnames of my array (dimnames(data)[[3]]).
> 
> I followed a suggestion that Antonio Profico did to another researcher in the 
> past by using the function str_sub from the package stringr to try to delete 
> the extension .landmarkAscii from my array dimnames but this time does not 
> work and I continue obtaining the same errors
> 
> I realized that the dimnames of my array changed. For instance the original 
> .ply model name is USNM260582go but the name of the same model in the array 
> with NAs is USNM260582go.landmarkAscii. This is the problem (i.e., the 
> extension .landmarkAscii) but since the str_sub does not work I used several 
> more functions from the package stringr including:
> 
> dimnames(data)[[3]]=str_remove(dimnames(data)[[3]],".landmarkAscii")
> 
> dimnames(data)[[3]]=str_replace(dimnames(data)[[3]],".landmarkAscii",".ply")
> 
> But I got the same errors
> 
> I have tried additional tricks like changing the dimnames (including only 
> numbers) by using this function data2=array(data, dim=c(19,3,10)) and 
> changing the names of my .ply models but I got always the same error
> 
> Obviously the error is related with my array dimnames but I don’t know how I 
> can solve this, thus I´m looking for advice
> 
> Thanks in advance for any help, advice or suggestion
> 
> best wishes
> 
> Pablo
> 
>  
> 
>  
> 
> Libre de virus. www.avast.com 
> 
>  
> 
> -- 
> MORPHMET may be accessed via its webpage at http://www.morphometrics.org 
> 
> --- 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to morphmet+unsubscr...@morphometrics.org 
> .
> 

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.