pchandler.data_io.ply
PLY file-format handler class.
Classes
Handles PLY file input and output. |
- class pchandler.data_io.ply.PlyHandler
Bases:
AbstractIOHandlerHandles PLY file input and output.
Supported file extensions:
.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.
Noneretrieves all scalar fields;[]ignores scalar fields.remove_prefix (bool, default=True) – If
True, stripprefixfrom scalar-field names.prefix (str, default="scalar_") – Prefix to strip from scalar-field names if
remove_prefixisTrue.**pcd_kw (Unpack[PointCloudDataKW]) – Additional keyword arguments forwarded to
PointCloudData.
- Returns:
The loaded point cloud.
- Return type:
- 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.
Nonewrites every field on the cloud;[]writes XYZ only.add_prefix (bool, default=False) – If
True, prependprefixto scalar-field column names.prefix (str, default="scalar_") – Prefix to prepend when
add_prefixisTrue.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).