Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it correct that the computed skeleton is supposed to be on the mesh surface? Anything I did was wrong? #98

Open
lxmedai opened this issue Oct 4, 2023 · 2 comments

Comments

@lxmedai
Copy link

lxmedai commented Oct 4, 2023

I am now testing your package for computing mesh skeleton. Here below is my code using meshparty to compute the skeleton and to visualize the results:

from meshparty import trimesh_vtk, trimesh_io
from meshparty.skeletonize import skeletonize_mesh

vertices, faces, normals, link_edges, node_mask = trimesh_io.read_mesh(file_path_to_obj)
mesh = trimesh_io.Mesh(vertices=vertices, faces=faces, normals=normals, link_edges=link_edges, node_mask=node_mask)
skeleton = skeletonize_mesh(mesh)
# I originally set the opacity for the mesh to 0.5. But since the extracted skeleton is on the surface, I set it to 1. 
actor_mesh = trimesh_vtk.mesh_actor(mesh,  color=(0, 0.5, 1), opacity=1)
actor_skeleton = trimesh_vtk.skeleton_actor(skeleton, color=(1, 0, 0), opacity=0.5, lin_width=5)
trimesh_vtk.render_actors([actor_mesh, actor_skeleton])

Skeleton_human_mesh

The returned skeleton is on the mesh surface rather than inside the mesh as I would expect. Was there anything I did wrong? It will be very much appreciated if this problem can be solved.
Another minor issue for me is that I could not use the recommended way to read mesh via:

mm = trimesh_io.MeshMeta()
mesh = mm.mesh(file_path_to_obj) 

, which would lead to error saying "AttributeError: 'NoneType' object has no attribute 'mesh'. " which points to "if not isinstance(self.cv.mesh, SharedUltilLevelPrecomputedMeshSource)" in file "trimesh_io.py". It is however unclear to me about how it should be set. But of course this is a minor problem for me since code for 'read_mesh' works.

@fcollman
Copy link
Collaborator

fcollman commented Oct 4, 2023 via email

@lxmedai
Copy link
Author

lxmedai commented Oct 4, 2023

No this is as expected and there is a description in the documentation which describes this and the trade offs of this approach and a suggestion for how to center the skeleton if this is important for you.  Skeletons — MeshParty documentationmeshparty.readthedocs.ioNote we developed this for neurons which are quite long and skinny and the larger length scale topology/distance is more important than centering in most scientific questions.
Sent from my mobile device.On Oct 4, 2023, at 1:48 AM, lxmedai @.***

Thanks for the reply! Sorry that I wasn't careful enough when I read the documentation. Now the problem is that by default, the skeleton.vertex_properties['rs'] after skeleton = skeletonize_mesh(mesh) should contain the computed mesh radii along the skeleton vertices, but the vertex_properties I got was an empty dictionary. And it was the same using skeleton = skeletonize_mesh(mesh, compute_radius=True). Is it possible to kindly provide some code example about how to enable centered skeleton?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants