CAVEconnectome / MeshParty

Apache License 2.0
34 stars 16 forks source link

Failed to load a mesh with a '.obj' extension. #78

Open xleEmesent opened 2 years ago

xleEmesent commented 2 years ago

Hi, MeshParty team:

I am trying to load a mesh file (can open in MeshLab)

    meshFilePath="../data/Mesh.obj"
    mm = trimesh_io.MeshMeta()
    mesh = mm.mesh(filename = meshFilePath)

Then the following error message generated:

python3.8/site-packages/meshparty/trimesh_io.py", line 610, in mesh
    if not isinstance(self.cv.mesh, ShardedMultiLevelPrecomputedMeshSource):
AttributeError: 'NoneType' object has no attribute 'mesh'

Anything I have missed here? Thanks in advance.

ceesem commented 2 years ago

This is a bit of a bug — at the moment the MeshMeta object requires a cloud volume path even if the files are to be loaded locally, because it wants to know how to handle a root id. We should improve the logic of this requirement, as well as have a direct method to do mesh loading.

There are two workarounds right now: 1) Use any segmentation cloudpath, even if you're not going to use it to download files. Here's a publicly available one precomputed://gs://neuroglancer-public-data/kasthuri2011/ground_truth

2) Build the mesh through a method other than the meshmeta — if you can import vertices and faces, then trimesh_io.Mesh(vertices=vertices, faces=faces) will work fine. Trimesh should make this import easy, but then you don't have the extra features needed for the EM neuronal meshes. However, it's also possible that Trimesh does all you need it to do if you're coming in with an obj.

xleEmesent commented 2 years ago

@ceesem , Thanks for your reply.

Regarding to the 1st workaround where a cloud path is required. If my mesh file has path as : /home/xue/eclipse-workspace/myproject/data/Mesh.obj. What should the cloudpath be here? Sorry I never use the cloudpath before.

I am trying to following the example but I could not figure out right cloudpath in my case here:

    mm = trimesh_io.MeshMeta(
    # cv_path = "precomputed://gs://neuroglancer-public-data/kasthuri2011/ground_truth",
    disk_cache_path = "test_meshes",
    map_gs_to_https=True)

Do I also need to set up google cloud credentials as well? Many Thanks!!!