-------- Original Message --------
Subject: Re: ply files in R
Date: Fri, 10 Jul 2009 15:01:16 -0700 (PDT)
From: Dean Adams <[email protected]>
To: [email protected]
References: <[email protected]>
Thanks Joe,
What I was searching for was some general code
that would read both the xyz coordinates as well as the polygon information.
It turns out that the different sections of ply
files (header, coordinates, polygons and
sometimes edges) can have different lengths and
contain slightly different information from scan
to scan. Even more annoying is the fact that
different surface scanners spit out these files
in slightly different ways: some output the
header section as a single line; others output
the header as a series of lines and contain
various numbers of comment lines. Some output
only xyz coordinates, others output xyz
coordinates, along with their normals and/or RGB
values, etc. And this is only the ascii version
of ply files: there are also binary ply files
(though not really, as the header line is ascii
but the body of information is in
binary...). Thus, read.table didn't seem the
most appropriate for this purpose (though
admittedly I don't have all the nuances down on the function's use).
Instead, I wrote a more complicated R routine
that reads each section, obtains the necessary
information from them, and parses it accordingly.
The output is a set of xyz coordinates, and the
set of points for each polygon (IF your ply file
has polygons that all have the same number of
vertices). The code seems to work on the 2 ply
file versions I had available: NextEngine and
DavidScanner (which have slightly different
formats) as well as a few I found on the web. We
are still testing it however.
Best,
Dean
At 03:55 PM 7/10/2009, you wrote:
-------- Original Message --------
Subject: Re: ply files in R
Date: Fri, 10 Jul 2009 13:29:30 -0700 (PDT)
From: Joseph Kunkel <[email protected]>
To: [email protected]
CC: Joseph Kunkel <[email protected]>
References: <[email protected]>
In R there are several default library functions that read tables of
numbers.
If the ply file is ascii you can look at it to check its format
visually.
The read.table() function should read the ply file.
Looking at the ascii file in an editor you will be able to know
whether the x,y,z columns have headers naming the axes and whether you
need to skip any lines to get to the header or data lines.
The default for this function has the header=FALSE, so if you want the
headers read automatically you need to set header=TRUE. Setting
skip=n will skip n lines before reading data.
The description for how to use this function can be found by typing:
help(read.table)
... in the in the R console.
Joe
On Jul 10, 2009, at 9:34 AM, morphmet wrote:
-------- Original Message --------
Subject: ply files in R
Date: Thu, 9 Jul 2009 15:00:28 -0700 (PDT)
From: Dean Adams <[email protected]>
To: [email protected]
References: <[email protected]>
Hello all.
Does anyone know of a routine in R that reads ascii ply files?
Thanks,
Dean
Dr. Dean C. Adams
Associate Professor
Department of Ecology, Evolution, and Organismal Biology
Department of Statistics
Iowa State University
Ames, Iowa
50011
--
Replies will be sent to the list.
For more information visit http://www.morphometrics.org
-·. .· ·. .><((((º>·. .· ·. .><((((º>·. .· ·..><((((º> .··.·
=- =º}}}}}><
Joseph G. Kunkel, Professor
Biology Department
University of Massachusetts Amherst
Amherst MA 01003
http://www.bio.umass.edu/biology/kunkel/
--
Replies will be sent to the list.
For more information visit http://www.morphometrics.org
Dr. Dean C. Adams
Associate Professor
Department of Ecology, Evolution, and Organismal Biology
Department of Statistics
Iowa State University
Ames, Iowa
50011
--
Replies will be sent to the list.
For more information visit http://www.morphometrics.org