pchandler.data_io.core
Base module for I/O handlers and supporting helper methods.
Defines AbstractIOHandler (the contract every per-format handler
implements), SUPPORTED_TYPES (the canonical set of file suffixes
pchandler.load_file() accepts), find_point_cloud_in_directory()
(directory-walking helper), and the private name-cleaning and dtype-derivation
helpers used by the concrete handlers.
Functions
|
Search a directory for point cloud files with specific extensions. |
Classes
Abstract base class for per-format point-cloud I/O handlers. |
|
|
Optional keyword arguments accepted by |
- class pchandler.data_io.core.AbstractIOHandler
Bases:
ABCAbstract base class for per-format point-cloud I/O handlers.
Concrete subclasses (
PlyHandler,LasHandler, etc.) declare the file extensions they support viaFORMATSand implementload()andsave(). Shared helpers for field-name cleaning, dtype assembly, and structured-array generation are provided here.- classmethod find_pcds_in_directory(directory_path, include_subdirectories=True)
Find all point cloud files in a specified directory.
- abstractmethod classmethod load(path, scalar_fields=None, remove_prefix=True, prefix='scalar_', **pcd_kw)
Load a point cloud (or stream of point clouds) from
path— implemented by subclasses.
- abstractmethod classmethod save(pcd, path, scalar_fields=None, add_prefix=False, prefix='scalar_', revert_sf_types=False, **config)
Save
pcdtopath— implemented by subclasses.
- classmethod extract_xyz(data, num_points)
Extract XYZ components from the given structured array or dict.
- Parameters:
data (BaseDataT) – Structured-array or dict keyed by
x/y/z.num_points (int) – Number of points in
data.
- Returns:
An
(N, 3)array assembled from the three coordinate columns.- Return type:
Array_Nx3_T
- classmethod extract_scalar_fields(pcd, data, num_points, field_names)
Extract scalar fields from the given structured array or dict and attach them to
pcd.- Parameters:
pcd (PointCloudData) – Point cloud to populate with scalar fields.
data (BaseDataT) – Structured array or dict containing per-point scalar columns.
num_points (int) – Number of points in
data.field_names (dict[str, str]) – Mapping of scalar field names to their corresponding data keys in the dataset.
- pchandler.data_io.core.find_point_cloud_in_directory(directory_path, pcd_file_types=SUPPORTED_TYPES, include_subdirectories=True)
Search a directory for point cloud files with specific extensions.