28 "\ttriplclust [options] <infile>\n"
29 "Options (defaults in brackets):\n"
30 "\t-r <radius> radius for point smoothing [2dNN]\n"
31 "\t (can be numeric or multiple of dNN)\n"
32 "\t-k <n> number of neighbours in triplet creation [19]\n"
33 "\t-n <n> number of the best triplets to use [2]\n"
34 "\t-a <alpha> maximum value for the angle between the\n"
35 "\t triplet branches [0.03]\n"
36 "\t-s <scale> scalingfactor for clustering [0.33dNN]\n"
37 "\t (can be numeric or multiple of dNN)\n"
38 "\t-t <dist> best cluster distance [auto]\n"
39 "\t (can be numeric or 'auto')\n"
40 "\t-m <n> minimum number of triplets for a cluster [5]\n"
41 "\t-dmax <n> max gapwidth within a triplet [none]\n"
42 "\t (can be numeric, multiple of dNN or 'none')\n"
43 "\t-link <method> linkage method for clustering [single]\n"
44 "\t (can be 'single', 'complete', 'average')\n"
45 "\t-oprefix <prefix>\n"
46 "\t write result not to stdout, but to <prefix>.csv\n"
47 "\t and (if -gnuplot is set) to <prefix>.gnuplot\n"
48 "\t-gnuplot print result as a gnuplot command\n"
49 "\t-delim <char> single char delimiter for csv input [' ']\n"
50 "\t-skip <n> number of lines skipped at head of infile [0]\n"
52 "\t-vv be more verbose and write debug trace files\n"
54 "\t1.3 from 2019-04-02";
56 int main(
int argc,
char **argv)
61 std::cerr <<
usage << std::endl;
64 const char *infile_name = opt_params.
get_ifname();
70 std::cerr <<
"[Error] no infile given!\n" <<
usage << std::endl;
78 }
catch (
const std::invalid_argument &e) {
79 std::cerr <<
"[Error] in file'" << infile_name <<
"': " << e.what() << std::endl;
84 catch (
const std::length_error &e) {
85 std::cerr <<
"[Error] in file'" << infile_name <<
"': " << e.what() << std::endl;
89 catch (
const std::exception &e) {
90 std::cerr <<
"[Error] cannot read infile '" << infile_name <<
"'! " << e.what() << std::endl;
93 if (cloud_xyz.size() == 0) {
94 std::cerr <<
"[Error] empty cloud in file '" << infile_name <<
"'" << std::endl
95 <<
"maybe you used the wrong delimiter" << std::endl;
102 if (opt_verbose > 0) {
103 std::cout <<
"[Info] computed dnn: " << dnn << std::endl;
107 std::cerr <<
"[Error] dnn computed as zero. "
108 <<
"Suggestion: remove doublets, e.g. with 'sort -u'" << std::endl;
117 if (opt_verbose > 1) {
121 std::cerr <<
"[Error] can't write debug_smoothed.csv" << std::endl;
124 std::cerr <<
"[Error] can't write debug_smoothed.gnuplot" << std::endl;
128 std::vector<triplet> triplets;
143 for (cluster_group::iterator cl = cl_group.begin(); cl != cl_group.end(); ++cl) {
146 cl_group = cleaned_up_cluster_group;
154 if (outfile_prefix) {
156 std::streambuf *backup = std::cout.rdbuf();
158 of.open((std::string(outfile_prefix) +
".csv").c_str());
161 std::cout.rdbuf(of.rdbuf());
165 of.open((std::string(outfile_prefix) +
".gnuplot").c_str());
170 std::cout.rdbuf(backup);