17 #include <unordered_map>
26 static const std::unordered_map<
28 std::function<bool(
const std::string &,
44 static const std::unordered_map<
46 std::function<bool(
const std::string &,
65 bool print_progress) {
66 auto pointcloud = std::make_shared<geometry::PointCloud>();
68 {
format,
false,
false, print_progress});
86 "Read geometry::PointCloud failed: unknown file extension for "
92 if (
params.remove_nan_points ||
params.remove_infinite_points) {
94 "remove_nan_points and remove_infinite_points options are "
101 "Read t::geometry::PointCloud with following attributes: ");
104 kv.second.GetShape().ToString(),
105 kv.second.GetStrides().ToString(),
106 kv.second.GetDtype().ToString());
114 const std::string &file_format,
115 bool remove_nan_points,
116 bool remove_infinite_points,
117 bool print_progress) {
118 std::string
format = file_format;
147 bool success = map_itr->second(
162 bool print_progress) {
189 if (
bool(
params.write_ascii)) {
193 if (
bool(
params.compressed)) {
195 "PointCloud can't be saved in compressed format as .npz.");
202 kv.second.GetShape().ToString(),
203 kv.second.GetStrides().ToString(),
204 kv.second.GetDtype().ToString());
filament::Texture::InternalFormat format
cmdLineReadable * params[]
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
int64_t GetLength() const
A point cloud contains a list of 3D points.
core::Tensor & GetPointPositions()
Get the value of the "positions" attribute. Convenience function.
bool IsEmpty() const override
Returns !HasPointPositions().
PointCloud To(const core::Device &device, bool copy=false) const
cloudViewer::geometry::PointCloud ToLegacy() const
Convert to a legacy CloudViewer PointCloud.
const TensorMap & GetPointAttr() const
Getter for point_attr_ TensorMap. Used in Pybind.
Helper functions for the ml ops.
::ccPointCloud PointCloud
bool WritePointCloud(const std::string &filename, const ccPointCloud &pointcloud, const WritePointCloudOption ¶ms)
static const std::unordered_map< std::string, std::function< bool(const std::string &, geometry::PointCloud &, const cloudViewer::io::ReadPointCloudOption &)> > file_extension_to_pointcloud_read_function
bool ReadPointCloudFromTXT(const std::string &filename, geometry::PointCloud &pointcloud, const cloudViewer::io::ReadPointCloudOption ¶ms)
std::unordered_map< std::string, core::Tensor > ReadNpz(const std::string &file_name)
bool WritePointCloud(const std::string &filename, const geometry::PointCloud &pointcloud, const cloudViewer::io::WritePointCloudOption ¶ms)
bool ReadPointCloudFromPTS(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption ¶ms)
bool WritePointCloudToTXT(const std::string &filename, const geometry::PointCloud &pointcloud, const cloudViewer::io::WritePointCloudOption ¶ms)
bool WritePointCloudToPLY(const std::string &filename, const geometry::PointCloud &pointcloud, const cloudViewer::io::WritePointCloudOption ¶ms)
std::shared_ptr< geometry::PointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
void WriteNpz(const std::string &file_name, const std::unordered_map< std::string, core::Tensor > &tensor_map)
bool WritePointCloudToPTS(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption ¶ms)
bool WritePointCloudToPCD(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption ¶ms)
bool ReadPointCloudFromSPLAT(const std::string &filename, geometry::PointCloud &pointcloud, const cloudViewer::io::ReadPointCloudOption ¶ms)
bool ReadPointCloudFromPCD(const std::string &filename, t::geometry::PointCloud &pointcloud, const ReadPointCloudOption ¶ms)
bool WritePointCloudToSPLAT(const std::string &filename, const geometry::PointCloud &pointcloud, const cloudViewer::io::WritePointCloudOption ¶ms)
bool ReadPointCloudFromNPZ(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption ¶ms)
static const std::unordered_map< std::string, std::function< bool(const std::string &, const geometry::PointCloud &, const cloudViewer::io::WritePointCloudOption &)> > file_extension_to_pointcloud_write_function
bool ReadPointCloud(const std::string &filename, geometry::PointCloud &pointcloud, const cloudViewer::io::ReadPointCloudOption ¶ms)
bool ReadPointCloudFromPLY(const std::string &filename, geometry::PointCloud &pointcloud, const cloudViewer::io::ReadPointCloudOption ¶ms)
bool WritePointCloudToNPZ(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption ¶ms)
std::string GetFileExtensionInLowerCase(const std::string &filename)
std::string ToUpper(const std::string &s)
Convert string to the upper case.
Generic file read and write utility for python interface.
Optional parameters to ReadPointCloud.
bool remove_nan_points
Whether to remove all points that have nan.
std::function< bool(double)> update_progress
bool remove_infinite_points
Whether to remove all points that have +-inf.
Optional parameters to WritePointCloud.
std::function< bool(double)> update_progress
update_progress(double percent) functor for ConsoleProgressBar