Skip to content

points

PointsSampler

__init__()

group_points(sample_coords, all_coords, point_ids=None) staticmethod

Select regular points and group other points using Voronoi tessellation.

Parameters:

Name Type Description Default
sample_coords ndarray[N, 3]

Coords of point selection.

required
all_coords ndarray[N, 3]

Coords of all points.

required
point_ids ndarray

Points ids of sample_coords.

None

Returns:

Name Type Description
voronoi_ids tuple

Indices of the selected points and group labels (selected point ids) for each input points.

select_random_points(point_ids, sample_size, seed=568) staticmethod

Select random points from point cloud.

Parameters:

Name Type Description Default
point_ids ndarray[N,]

Indices of the points.

required
sample_size int

Number of points to select.

required
seed int

Seed for random number generator.

568

Returns:

Type Description
ndarray

np.ndarray[M,]: Indices of the selected points.

select_regular_points(coords, distance) staticmethod

Select regular points from point cloud by removing points within a given distance.

Parameters:

Name Type Description Default
coords ndarray[N, 3]

Coordinates of points.

required
distance float

Minimal distance between points.

required

Returns:

Type Description
ndarray

np.ndarray[M,]: Indices of the selected points.

PointsStats

Class for computing statistics within the distance.

Attributes:

Name Type Description
coords

Coordinates of the points

neighbors

Pair of neighbor indexes

coords = coords instance-attribute

neighbors = None instance-attribute

__init__(coords)

Initialize.

Parameters:

Name Type Description Default
coords ndarray[N, 3]

Coordinates of the points

required

make_neighbors(radius=10)

Find pairs of points which form neighborhoods.

Parameters:

Name Type Description Default
radius int

All points within radius will be used for calculation of stats. Defaults to 10.

10

Returns:

Type Description
ndarray

np.ndarray[M, 2]: Pair of neighbors

max(scalars)

Calculate the maximum of scalars within the neighborhood.

Parameters:

Name Type Description Default
scalars ndarray[N,]

Array of scalar values.

required

Returns:

Type Description
ndarray

np.ndarray[N,]: Maximum values in neighborhoods.

mean(scalars)

Calculate the mean of scalars within the neighborhood.

Parameters:

Name Type Description Default
scalars ndarray[N,]

Array of scalar values.

required

Returns:

Type Description
ndarray

np.ndarray[N,]: Mean values in neighborhoods.

std(scalars)

Calculate the standard deviation of scalars within the neighborhood.

Parameters:

Name Type Description Default
scalars ndarray[N,]

Array of scalar values.

required

Returns:

Type Description
ndarray

np.ndarray[N,]: Standard deviation values in neighborhoods.

ProjectPointToSurface

__init__()

nearest_distance(input_coords, source_coords, max_distance=np.inf) staticmethod

Find nearest points.

Parameters:

Name Type Description Default
input_coords ndarray[M, 3]

Surface points.

required
source_coords ndarray[N, 3]

Data points.

required
max_distance float

The maximum distance within which to search for nearest mesh points. Defaults to np.inf.

inf

Returns:

Name Type Description
tuple tuple[float, list]

Closest distance and index of the points.

nearest_points(input_coords, source_coords, max_distance=np.inf) staticmethod

Projects source_coords to input_coords by finding the nearest points within a maximum distance.

Parameters:

Name Type Description Default
input_coords ndarray[M, 3]

Surface points.

required
source_coords ndarray[N, 3]

Data points.

required
max_distance float

The maximum distance within which to search for nearest mesh points. Defaults to np.inf.

inf

Returns:

Name Type Description
tuple tuple

Point indices and index labels for each source_coords.