64 cmd.
print(
"[TreeIso]");
66 if (cmd.
clouds().empty()) {
67 cmd.
error(
"No cloud loaded");
72 qTreeIso::Parameters parameters;
74 bool try_init_seg =
false;
75 bool try_intermediate_seg =
false;
76 bool try_final_seg =
false;
79 const QString& ARGUMENT = cmd.
arguments().front();
86 parameters.reg_strength1 =
88 if ((!
convert) & (parameters.reg_strength1 <= 0.0)) {
91 "Invalid parameter: value after \"-%1\"")
94 cmd.
print(QString(
"lambda1 (Regularization strength for "
95 "initial segmentation) set: %1")
96 .arg(parameters.reg_strength1));
105 if ((!
convert) & (parameters.min_nn1 < 3)) {
108 "Invalid parameter: value after \"-%1\"")
111 cmd.
print(QString(
"K1 (Nearest neighbors to search for initial "
112 "segmentation) set: %1")
113 .arg(parameters.min_nn1));
120 parameters.decimate_res1 =
122 if ((!
convert) & (parameters.decimate_res1 < 0.001)) {
125 "Invalid parameter: value after \"-%1\"")
128 cmd.
print(QString(
"Decimated resolution (in m) for initial "
129 "segmentation set: %1")
130 .arg(parameters.decimate_res1));
133 try_intermediate_seg =
true;
137 parameters.reg_strength2 =
139 if ((!
convert) & (parameters.reg_strength2 <= 0.0)) {
142 "Invalid parameter: value after \"-%1\"")
145 cmd.
print(QString(
"lambda2 (Regularization strength for "
146 "intermediate segmentation) set: %1")
147 .arg(parameters.reg_strength2));
150 try_intermediate_seg =
true;
156 if ((!
convert) & (parameters.min_nn2 < 3)) {
159 "Invalid parameter: value after \"-%1\"")
162 cmd.
print(QString(
"K2 (Nearest neighbors to search for "
163 "intermediate segmentation) set: %1")
164 .arg(parameters.min_nn2));
167 try_intermediate_seg =
true;
173 if ((!
convert) & (parameters.max_gap <= 0.0001)) {
176 "Invalid parameter: value after \"-%1\"")
179 cmd.
print(QString(
"Maximum point gap (in m) for intermediate "
180 "segmentation set: %1")
181 .arg(parameters.max_gap));
184 try_intermediate_seg =
true;
188 parameters.decimate_res2 =
190 if ((!
convert) & (parameters.decimate_res2 < 0.001)) {
193 "Invalid parameter: value after \"-%1\"")
196 cmd.
print(QString(
"Decimated resolution (in m) for "
197 "intermediate segmentation set: %1")
198 .arg(parameters.decimate_res2));
201 try_final_seg =
true;
205 parameters.rel_height_length_ratio =
207 if ((!
convert) & (parameters.rel_height_length_ratio < 0.001)) {
210 "Invalid parameter: value after \"-%1\"")
213 cmd.
print(QString(
"Relative height to length ratio (used to "
214 "detect non-stems for final segmentation) "
216 .arg(parameters.rel_height_length_ratio));
220 try_final_seg =
true;
224 parameters.vertical_weight =
226 if ((!
convert) & (parameters.vertical_weight < 0.001)) {
229 "Invalid parameter: value after \"-%1\"")
232 cmd.
print(QString(
"Vertical overlapping ratio weight for final "
233 "segmentation set: %1")
234 .arg(parameters.vertical_weight));
236 cmd.
print(
"Parameters All Set");
243 unsigned count = desc.pc->size();
245 cmd.
print(QString(
"Cloud %1 is empty").arg(desc.pc->getName()));
251 parameters.reg_strength1,
252 parameters.decimate_res1)) {
254 "Failed to finish initial segmentation due to "
258 if (try_intermediate_seg) {
260 parameters.reg_strength2,
261 parameters.decimate_res2,
262 parameters.max_gap)) {
264 "Failed to finish intermediate segmentation due to "
270 parameters.rel_height_length_ratio,
271 parameters.vertical_weight)) {
273 "Failed to finish final segmentation due to "
void convert(int argc, char **argv, const std::string &file_in, const std::string &file_out)
static bool Intermediate_seg_pcd(ccPointCloud *pc, const unsigned PR_MIN_NN2, const float PR_REG_STRENGTH2, const float PR_DECIMATE_RES2, const float PR_MAX_GAP, QProgressDialog *progressDlg=nullptr)
static bool Final_seg_pcd(ccPointCloud *pc, const unsigned PR_MIN_NN3, const float PR_REL_HEIGHT_LENGTH_RATIO, const float PR_VERTICAL_WEIGHT, QProgressDialog *progressDlg=nullptr)
static bool Init_seg_pcd(ccPointCloud *pc, const unsigned min_nn1, const float regStrength1, const float PR_DECIMATE_RES1, QProgressDialog *progressDlg=nullptr)
virtual QStringList & arguments()=0
Returns the list of arguments.
virtual void print(const QString &message) const =0
virtual bool error(const QString &message) const =0
static bool IsCommand(const QString &token, const char *command)
Test whether a command line token is a valid command keyword or not.
virtual std::vector< CLCloudDesc > & clouds()
Currently opened point clouds and their filename.
static const char COMMAND_RHO[]
static const char COMMAND_LAMBDA1[]
static const char COMMAND_DECIMATE_RESOLUTION2[]
static const char COMMAND_LAMBDA2[]
static const char COMMAND_VERTICAL_OVERLAP_WEIGHT[]
static const char COMMAND_K2[]
static const char COMMAND_DECIMATE_RESOLUTION1[]
static const char COMMAND_K1[]
static const char COMMAND_TREEISO[]
static const char COMMAND_MAX_GAP[]
Loaded cloud description.
qTreeIso command line processor
bool process(ccCommandLineInterface &cmd) override
Main process.
Generic command interface.
Command(const QString &name, const QString &keyword)
Default constructor.