25 double relativeEpsilon_{10e-1};
26 double meshDiameter_{1};
27 double tolerance_{10e-3};
28 int assignmentMethod_{0};
29 double assignmentPrecision{0.01};
53 assignmentPrecision = p;
57 if(a == 0 || a == 1) {
58 assignmentMethod_ = a;
62 void setWeights(
double PX,
double PY,
double PZ,
double PF) {
71 double maxScalar = d1[0].birth.sfValue;
72 double minScalar = d1[0].birth.sfValue;
74 for(
unsigned int i = 0; i < d1.size(); i++) {
75 maxScalar = std::max(maxScalar, d1[i].birth.sfValue);
76 maxScalar = std::max(maxScalar, d1[i].death.sfValue);
77 minScalar = std::min(minScalar, d1[i].birth.sfValue);
78 minScalar = std::min(minScalar, d1[i].death.sfValue);
81 for(
unsigned int i = 0; i < d2.size(); i++) {
82 maxScalar = std::max(maxScalar, d2[i].birth.sfValue);
83 maxScalar = std::max(maxScalar, d2[i].death.sfValue);
84 minScalar = std::min(minScalar, d2[i].birth.sfValue);
85 minScalar = std::min(minScalar, d2[i].death.sfValue);
88 return std::sqrt(std::pow(meshDiameter_, 2)
89 + fWeight_ * std::pow(maxScalar - minScalar, 2));
94 std::vector<std::vector<MatchingType>> &maximaMatchings,
95 std::vector<std::vector<MatchingType>> &sad_1_Matchings,
96 std::vector<std::vector<MatchingType>> &sad_2_Matchings,
97 std::vector<std::vector<MatchingType>> &minimaMatchings,
98 std::vector<std::vector<SimplexId>> &maxMap,
99 std::vector<std::vector<SimplexId>> &sad_1Map,
100 std::vector<std::vector<SimplexId>> &sad_2Map,
101 std::vector<std::vector<SimplexId>> &minMap);
103 const std::vector<DiagramType> &persistenceDiagrams,
104 const std::vector<std::vector<MatchingType>> &maximaMatchings,
105 const std::vector<std::vector<MatchingType>> &sad_1_Matchings,
106 const std::vector<std::vector<MatchingType>> &sad_2_Matchings,
107 const std::vector<std::vector<MatchingType>> &minimaMatchings,
108 const std::vector<std::vector<SimplexId>> &maxMap,
109 const std::vector<std::vector<SimplexId>> &sad_1Map,
110 const std::vector<std::vector<SimplexId>> &sad_2Map,
111 const std::vector<std::vector<SimplexId>> &minMap,
112 std::vector<trackingTuple> &allTrackings,
113 std::vector<std::vector<double>> &allTrackingsCost,
114 std::vector<std::vector<double>> &allTrackingsInstantPersistences,
115 unsigned int (&typesArrayLimits)[3]);
118 double computeRelevantPersistence(
const DiagramType &d1,
120 const auto sp = this->tolerance_;
121 const double s = sp > 0.0 && sp < 100.0 ? sp / 100.0 : 0;
123 std::vector<double> toSort(d1.size() + d2.size());
124 for(
size_t i = 0; i < d1.size(); ++i) {
125 const auto &t = d1[i];
126 toSort[i] = std::abs(t.persistence());
128 for(
size_t i = 0; i < d2.size(); ++i) {
129 const auto &t = d2[i];
130 toSort[d1.size() + i] = std::abs(t.persistence());
133 const auto minVal = *std::min_element(toSort.begin(), toSort.end());
134 const auto maxVal = *std::max_element(toSort.begin(), toSort.end());
135 return s * (maxVal - minVal);
141 double criticalPointDistance(
const std::array<float, 3> &coords_p1,
142 const double &sfValue_p1,
143 const std::array<float, 3> &coords_p2,
144 const double &sfValue_p2,
150 const double minimumRelevantPersistence,
151 std::vector<std::array<float, 3>> &maxCoords,
152 std::vector<std::array<float, 3>> &sad_1Coords,
153 std::vector<std::array<float, 3>> &sad_2Coords,
154 std::vector<std::array<float, 3>> &minCoords,
155 std::vector<double> &maxScalar,
156 std::vector<double> &sad1Scalar,
157 std::vector<double> &sad_2Scalar,
158 std::vector<double> &minScalar,
159 std::vector<SimplexId> &mapMax,
160 std::vector<SimplexId> &mapSad_1,
161 std::vector<SimplexId> &mapSad_2,
162 std::vector<SimplexId> &mapMin);
164 void buildCostMatrix(
const std::vector<std::array<float, 3>> &coords_1,
165 const std::vector<double> &sfValues_1,
166 const std::vector<std::array<float, 3>> &coords_2,
167 const std::vector<double> &sfValues_2,
168 const float &costDeathBirth,
169 std::vector<std::vector<double>> &matrix);
171 void localToGlobalMatching(
const std::vector<int> &startMap,
172 const std::vector<int> &endMap,
173 const std::vector<double> &startPersistence,
174 const std::vector<double> &endPersistence,
175 std::vector<MatchingType> &matchings,
176 std::vector<MatchingType> &matchingsPersistence);
178 void assignmentSolver(std::vector<std::vector<double>> &costMatrix,
179 std::vector<ttk::MatchingType> &matching);
181 int computeGlobalId(
const DiagramType &persistenceDiagram,
185 void performTrackingForOneType(
186 const std::vector<DiagramType> &persistenceDiagrams,
187 const std::vector<std::vector<MatchingType>> &matching,
188 const std::vector<std::vector<SimplexId>> &map,
190 std::vector<trackingTuple> &tracking,
191 std::vector<std::vector<double>> &trackingCosts,
192 std::vector<std::vector<double>> &trackingsInstantPersistences);