pchandler.data_io.ply

PLY file-format handler class.

Classes

PlyHandler

Handles PLY file input and output.

class pchandler.data_io.ply.PlyHandler

Bases: AbstractIOHandler

Handles PLY file input and output.

Supported file extensions:

  • .ply

FORMATS: list[str] = ['.ply']
classmethod load(path, /, scalar_fields=None, remove_prefix=True, prefix='scalar_', **pcd_kw)

Load a point cloud from a PLY file.

Parameters:
  • path (str | Path) – Input PLY file path.

  • scalar_fields (list[str], default=None) – Specific scalar fields to extract from the PLY file. None retrieves all scalar fields; [] ignores scalar fields.

  • remove_prefix (bool, default=True) – If True, strip prefix from scalar-field names.

  • prefix (str, default="scalar_") – Prefix to strip from scalar-field names if remove_prefix is True.

  • **pcd_kw (Unpack[PointCloudDataKW]) – Additional keyword arguments forwarded to PointCloudData.

Returns:

The loaded point cloud.

Return type:

PointCloudData

classmethod save(pcd, path, scalar_fields=None, add_prefix=False, prefix='scalar_', revert_sf_types=False, as_ascii=False, **config)

Save the point cloud data to a PLY file.

Parameters:
  • pcd (PointCloudData) – Point cloud to save.

  • path (str | Path) – Output PLY file path (suffix must be .ply).

  • scalar_fields (list[str], default=None) – Specific scalar fields to write. None writes every field on the cloud; [] writes XYZ only.

  • add_prefix (bool, default=False) – If True, prepend prefix to scalar-field column names.

  • prefix (str, default="scalar_") – Prefix to prepend when add_prefix is True.

  • revert_sf_types (bool, default=False) – If True, restore each scalar field’s original on-disk dtype.

  • as_ascii (bool, default=False) – Write as ASCII PLY if True, otherwise write a binary PLY.

  • **config (Any) – Additional configuration (currently unused).