ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
FileIO.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <QString>
11 #include <functional>
12 
13 #include "CV_io.h"
14 
15 class FileIO {
16 public:
17  CV_IO_LIB_API static void setWriterInfo(const QString &applicationName,
18  const QString &version);
19  CV_IO_LIB_API static QString writerInfo();
20 
21  CV_IO_LIB_API static QString applicationName();
22  CV_IO_LIB_API static QString version();
23 
24  CV_IO_LIB_API static QString createdBy();
25  CV_IO_LIB_API static QString createdDateTime();
26 
27 private:
28  FileIO() = delete;
29 
30  static QString s_applicationName;
31  static QString s_version;
32  static QString s_writerInfo;
33 };
34 
35 namespace cloudViewer {
36 namespace io {
41  // Attention: when you update the defaults, update the docstrings in
42  // pybind/io/class_io.cpp
43  std::string format = "auto",
44  bool remove_nan_points = false,
45  bool remove_infinite_points = false,
46  bool print_progress = false,
47  std::function<bool(double)> update_progress = {})
48  : format(format),
49  remove_nan_points(remove_nan_points),
50  remove_infinite_points(remove_infinite_points),
51  print_progress(print_progress),
52  update_progress(update_progress) {};
53  ReadPointCloudOption(std::function<bool(double)> up)
55  update_progress = up;
56  };
60  std::string format;
72  std::function<bool(double)> update_progress;
73 };
74 
78  enum class IsAscii : bool { Binary = false, Ascii = true };
79  enum class Compressed : bool { Uncompressed = false, Compressed = true };
81  // Attention: when you update the defaults, update the docstrings in
82  // pybind/io/class_io.cpp
83  std::string format = "auto",
84  IsAscii write_ascii = IsAscii::Binary,
85  Compressed compressed = Compressed::Uncompressed,
86  bool print_progress = false,
87  std::function<bool(double)> update_progress = {})
88  : format(format),
91  print_progress(print_progress),
92  update_progress(update_progress) {};
93  // for compatibility
95  bool compressed = false,
96  bool print_progress = false,
97  std::function<bool(double)> update_progress = {})
98  : write_ascii(IsAscii(write_ascii)),
99  compressed(Compressed(compressed)),
100  print_progress(print_progress),
101  update_progress(update_progress) {};
102  // for compatibility
104  bool write_ascii,
105  bool compressed = false,
106  bool print_progress = false,
107  std::function<bool(double)> update_progress = {})
108  : format(format),
109  write_ascii(IsAscii(write_ascii)),
110  compressed(Compressed(compressed)),
111  print_progress(print_progress),
112  update_progress(update_progress) {};
113  WritePointCloudOption(std::function<bool(double)> up)
115  update_progress = up;
116  };
120  std::string format;
135  std::function<bool(double)> update_progress;
136 };
137 } // namespace io
138 } // namespace cloudViewer
IsAscii write_ascii
Compressed compressed
#define CV_IO_LIB_API
Definition: CV_io.h:15
filament::Texture::InternalFormat format
Definition: FileIO.h:15
static QString writerInfo()
static QString createdBy()
static QString version()
static void setWriterInfo(const QString &applicationName, const QString &version)
static QString applicationName()
static QString createdDateTime()
Generic file read and write utility for python interface.
Optional parameters to ReadPointCloud.
Definition: FileIO.h:39
ReadPointCloudOption(std::function< bool(double)> up)
Definition: FileIO.h:53
bool remove_nan_points
Whether to remove all points that have nan.
Definition: FileIO.h:62
ReadPointCloudOption(std::string format="auto", bool remove_nan_points=false, bool remove_infinite_points=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: FileIO.h:40
std::function< bool(double)> update_progress
Definition: FileIO.h:72
bool remove_infinite_points
Whether to remove all points that have +-inf.
Definition: FileIO.h:64
Optional parameters to WritePointCloud.
Definition: FileIO.h:77
WritePointCloudOption(std::string format, bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: FileIO.h:103
std::function< bool(double)> update_progress
Definition: FileIO.h:135
WritePointCloudOption(bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: FileIO.h:94
WritePointCloudOption(std::function< bool(double)> up)
Definition: FileIO.h:113
WritePointCloudOption(std::string format="auto", IsAscii write_ascii=IsAscii::Binary, Compressed compressed=Compressed::Uncompressed, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: FileIO.h:80