PointClip#

class PointClip(point_cloud_range=(-80, -80, -3, 80, 80, 1))[source]#

Bases: object

Clamp coord to an axis-aligned point-cloud range.

Clips each coordinate column to the [min, max] box given by point_cloud_range in place (out-of-range values are saturated to the nearest face, not removed; the point count is unchanged). Requires coord; a no-op if coord is absent. Registered as PointClip – use this string as the type in a transform=[...] config list.

Parameters:

point_cloud_range (tuple[float, ...]) – six values (x_min, y_min, z_min, x_max, y_max, z_max) giving the clamp box. Defaults to (-80, -80, -3, 80, 80, 1).

Note

This clamps coordinates; it does not drop points. Per-point arrays stay the same length, so coordinates collapsed onto a face remain present.

Example

>>> import numpy as np
>>> from pimm.datasets.transform import PointClip
>>> data = {"coord": np.array([[-2., 0.5, 0.], [2., -3., 0.]], dtype="f4")}
>>> out = PointClip(point_cloud_range=(-1, -1, -1, 1, 1, 1))(data)
>>> out["coord"]  # out-of-range coords saturated to the box faces; count unchanged
array([[-1. ,  0.5,  0. ],
       [ 1. , -1. ,  0. ]])