facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.81k stars 1.32k forks source link

Read a mesh that have scalar values for each vertex. #1618

Closed mohamed-seyam closed 1 year ago

mohamed-seyam commented 1 year ago

I'm attempting to read a .vtk file containing scalar values for individual vertices. Since pytorch3d doesn't support .vtk files, I converted it to .ply format. Now, I'm aiming to access the resulting scalar values. Is there a method to achieve this?

bottler commented 1 year ago

It's relatively easy to customize our PLY reading code to pull in extra data. If you want, you can share the PLY header here and we can suggest how to get the extra values.

mohamed-seyam commented 1 year ago

here is the header data.

ply format binary_little_endian 1.0 comment VTK generated PLY File obj_info vtkPolyData points and polygons: vtk4.0 element vertex 180225 property float x property float y property float z element face 359917 property list uchar int vertex_indices end_header

bottler commented 1 year ago

That looks like a normal PLY file with vertices and faces. There's no extra data. PyTorch3D should load this fine.

    from pytorch3d.io import IO

    mesh = IO().load_mesh("myfile.ply")

the "scalar values for individual vertices" will then be in mesh.verts_padded().