CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
stage_plan.h
Go to the documentation of this file.
1
15#ifndef STAGE_PLAN_H
16#define STAGE_PLAN_H
17
18#include <sstream>
19#include <string>
20
21struct StagePlan {
22 // Step D sub-steps
23 bool match = true;
24 bool track = true;
25 bool format = true;
26 // Step E / F
27 bool recon = true;
28 bool deform = true;
29
30 // Optional narrowing for embarrassingly-parallel array tasks.
31 int only_pair = 0;
32 int only_cam = 0;
33
35 bool anyStepD() const { return match || track || format; }
36
54 static bool parse(const std::string& spec, StagePlan& out, std::string* err) {
55 out.match = out.track = out.format = out.recon = out.deform = false;
56 std::stringstream ss(spec);
57 std::string tok;
58 while (std::getline(ss, tok, ',')) {
59 // trim + lowercase
60 size_t b = tok.find_first_not_of(" \t");
61 size_t e = tok.find_last_not_of(" \t");
62 if (b == std::string::npos) continue;
63 tok = tok.substr(b, e - b + 1);
64 for (char& c : tok) c = static_cast<char>(::tolower(c));
65
66 if (tok == "all") {
67 out.match = out.track = out.format = out.recon = out.deform = true;
68 } else if (tok == "d") {
69 out.match = out.track = out.format = true;
70 } else if (tok == "match" || tok == "matching") {
71 out.match = true;
72 } else if (tok == "track" || tok == "tracking") {
73 out.track = true;
74 } else if (tok == "format") {
75 out.format = true;
76 } else if (tok == "e" || tok == "recon") {
77 out.recon = true;
78 } else if (tok == "f" || tok == "deform") {
79 out.deform = true;
80 } else {
81 if (err) *err = "unknown stage token: '" + tok + "'";
82 return false;
83 }
84 }
85 return true;
86 }
87};
88
89#endif // STAGE_PLAN_H
StagePlan — selects which pipeline sub-steps a single process executes.
Definition stage_plan.h:21
int only_pair
0 = all stereopairs; otherwise restrict to this pair
Definition stage_plan.h:31
static bool parse(const std::string &spec, StagePlan &out, std::string *err)
Parse a comma-separated stage spec into out (stage booleans only; only_pair/only_cam are left untouch...
Definition stage_plan.h:54
bool match
ROI/seed + REF->trial matching + camera-to-camera matching.
Definition stage_plan.h:23
bool deform
Step F: deformation / strain.
Definition stage_plan.h:28
bool recon
Step E: 3D reconstruction.
Definition stage_plan.h:27
bool format
combine ncorr outputs -> myDIC2DpairResults
Definition stage_plan.h:25
int only_cam
0 = both cameras; otherwise restrict tracking to this camera id
Definition stage_plan.h:32
bool anyStepD() const
True if any Step-D sub-step is requested.
Definition stage_plan.h:35
bool track
per-camera NCorr tracking
Definition stage_plan.h:24