Process points#

openalea.plantscan3d.processpoints.filter_points(points, densityfilterratio=0.05, densityradius=None, k=16)[source]#

Filter a point cloud using density estimation.

Parameters:
  • points (PointList) – PointList of the point cloud, usualy obtained with load_points().

  • densityfilterratio (float) – Density ratio to use to filter the point cloud using density estimation. Default to 0.05.

  • densityradius (float) – Value of the radius to use to estimate the density. Default is None, which means that the value is calculated as 1/100 of the max-min of the point cloud in the z direction.

  • k (int) – Number of neighbors to use to estimate the density. Default to 16.

Return type:

PointList of the filtered point cloud.

openalea.plantscan3d.processpoints.find_root(points)[source]#

Find the root of the point cloud.

Notes

We define the center of the point cloud as (x_c, y_c, z_c). Then the root is defined as the closest point from the cloud to the point (x_c, y_c, z_min)

Parameters:

points (PointList) – PointList of the point cloud, usualy obtained with load_points().

Return type:

Tuple of the root node id, the minimum z value and the maximum z value.

openalea.plantscan3d.processpoints.load_points(filename)[source]#

Load a point cloud from a file.

Parameters:

filename (str) – Path to the file of the point cloud.

Return type:

PointList of the point cloud.

openalea.plantscan3d.processpoints.skeleton(points, skel_func=<function xu_method>, xu_binratio=50, xu_neighbors=20, gc_min_growth_length=None, gc_max_growth_length=None, gc_radius_func=None, sc_growth_length=None, sc_kill_distance_ratio=0.9, sc_presence_distance_ratio=2.5, sc_min_nb_pt_per_bud=5, asc_min_growth_length=None, asc_max_growth_length=None, asc_radius_func=None, asc_kill_distance_ratio=0.9, asc_presence_distance_ratio=2.5, asc_min_nb_pt_per_bud=5, livny_contraction_nb=3, livny_filtering_nb=5, livny_min_edge_ratio=0.15)[source]#

Topology reconstruction of a point cloud.

Parameters:
  • points (PointList) – PointList of the point cloud used to reconstruct topology.

  • skel_func (function) – Reconstruction algorithm to use. Default to xu_method. Other possible algorithms are: - graphcolonization_method: Graph Colonization Algorithm - spacecolonization_method: Space colonization reconstruction - adaptivespacecolonization_method: Adaptive Space Colonization Algorithm - livny_method_mtg: Livny algorithm

  • xu_binratio (float) – Value of the bin ratio to use to estimate the topology. Only used for XU method. Default to 50.

  • xu_neighbors (int) – Number of neighbors to use to estimate the topology. Only used for XU method. Default to 20.

  • gc_min_growth_length (float) – Minimum growth length for the graph colonization algorithm. Only used for Graph Colonization algorithm. Default to zdist / 200.

  • gc_max_growth_length (float) – Maximum growth length for the graph colonization algorithm. Only used for Graph Colonization algorithm. Default to zdist / 50.

  • gc_radius_func (function) – Density - bin length Relationship function for the graph colonization algorithm. Only used for Graph Colonization algorithm. Default to a NurbsCurve2D function with custom parameters.

  • sc_growth_length (float) – Growth length for the space colonization algorithm. Only used for Space Colonization algorithm. Default to zdist / 50.

  • sc_kill_distance_ratio (float) – Kill distance ratio for the space colonization algorithm. Only used for Space Colonization algorithm. Default to 0.9.

  • sc_presence_distance_ratio (float) – Perception distance ratio for the space colonization algorithm. Only used for Space Colonization algorithm. Default to 2.5.

  • sc_min_nb_pt_per_bud (int) – Minimum number of points per bud for the space colonization algorithm. Only used for Space Colonization algorithm. Default to 5.

  • asc_max_growth_length (float) – Maximum growth length for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to zdist / 50.

  • asc_min_growth_length (float) – Minimum growth length for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to zdist / 100.

  • asc_radius_func (function) – Density - Radius Relationship function for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to a NurbsCurve2D function with custom parameters.

  • asc_kill_distance_ratio (float) – Kill distance ratio for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to 0.9.

  • asc_presence_distance_ratio (float) – Perception distance ratio for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to 2.5.

  • asc_min_nb_pt_per_bud (int) – Minimum number of points per bud for the adaptive space colonization algorithm. Only used for Adaptive Space Colonization algorithm. Default to 5.

  • livny_contraction_nb (int) – Number of contraction steps for the livny algorithm. Only used for Livny algorithm. Default to 3.

  • livny_filtering_nb (int) – Number of filtering steps for the livny algorithm. Only used for Livny algorithm. Default to 5.

  • livny_min_edge_ratio (int) – Ratio of the minimum edge size for the livny algorithm. Only used for Livny algorithm. Default to 0.15.

Return type:

openalea.mtg.MTG object representing the topology of the point cloud.

openalea.plantscan3d.processpoints.subsample(points, ptsnb=None)[source]#

Subsample a point cloud using random.sample algorithm.

Parameters:
  • points (PointList) – PointList of the point cloud, usualy obtained with load_points().

  • ptsnb (int | None) – Number of points to keep. Default to None, which means that the number of points is kept as is.

Return type:

PointList of the subsampled point cloud.