pchandler.filters.core

Abstract filter base class plus a generic field-based filter.

Classes

GenericFieldFilter

Generic filter that evaluates a callable on a named field.

PointCloudFilter

Abstract base class for PointCloudData filters.

class pchandler.filters.core.PointCloudFilter

Bases: ABC

Abstract base class for PointCloudData filters.

abstractmethod mask(pcd)

Compute and return a boolean mask for the provided point cloud.

Parameters:

pcd (PointCloudData) – Point cloud to be evaluated.

Returns:

Boolean mask, True for points kept by the filter.

Return type:

Vector_Bool_T

reduce(pcd)

Reduce the point cloud in place to the points selected by the mask.

Parameters:

pcd (PointCloudData) – Point cloud mutated in place.

extract(pcd)

Return a new point cloud built from the points selected by the mask.

The existing point cloud is reduced to only the points defined by the negated mask.

Parameters:

pcd (PointCloudData) – Source point cloud (mutated: keeps only the negated-mask points).

Returns:

New point cloud carrying the selected points.

Return type:

PointCloudData

sample(pcd)

Return a copy of the point cloud sampled using the boolean mask.

Parameters:

pcd (PointCloudData) – Source point cloud (not mutated).

Returns:

New point cloud carrying the sampled points.

Return type:

PointCloudData

class pchandler.filters.core.GenericFieldFilter

Bases: PointCloudFilter

Generic filter that evaluates a callable on a named field.

__init__(field_label, filter_func)

Build a generic filter that operates on a single named field.

Parameters:
  • field_label (str) – A label or name for the field.

  • filter_func (Callable[[NDArray], Vector_Bool_T]) – A callable function used to perform filtering logic. Must return a boolean mask.

mask(pcd)

Create a boolean mask from the defined field and function.

Parameters:

pcd (PointCloudData) – Point cloud to be evaluated.

Returns:

Boolean mask returned by filter_func evaluated on the named field.

Return type:

Vector_Bool_T