meyerls / pc-skeletor

Skeletonization of 3D Point Clouds
MIT License
151 stars 18 forks source link

Incompatible with Python3.10 and/or numpy #19

Closed langthom closed 12 months ago

langthom commented 12 months ago

After an installation via pip (Python 3.10, Ubuntu xy), I got the following stack trace when trying to extract the topology from the LBC.

2023-11-08 07:43:01,538 - PCD #points: 2669 Current volume ratio 1.0. Contraction weights 2048.0. Attraction weights 0.5. Progress LBC: 10%|████████▎ | 2/20 [00:00<00:02, 7.38it/s]Contraction is Done. 2023-11-08 07:43:02,010 - Contraction is Done. Current volume ratio 1.0. Contraction weights 2048.0. Attraction weights 0.5. Progress LBC: 10%|████████▎ | 2/20 [00:00<00:03, 5.53it/s] /home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/mistree/mst/branches.py:54: FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar. mask_end = np.ones(index_branch_end.shape, dtype=np.bool) Traceback (most recent call last): File "/home/me/pcskeletor_test/pcskeletor.py", line 34, in extract_skeleton(pcd) File "/home/me/pcskeletor_test/pcskeletor.py", line 20, in extract_skeleton lbc.extract_topology() File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/pc_skeletor/laplacian.py", line 287, in extract_topology self.skeleton_graph = self.extract_skeletal_graph(skeletal_points=skeleton_points) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/pc_skeletor/laplacian.py", line 241, in __extract_skeletalgraph , , , _, edgeindex, = extract_mst(points=skeletal_points) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/pc_skeletor/laplacian.py", line 237, in extract_mst degree, edge_length, branch_length, branch_shape, edge_index, branch_index = mst.get_stats(include_index=True, k_neighbours=self.graph_k_n) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/mistree/mst/get_mst_class.py", line 408, in get_stats return self._get_stats(include_index=include_index, sub_divisions=sub_divisions, File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/mistree/mst/get_mst_class.py", line 370, in _get_stats self.get_branches(sub_divisions=sub_divisions) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/mistree/mst/get_mst_class.py", line 198, in get_branches branch_index, rejected_branch_index = branches.get_branch_index(self.edge_index, self.edge_degree) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/mistree/mst/branches.py", line 54, in get_branch_index mask_end = np.ones(index_branch_end.shape, dtype=np.bool) File "/home/me/pcskeletor_test/o3d_env/lib/python3.10/site-packages/numpy/init.py", line 324, in getattr raise AttributeError(former_attrs_[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

So it seems that the bool type needs to be addressed properly, or depending on the numpy version. Note that because I use Python 3.10, downgrading to numpy<=1.20 does not work as that version does not support Python 3.10.

meyerls commented 12 months ago

Please see issue #13