loading *.stl or *.ply 3D files
Tue, 03/14/2023 - 12:17 pm
Has anyone know how to load either *.stl or *.ply data files into Igor Pro?
I have a colleague who has captured some image 3D profile data, but he doesn't have a great way to analyze that data. With all of AGs imaging capabilities, I can't imagine that I wouldn't be able to automate the image analysis to rapidly get at the information they are looking for.
Unfortunately, I don't have much experience in dealing with binary files.
The ply has at least an open file definition.
The trick maybe figuring out where the header ends and the data starts.
March 14, 2023 at 12:43 pm - Permalink
Yeah, I've been looking into that. I loaded the data as general text and have figured out the number of bytes to skip, seemingly. Turns out it was 206 after I took into account the bytes used to autoname my column and then for CRs or LFs. Using the binary file load with low byte, dropping out the first 206 bytes and finally separating the data into 6 columns by 24474 rows (using the element vertex of 14683 + 1), I'm loading in values that look like real world numbers. So that's some progress.
The arrays still don't look right. Based on the header information, I thought I should be getting 6 columns with 2 sets of values, vertices and maybe some sort of delta value. However, the 6 columns look like all the data is "mixed".
My header information.
format binary_little_endian 1.0
comment created by revopoint 3D
element vertex 146843
property float x
property float y
property float z
property float nx
property float ny
property float nz
I was expecting the columns to look like this:
x y z nx ny nz
What I think I see is:
x y z x y z
nx ny nz nx ny nz
Thanks for your help.
March 14, 2023 at 01:14 pm - Permalink
Perhaps n is 1.0?
March 14, 2023 at 04:04 pm - Permalink
I don't think so. I think that's another set of data (PLY - Polygon File Format (paulbourke.net)). I was expecting 6 columns with ~147k rows, but instead, the data looks more "consistent" at ~147k columns and 6 rows. In that situation, I can easily separate out 2 sets of data, based on the magnitudes. But I have no idea if this is even correct. At some point, this data should be a 3D image.
March 15, 2023 at 04:47 am - Permalink
I confess that I have no experience reading either *.stl or *.ply in Igor. Both file formats can contain data that will not be easy to interpret as image data for Igor, but if you have prior knowledge that they contain only one set of vertices of some image, it may be possible to extract from the *.stl file using python (e.g., https://pypi.org/project/numpy-stl/).
March 16, 2023 at 04:09 pm - Permalink