Skip to content

Error when loading in numpy array to automated_separation.generic_tree() #5

@tim-devereux

Description

@tim-devereux

Hi @mattbv, @philwilkes. I've been getting this error when loading a NumPy array into automated_separation.generic_tree(). The array is the correct dimension. This error isn't present when using tlseparation with Python 2.7. Thanks for any assistance.

`---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
in
----> 1 wood_final, leaf_final = tlseparation.scripts.automated_separation.generic_tree(arr, knn_list=[40, 50, 80, 100, 120], voxel_size=0.04, retrace_steps=40)

/opt/conda/lib/python3.7/site-packages/tlseparation/scripts/automated_separation.py in generic_tree(arr, knn_list, voxel_size, retrace_steps)
662 # root of the tree.
663 path_mask = voxel_path_detection(arr, voxel_size, retrace_steps, 100,
--> 664 voxel_size * 1.77, False)
665 # Filtering path_mask points by feature threshold. In this case,
666 # feature 4 has a very distinctive pattern for wood and leaf. Usually

/opt/conda/lib/python3.7/site-packages/tlseparation/classification/path_detection.py in voxel_path_detection(point_cloud, voxel_size, k_retrace, knn, nbrs_threshold, verbose)
173 detect_main_pathways with %s number of steps retraced' % k_retrace)
174 path_mask_voxel = detect_main_pathways(vox_coords, k_retrace, knn,
--> 175 nbrs_threshold, verbose=verbose)
176 # Re-indexing point_cloud indices from voxels coordinates detected as
177 # part of the path.

/opt/conda/lib/python3.7/site-packages/tlseparation/classification/path_detection.py in detect_main_pathways(point_cloud, k_retrace, knn, nbrs_threshold, verbose, max_iter)
228 # dimensions.
229 assert point_cloud.ndim == 2, "point_cloud must be an array with 2
--> 230 dimensions, n_points x 3 (x, y, z)."
231 assert point_cloud.shape[1] == 3, "point_cloud must be a 3D point cloud.
232 Make sure it has the shape n_points x 3 (x, y, z)."

AssertionError: point_cloud must be an array with 2 dimensions, n_points x 3 (x, y, z).`

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions