CropBoundary#
- class CropBoundary[source]#
Bases:
objectDrop points whose
segmentlabel is 0 or 1.Keeps only points with
segmentnot in{0, 1}– conventionally discarding unannotated/boundary classes – and subsamples every per-point key inindex_valid_keystogether viaindex_operator. Requiressegment(asserted). Registered asCropBoundary– use this string as thetypein atransform=[...]config list.Note
Takes no constructor arguments. The removed labels (0 and 1) are hard-coded;
segmentis flattened before masking.Example
>>> import numpy as np >>> from pimm.datasets.transform import CropBoundary >>> data = {"coord": np.array([[0., 0., 0.], [1., 1., 1.], ... [2., 2., 2.], [3., 3., 3.]], dtype="f4"), ... "segment": np.array([0, 1, 2, 3])} >>> out = CropBoundary()(data) # drop points whose segment is 0 or 1 >>> out["segment"] array([2, 3]) >>> out["coord"] # coord cropped in lockstep with segment array([[2., 2., 2.], [3., 3., 3.]], dtype=float32)