2#include "reusex/types.hpp"
8#include <opencv2/core/mat.hpp>
9#include <pcl/PolygonMesh.h>
10#include <pcl/TextureMesh.h>
11#include <pcl/point_cloud.h>
12#include <pcl/point_types.h>
54 explicit ProjectDB(std::filesystem::path dbPath,
bool readOnly =
false);
71 const std::filesystem::
path &
path() const noexcept;
80 const
cv::Mat &confidence,
81 const std::array<
double, 16> &worldPose,
82 const
core::SensorIntrinsics &intrinsics,
83 double timestamp = -1.0);
110 const std::vector<uint8_t> &jpeg_data,
111 double timestamp = -1.0,
int nodeId = -1);
127 const std::vector<cv::Mat> &labels);
132 std::string_view stage =
"",
133 std::string_view paramsJson =
"");
136 std::string_view stage =
"",
137 std::string_view paramsJson =
"");
140 std::string_view stage =
"",
141 std::string_view paramsJson =
"");
144 const pcl::PointCloud<pcl::PointXYZ> &cloud,
145 std::string_view stage =
"",
146 std::string_view paramsJson =
"");
151 pcl::PointCloud<pcl::PointXYZ>::Ptr
162 const std::map<int, std::string> &labelMap);
164 std::map<int, std::string>
170 std::string_view stage =
"", std::string_view paramsJson =
"");
173 std::string_view stage =
"", std::string_view paramsJson =
"");
175 pcl::PolygonMesh::Ptr
mesh(std::string_view name)
const;
187 std::vector<std::string>
194 std::string_view paramsJson =
"");
197 std::string_view errorMsg =
"");
284 std::string_view projectId);
298 std::string_view projectId,
299 std::string_view
id);
325 std::map<std::string, std::string>
336 std::string_view fieldName)
const;
359 std::string_view column,
360 std::string_view value);
375 std::string_view fieldName,
376 std::string_view value);
385 std::string_view fieldName);
422 std::unique_ptr<Impl> impl_;
double sensor_frame_timestamp(int nodeId) const
Get the timestamp (epoch seconds) of a sensor frame. Returns -1.0 if not set.
int log_pipeline_start(std::string_view stage, std::string_view paramsJson="")
std::string point_cloud_type(std::string_view name) const
bool has_point_cloud(std::string_view name) const
void add_material_passport(const core::MaterialPassport &passport, std::string_view projectId)
ProjectDB(const ProjectDB &)=delete
void save_point_cloud(std::string_view name, const pcl::PointCloud< pcl::PointXYZ > &cloud, std::string_view stage="", std::string_view paramsJson="")
bool has_segmentation_image(int nodeId) const
void log_pipeline_end(int logId, bool success, std::string_view errorMsg="")
std::vector< std::string > list_building_components() const
CloudLPtr point_cloud_label(std::string_view name) const
pcl::PolygonMesh::Ptr mesh(std::string_view name) const
ProjectDB & operator=(const ProjectDB &)=delete
int nearest_sensor_frame_by_timestamp(double timestamp) const
Find the sensor frame with the closest timestamp to the given value.
std::array< double, 16 > sensor_frame_pose(int nodeId) const
std::vector< PipelineLogEntry > pipeline_log(int limit=0) const
void add_material_passport(const core::MaterialPassport &passport, std::string_view projectId, std::string_view id)
Add a material passport with a custom row ID.
void save_panoramic_image(const std::string &filename, const std::vector< uint8_t > &jpeg_data, double timestamp=-1.0, int nodeId=-1)
bool has_mesh(std::string_view name) const
std::vector< std::string > list_passport_guids() const
List document GUIDs ordered by created_at.
void set_passport_metadata_field(std::string_view documentGuid, std::string_view column, std::string_view value)
Set a metadata column on a material passport.
void delete_panoramic_image(std::string_view filename)
void save_point_cloud(std::string_view name, const Cloud &cloud, std::string_view stage="", std::string_view paramsJson="")
std::vector< int > sensor_frame_ids() const
ProjectSummary project_summary() const
std::vector< core::MaterialPassport > all_material_passports() const
core::MaterialPassport material_passport(std::string_view documentGuid) const
void save_segmentation_image(int nodeId, const cv::Mat &labels)
int schema_version() const
void save_segmentation_images(const std::vector< int > &nodeIds, const std::vector< cv::Mat > &labels)
int building_component_count() const
ProjectDB(std::filesystem::path dbPath, bool readOnly=false)
Opens a ReUseX project database and validates its schema.
bool is_open() const noexcept
void delete_building_component(std::string_view name)
void save_mesh(std::string_view name, const pcl::TextureMesh &mesh, std::string_view stage="", std::string_view paramsJson="")
cv::Mat sensor_frame_confidence(int nodeId) const
void delete_point_cloud(std::string_view name)
cv::Mat sensor_frame_image(int nodeId) const
int panoramic_image_count() const
cv::Mat panoramic_image(std::string_view filename) const
std::map< int, std::string > label_definitions(std::string_view cloudName) const
bool has_panoramic_image(std::string_view filename) const
cv::Mat segmentation_image(int nodeId) const
std::vector< std::string > list_project_ids() const
List all project IDs in the database.
void save_point_cloud(std::string_view name, const CloudL &cloud, std::string_view stage="", std::string_view paramsJson="")
std::string passport_property_value(std::string_view documentGuid, std::string_view fieldName) const
Get a single passport property value by field name.
std::vector< PanoramicImage > list_panoramic_images() const
void save_point_cloud(std::string_view name, const CloudN &cloud, std::string_view stage="", std::string_view paramsJson="")
CloudPtr point_cloud_xyzrgb(std::string_view name) const
CloudNPtr point_cloud_normal(std::string_view name) const
bool has_sensor_frame(int nodeId) const
void validate_schema() const
void update_project_metadata(const ProjectMetadata &metadata)
Update project metadata.
geometry::BuildingComponent building_component(std::string_view name) const
std::map< std::string, std::string > passport_stored_properties(std::string_view documentGuid) const
Get stored property field_name→string pairs for a passport.
bool has_building_component(std::string_view name) const
const std::filesystem::path & path() const noexcept
std::vector< std::string > list_point_clouds() const
void delete_panoramic_image(int id)
void set_passport_property(std::string_view documentGuid, std::string_view fieldName, std::string_view value)
Set a single property value by field name (upsert).
std::vector< std::string > list_building_components(geometry::ComponentType type) const
void save_mesh(std::string_view name, const pcl::PolygonMesh &mesh, std::string_view stage="", std::string_view paramsJson="")
~ProjectDB()
Destructor closes database connection.
core::SensorIntrinsics sensor_frame_intrinsics(int nodeId) const
cv::Mat panoramic_image(int id) const
core::MaterialPassportMetadata passport_metadata(std::string_view documentGuid) const
Get passport metadata without loading all properties.
pcl::PointCloud< pcl::PointXYZ >::Ptr point_cloud_xyz(std::string_view name) const
void delete_passport_property(std::string_view documentGuid, std::string_view fieldName)
Delete a single property value by field name.
pcl::TextureMesh::Ptr texture_mesh(std::string_view name) const
void save_building_component(const geometry::BuildingComponent &component)
cv::Mat sensor_frame_depth(int nodeId) const
std::vector< std::string > list_meshes() const
void save_sensor_frame(int nodeId, const cv::Mat &colorImage)
ProjectDB(ProjectDB &&) noexcept
ProjectMetadata get_project_metadata(std::string_view projectId) const
Get project metadata by project ID.
void delete_material_passport(std::string_view documentGuid)
Delete a material passport by GUID.
void save_label_definitions(std::string_view cloudName, const std::map< int, std::string > &labelMap)
ComponentType
Discriminator for building component types.
typename CloudN::Ptr CloudNPtr
pcl::PointCloud< PointT > Cloud
typename CloudL::Ptr CloudLPtr
typename Cloud::Ptr CloudPtr
pcl::PointCloud< LabelT > CloudL
pcl::PointCloud< NormalT > CloudN
std::map< int, std::string > labels
std::map< std::string, int > count_by_type
std::string version_number
std::string building_address
std::string survey_organisation
std::vector< CloudInfo > clouds
std::vector< ProjectInfo > projects
std::filesystem::path path
std::vector< MaterialInfo > materials
SensorFrameInfo sensor_frames
std::vector< MeshInfo > meshes
PanoramicInfo panoramic_images
A complete material passport for a reused building material.
Lightweight camera intrinsics replacing rtabmap::CameraModel in downstream code.
A detected or manual building component (window, door, wall, ...).