72 bool Epsilon1UseFarthestSaddle =
false;
73 double EpsilonTree1 = 5.;
74 double EpsilonTree2 = 5.;
75 double Epsilon2Tree1 = 95.;
76 double Epsilon2Tree2 = 95.;
77 double Epsilon3Tree1 = 90.;
78 double Epsilon3Tree2 = 90.;
79 double PersistenceThreshold = 0.;
80 bool DeleteMultiPersPairs =
false;
81 bool UseMinMaxPair =
true;
82 bool IsPersistenceDiagram =
false;
87 int AssignmentSolver = 0;
88 bool BranchDecomposition =
true;
89 bool NormalizedWasserstein =
true;
90 bool KeepSubtree =
false;
91 bool oldBD = BranchDecomposition;
92 bool oldNW = NormalizedWasserstein;
93 bool oldKS = KeepSubtree;
94 double JoinSplitMixtureCoefficient = 0.5;
95 int DiagramPairTypes = 0;
96 bool ComputeBarycenter =
false;
97 unsigned int NumberOfBarycenters = 1;
98 double BarycenterSizeLimitPercent = 0.0;
99 bool Deterministic =
false;
101 int branchMetric = 0;
103 double NonMatchingWeight = 1.0;
106 bool OutputTrees =
true;
107 bool OutputSegmentation =
false;
108 bool PlanarLayout =
false;
109 bool BranchDecompositionPlanarLayout =
false;
110 double BranchSpacing = 1.;
111 bool RescaleTreesIndividually =
false;
112 double DimensionSpacing = 1.;
113 int DimensionToShift = 0;
114 double ImportantPairs = 50.;
115 int MaximumImportantPairs = 0;
116 int MinimumImportantPairs = 0;
117 double ImportantPairsSpacing = 1.;
118 double NonImportantPairsSpacing = 1.;
119 double NonImportantPairsProximity = 0.05;
120 bool BarycenterPositionAlpha =
false;
121 std::string ExcludeImportantPairsLower =
"";
122 std::string ExcludeImportantPairsHigher =
"";
128 std::vector<ttk::ftm::MergeTree<double>> intermediateSTrees,
130 std::vector<vtkUnstructuredGrid *> treesNodes, treesNodes2;
131 std::vector<vtkUnstructuredGrid *> treesArcs, treesArcs2;
132 std::vector<vtkDataSet *> treesSegmentation, treesSegmentation2;
135 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>
137 std::vector<std::vector<
138 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>
139 outputMatchingBarycenter, outputMatchingBarycenter2;
142 std::vector<ttk::ftm::MergeTree<double>> barycentersS, barycentersS2;
143 std::vector<int> clusteringAssignment;
146 std::vector<std::vector<int>> trees1NodeCorrMesh, trees2NodeCorrMesh;
149 std::vector<double> finalDistances;
151 void setDataVisualization(
int numInputs,
int numInputs2) {
153 intermediateSTrees = std::vector<ttk::ftm::MergeTree<double>>(numInputs);
154 intermediateSTrees2 = std::vector<ttk::ftm::MergeTree<double>>(numInputs2);
155 treesNodes = std::vector<vtkUnstructuredGrid *>(numInputs);
156 treesNodes2 = std::vector<vtkUnstructuredGrid *>(numInputs2);
157 treesArcs = std::vector<vtkUnstructuredGrid *>(numInputs);
158 treesArcs2 = std::vector<vtkUnstructuredGrid *>(numInputs2);
159 treesSegmentation = std::vector<vtkDataSet *>(numInputs);
160 treesSegmentation2 = std::vector<vtkDataSet *>(numInputs2);
163 outputMatchingBarycenter = std::vector<std::vector<
164 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>(
167 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>(
170 outputMatchingBarycenter2 = std::vector<std::vector<
171 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>(
174 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>(
179 = std::vector<ttk::ftm::MergeTree<double>>(NumberOfBarycenters);
180 clusteringAssignment = std::vector<int>(numInputs, 0);
183 void resetDataVisualization() {
184 setDataVisualization(0, 0);
185 trees1NodeCorrMesh = std::vector<std::vector<int>>();
186 trees2NodeCorrMesh = std::vector<std::vector<int>>();
187 finalDistances = std::vector<double>();
190 bool isDataVisualizationFilled() {
191 return trees1NodeCorrMesh.size() != 0 and finalDistances.size() != 0;
201 Epsilon1UseFarthestSaddle = epsilon1UseFarthestSaddle;
203 resetDataVisualization();
205 vtkGetMacro(Epsilon1UseFarthestSaddle,
bool);
208 EpsilonTree1 = epsilonTree1;
210 resetDataVisualization();
212 vtkGetMacro(EpsilonTree1,
double);
215 Epsilon2Tree1 = epsilon2Tree1;
217 resetDataVisualization();
219 vtkGetMacro(Epsilon2Tree1,
double);
222 Epsilon3Tree1 = epsilon3Tree1;
224 resetDataVisualization();
226 vtkGetMacro(Epsilon3Tree1,
double);
229 PersistenceThreshold = persistenceThreshold;
231 resetDataVisualization();
233 vtkGetMacro(PersistenceThreshold,
double);
236 UseMinMaxPair = useMinMaxPair;
238 resetDataVisualization();
240 vtkGetMacro(UseMinMaxPair,
bool);
243 DeleteMultiPersPairs = deleteMultiPersPairs;
245 resetDataVisualization();
247 vtkGetMacro(DeleteMultiPersPairs,
bool);
252 oldBD = BranchDecomposition;
253 oldNW = NormalizedWasserstein;
256 if(newBackend == 2) {
257 BranchDecomposition = oldBD;
258 NormalizedWasserstein = oldNW;
261 Backend = newBackend;
263 resetDataVisualization();
265 vtkGetMacro(Backend,
int);
269 Alpha = std::min(1 - 1e-6, Alpha);
270 Alpha = std::max(1e-6, Alpha);
272 resetDataVisualization();
274 vtkGetMacro(Alpha,
double);
277 AssignmentSolver = assignmentSolver;
279 resetDataVisualization();
281 vtkGetMacro(AssignmentSolver,
int);
284 BranchDecomposition = branchDecomposition;
286 resetDataVisualization();
288 vtkGetMacro(BranchDecomposition,
bool);
291 Deterministic = deterministic;
293 resetDataVisualization();
295 vtkGetMacro(Deterministic,
bool);
298 NormalizedWasserstein = normalizedWasserstein;
300 resetDataVisualization();
302 vtkGetMacro(NormalizedWasserstein,
bool);
305 KeepSubtree = keepSubtree;
307 resetDataVisualization();
309 vtkGetMacro(KeepSubtree,
bool);
312 JoinSplitMixtureCoefficient = joinSplitMixtureCoefficient;
314 resetDataVisualization();
316 vtkGetMacro(JoinSplitMixtureCoefficient,
double);
319 DiagramPairTypes = diagramPairTypes;
321 resetDataVisualization();
323 vtkGetMacro(DiagramPairTypes,
int);
326 ComputeBarycenter = computeBarycenter;
328 resetDataVisualization();
330 vtkGetMacro(ComputeBarycenter,
bool);
333 NumberOfBarycenters = numberOfBarycenters;
335 resetDataVisualization();
337 vtkGetMacro(NumberOfBarycenters,
unsigned int);
340 BarycenterSizeLimitPercent = percent;
342 resetDataVisualization();
344 vtkGetMacro(BarycenterSizeLimitPercent,
double);
357 NonMatchingWeight = weight;
359 resetDataVisualization();
361 vtkGetMacro(NonMatchingWeight,
double);
364 vtkSetMacro(BarycenterPositionAlpha,
bool);
365 vtkGetMacro(BarycenterPositionAlpha,
bool);
367 vtkSetMacro(OutputTrees,
bool);
368 vtkGetMacro(OutputTrees,
bool);
370 vtkSetMacro(OutputSegmentation,
bool);
371 vtkGetMacro(OutputSegmentation,
bool);
373 vtkSetMacro(PlanarLayout,
bool);
374 vtkGetMacro(PlanarLayout,
bool);
376 vtkSetMacro(BranchDecompositionPlanarLayout,
bool);
377 vtkGetMacro(BranchDecompositionPlanarLayout,
bool);
379 vtkSetMacro(BranchSpacing,
double);
380 vtkGetMacro(BranchSpacing,
double);
382 vtkSetMacro(RescaleTreesIndividually,
bool);
383 vtkGetMacro(RescaleTreesIndividually,
bool);
385 vtkSetMacro(DimensionSpacing,
double);
386 vtkGetMacro(DimensionSpacing,
double);
388 vtkSetMacro(DimensionToShift,
int);
389 vtkGetMacro(DimensionToShift,
int);
391 vtkSetMacro(ImportantPairs,
double);
392 vtkGetMacro(ImportantPairs,
double);
394 vtkSetMacro(MaximumImportantPairs,
int);
395 vtkGetMacro(MaximumImportantPairs,
int);
397 vtkSetMacro(MinimumImportantPairs,
int);
398 vtkGetMacro(MinimumImportantPairs,
int);
400 vtkSetMacro(ImportantPairsSpacing,
double);
401 vtkGetMacro(ImportantPairsSpacing,
double);
403 vtkSetMacro(NonImportantPairsSpacing,
double);
404 vtkGetMacro(NonImportantPairsSpacing,
double);
406 vtkSetMacro(NonImportantPairsProximity,
double);
407 vtkGetMacro(NonImportantPairsProximity,
double);
409 vtkSetMacro(ExcludeImportantPairsLower,
const std::string &);
410 vtkGetMacro(ExcludeImportantPairsLower, std::string);
412 vtkSetMacro(ExcludeImportantPairsHigher,
const std::string &);
413 vtkGetMacro(ExcludeImportantPairsHigher, std::string);
447 vtkInformationVector **inputVector,
448 vtkInformationVector *outputVector)
override;
450 template <
class dataType>
451 int run(vtkInformationVector *outputVector,
455 template <
class dataType>
457 vtkInformationVector *outputVector,
461 template <
class dataType>
463 vtkInformationVector *outputVector,