ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
reusex::io Namespace Reference

Namespaces

namespace  speckle

Classes

struct  E57ScanExport
 A single scan position to write into an E57 file. More...
struct  ExportScene
 Intermediate representation for exporting all project data. More...

Functions

void import_e57 (ProjectDB &db, const std::filesystem::path &e57_path)
 Import point cloud data from an E57 file into a ProjectDB.
void export_e57 (const std::filesystem::path &path, const std::vector< E57ScanExport > &scans)
 Export one or more XYZRGB clouds as separate scan positions in an E57 file.
double read_exif_timestamp (const std::filesystem::path &jpeg_path)
 Read EXIF DateTimeOriginal from a JPEG file.
ExportScene gather_export_scene (const ProjectDB &db)
 Gather all exportable data from a ProjectDB.
void import_ply (ProjectDB &db, const std::filesystem::path &ply_path)
 Import a point cloud from a PLY file into a ProjectDB.
void export_ply (const std::filesystem::path &path, const Cloud &cloud, const CloudN *normals=nullptr)
 Export a point cloud to a binary PLY file.
auto getPlanes (CloudLConstPtr planes, CloudNConstPtr normals, CloudLocConstPtr locations) -> std::tuple< EigenVectorContainer< double, 4 >, EigenVectorContainer< double, 3 >, std::vector< IndicesPtr > >
 Extract plane data from labeled point clouds.
bool save (std::filesystem::path const &output_path, std::vector< pcl::ModelCoefficients > const &model_coefficients, std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > const &centroids, std::vector< std::shared_ptr< pcl::Indices > > const &inlier_indices)
 Save plane data to file.
bool read (std::filesystem::path const &input_path, std::vector< pcl::ModelCoefficients > &model_coefficients, std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &centroids, std::vector< std::shared_ptr< pcl::Indices > > &inlier_indices)
 Read plane data from file.
auto configure_rhino_model () -> std::unique_ptr< ONX_Model >
 Create a configured ONX_Model with ReUseX metadata, units, and tolerances.
auto export_to_rhino (const ExportScene &scene) -> std::unique_ptr< ONX_Model >
 Export a full ExportScene to a Rhino ONX_Model with layer hierarchy.
auto make_rhino_pointcloud (CloudConstPtr cloud) -> std::unique_ptr< ON_PointCloud >
 Convert a PCL XYZRGB point cloud to an ON_PointCloud.
auto make_rhino_pointcloud (CloudConstPtr cloud, CloudNConstPtr normals) -> std::unique_ptr< ON_PointCloud >
 Convert a PCL XYZRGB point cloud with normals to an ON_PointCloud.
auto make_rhino_mesh (const pcl::PolygonMesh &mesh) -> std::unique_ptr< ON_Mesh >
 Convert a PCL PolygonMesh to an ON_Mesh.
auto make_sphere_mesh (double cx, double cy, double cz, double radius, int resolution=16) -> std::unique_ptr< ON_Mesh >
 Create a UV sphere mesh.
void import_rtabmap (ProjectDB &db, const std::filesystem::path &rtabmap_db_path)
 Import raw sensor data from an RTABMap database into a ProjectDB.

Function Documentation

◆ configure_rhino_model()

auto reusex::io::configure_rhino_model ( ) -> std::unique_ptr< ONX_Model >

Create a configured ONX_Model with ReUseX metadata, units, and tolerances.

◆ export_e57()

void reusex::io::export_e57 ( const std::filesystem::path & path,
const std::vector< E57ScanExport > & scans )

Export one or more XYZRGB clouds as separate scan positions in an E57 file.

Each entry in scans becomes one Data3D block. RGB color is always written. Normals are written using the E57_EXT_surface_normals extension when provided.

Parameters
pathOutput .e57 file path (created or overwritten).
scansOne or more scans to embed in the file.

◆ export_ply()

void reusex::io::export_ply ( const std::filesystem::path & path,
const Cloud & cloud,
const CloudN * normals = nullptr )

Export a point cloud to a binary PLY file.

When normals is provided it must have the same number of points as cloud; both are written as a single PLY element with merged fields (x, y, z, rgb, normal_x, normal_y, normal_z).

Parameters
pathOutput .ply file path (created or overwritten).
cloudXYZRGB point cloud to export.
normalsSurface normals to merge into the output (nullptr = skip).

◆ export_to_rhino()

auto reusex::io::export_to_rhino ( const ExportScene & scene) -> std::unique_ptr< ONX_Model >

Export a full ExportScene to a Rhino ONX_Model with layer hierarchy.

◆ gather_export_scene()

ExportScene reusex::io::gather_export_scene ( const ProjectDB & db)

Gather all exportable data from a ProjectDB.

Only populates layers that have data.

◆ getPlanes()

auto reusex::io::getPlanes ( CloudLConstPtr planes,
CloudNConstPtr normals,
CloudLocConstPtr locations ) -> std::tuple< EigenVectorContainer< double, 4 >, EigenVectorContainer< double, 3 >, std::vector< IndicesPtr > >

Extract plane data from labeled point clouds.

Parameters
planesLabeled point cloud where labels indicate plane IDs.
normalsPoint cloud containing plane normals.
locationsPoint cloud containing plane centroid locations.
Returns
Tuple of (plane coefficients, centroids, inlier indices).

◆ import_e57()

void reusex::io::import_e57 ( ProjectDB & db,
const std::filesystem::path & e57_path )

Import point cloud data from an E57 file into a ProjectDB.

Each scan in the E57 file is stored as a separate named XYZRGB point cloud. Color, normals, and intensity data are extracted when available. If color is absent but intensity is present, intensity is mapped to grayscale RGB. Normals are stored as a separate cloud with a "_normals" suffix.

Cloud naming: uses the scan name from the E57 header when set, otherwise "{file_stem}_scan_{N}".

Parameters
dbTarget project database (must be open in write mode).
e57_pathPath to the source .e57 file.

◆ import_ply()

void reusex::io::import_ply ( ProjectDB & db,
const std::filesystem::path & ply_path )

Import a point cloud from a PLY file into a ProjectDB.

Detects available fields and extracts all data present:

  • XYZ position (required)
  • RGB color → stored as XYZRGB cloud named after the file stem
  • Normals (normal_x/y/z or nx/ny/nz) → stored as a separate cloud with a "_normals" suffix
  • Semantic labels → stored as a separate cloud with a "_labels" suffix
  • Intensity without color → mapped to grayscale RGB
Parameters
dbTarget project database (must be open in write mode).
ply_pathPath to the source .ply file.

◆ import_rtabmap()

void reusex::io::import_rtabmap ( ProjectDB & db,
const std::filesystem::path & rtabmap_db_path )

Import raw sensor data from an RTABMap database into a ProjectDB.

For each node the function extracts color, depth, confidence, the optimized world pose, and camera intrinsics in their original RTABMap format and stores everything in the project database. Images are stored in their native orientation without rotation.

No heavy processing (voxelization, normal estimation, etc.) is performed. Point cloud generation is handled separately by reusex::geometry::reconstruct_point_clouds().

Parameters
dbTarget project database (must be open in write mode).
rtabmap_db_pathPath to the source RTABMap .db file.

◆ make_rhino_mesh()

auto reusex::io::make_rhino_mesh ( const pcl::PolygonMesh & mesh) -> std::unique_ptr< ON_Mesh >

Convert a PCL PolygonMesh to an ON_Mesh.

◆ make_rhino_pointcloud() [1/2]

auto reusex::io::make_rhino_pointcloud ( CloudConstPtr cloud) -> std::unique_ptr< ON_PointCloud >

Convert a PCL XYZRGB point cloud to an ON_PointCloud.

◆ make_rhino_pointcloud() [2/2]

auto reusex::io::make_rhino_pointcloud ( CloudConstPtr cloud,
CloudNConstPtr normals ) -> std::unique_ptr< ON_PointCloud >

Convert a PCL XYZRGB point cloud with normals to an ON_PointCloud.

◆ make_sphere_mesh()

auto reusex::io::make_sphere_mesh ( double cx,
double cy,
double cz,
double radius,
int resolution = 16 ) -> std::unique_ptr< ON_Mesh >

Create a UV sphere mesh.

◆ read()

bool reusex::io::read ( std::filesystem::path const & input_path,
std::vector< pcl::ModelCoefficients > & model_coefficients,
std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > & centroids,
std::vector< std::shared_ptr< pcl::Indices > > & inlier_indices )
nodiscard

Read plane data from file.

Parameters
input_pathPath to input file.
model_coefficientsOutput plane model coefficients.
centroidsOutput plane centroids.
inlier_indicesOutput indices of points belonging to each plane.
Returns
True if read was successful, false otherwise.

◆ read_exif_timestamp()

double reusex::io::read_exif_timestamp ( const std::filesystem::path & jpeg_path)

Read EXIF DateTimeOriginal from a JPEG file.

Returns epoch seconds (double), or -1.0 if not available.

◆ save()

bool reusex::io::save ( std::filesystem::path const & output_path,
std::vector< pcl::ModelCoefficients > const & model_coefficients,
std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > const & centroids,
std::vector< std::shared_ptr< pcl::Indices > > const & inlier_indices )
nodiscard

Save plane data to file.

Parameters
output_pathPath to output file.
model_coefficientsPlane model coefficients.
centroidsPlane centroids.
inlier_indicesIndices of points belonging to each plane.
Returns
True if save was successful, false otherwise.