85 bool Epsilon1UseFarthestSaddle =
false;
86 double EpsilonTree1 = 5.;
87 double EpsilonTree2 = 5.;
88 double Epsilon2Tree1 = 95.;
89 double Epsilon2Tree2 = 95.;
90 double Epsilon3Tree1 = 90.;
91 double Epsilon3Tree2 = 90.;
92 double PersistenceThreshold = 0.;
93 bool DeleteMultiPersPairs =
false;
94 bool UseMinMaxPair =
true;
95 bool IsPersistenceDiagram =
false;
100 int AssignmentSolver = 0;
101 bool BranchDecomposition =
true;
102 bool NormalizedWasserstein =
true;
103 bool KeepSubtree =
false;
104 bool oldBD = BranchDecomposition;
105 bool oldNW = NormalizedWasserstein;
106 bool oldKS = KeepSubtree;
107 double JoinSplitMixtureCoefficient = 0.5;
108 int DiagramPairTypes = 0;
109 bool ComputeBarycenter =
false;
110 bool oldComputeBarycenter = ComputeBarycenter;
111 unsigned int NumberOfBarycenters = 1;
112 double BarycenterSizeLimitPercent = 0.0;
113 bool Deterministic =
false;
115 int branchMetric = 0;
117 bool useMedianBarycenter =
false;
118 bool useFixedInit =
false;
119 int fixedInitNumber = 0;
121 int iterationLimit = 100;
122 double NonMatchingWeight = 1.0;
125 bool OutputTrees =
true;
126 bool OutputSegmentation =
false;
127 bool PlanarLayout =
false;
128 bool BranchDecompositionPlanarLayout =
false;
129 bool PathPlanarLayout =
false;
130 double BranchSpacing = 1.;
131 bool RescaleTreesIndividually =
false;
132 double DimensionSpacing = 1.;
133 int DimensionToShift = 0;
137 double ImportantPairs = 50.;
138 int MaximumImportantPairs = 0;
139 int MinimumImportantPairs = 0;
140 double ImportantPairsSpacing = 1.;
141 double NonImportantPairsSpacing = 1.;
142 double NonImportantPairsProximity = 0.05;
143 bool BarycenterPositionAlpha =
false;
144 std::string ExcludeImportantPairsLower =
"";
145 std::string ExcludeImportantPairsHigher =
"";
151 std::vector<ttk::ftm::MergeTree<double>> intermediateSTrees,
153 std::vector<vtkUnstructuredGrid *> treesNodes, treesNodes2;
154 std::vector<vtkUnstructuredGrid *> treesArcs, treesArcs2;
155 std::vector<vtkDataSet *> treesSegmentation, treesSegmentation2;
158 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>
160 std::vector<std::vector<
161 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>
162 outputMatchingBarycenter, outputMatchingBarycenter2;
163 std::vector<std::vector<
164 std::vector<std::pair<std::pair<ttk::ftm::idNode, ttk::ftm::idNode>,
165 std::pair<ttk::ftm::idNode, ttk::ftm::idNode>>>>>
166 outputMatchings_path;
169 std::vector<ttk::ftm::MergeTree<double>> barycentersS, barycentersS2;
170 std::vector<int> clusteringAssignment;
173 std::vector<std::vector<int>> trees1NodeCorrMesh, trees2NodeCorrMesh;
176 std::vector<double> finalDistances;
178 void setDataVisualization(
int numInputs,
int numInputs2) {
180 intermediateSTrees = std::vector<ttk::ftm::MergeTree<double>>(numInputs);
181 intermediateSTrees2 = std::vector<ttk::ftm::MergeTree<double>>(numInputs2);
182 treesNodes = std::vector<vtkUnstructuredGrid *>(numInputs);
183 treesNodes2 = std::vector<vtkUnstructuredGrid *>(numInputs2);
184 treesArcs = std::vector<vtkUnstructuredGrid *>(numInputs);
185 treesArcs2 = std::vector<vtkUnstructuredGrid *>(numInputs2);
186 treesSegmentation = std::vector<vtkDataSet *>(numInputs);
187 treesSegmentation2 = std::vector<vtkDataSet *>(numInputs2);
190 outputMatchingBarycenter = std::vector<std::vector<
191 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>(
194 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>(
196 outputMatchingBarycenter2 = std::vector<std::vector<
197 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>>(
200 std::vector<std::tuple<ttk::ftm::idNode, ttk::ftm::idNode, double>>>(
202 outputMatchings_path = std::vector<std::vector<
203 std::vector<std::pair<std::pair<ttk::ftm::idNode, ttk::ftm::idNode>,
204 std::pair<ttk::ftm::idNode, ttk::ftm::idNode>>>>>(
207 std::vector<std::pair<std::pair<ttk::ftm::idNode, ttk::ftm::idNode>,
208 std::pair<ttk::ftm::idNode, ttk::ftm::idNode>>>>(
213 = std::vector<ttk::ftm::MergeTree<double>>(NumberOfBarycenters);
214 clusteringAssignment = std::vector<int>(numInputs, 0);
217 void resetDataVisualization() {
218 setDataVisualization(0, 0);
219 trees1NodeCorrMesh = std::vector<std::vector<int>>();
220 trees2NodeCorrMesh = std::vector<std::vector<int>>();
221 finalDistances = std::vector<double>();
224 bool isDataVisualizationFilled() {
225 return trees1NodeCorrMesh.size() != 0 and finalDistances.size() != 0;
235 Epsilon1UseFarthestSaddle = epsilon1UseFarthestSaddle;
237 resetDataVisualization();
239 vtkGetMacro(Epsilon1UseFarthestSaddle,
bool);
242 EpsilonTree1 = epsilonTree1;
244 resetDataVisualization();
246 vtkGetMacro(EpsilonTree1,
double);
249 Epsilon2Tree1 = epsilon2Tree1;
251 resetDataVisualization();
253 vtkGetMacro(Epsilon2Tree1,
double);
256 Epsilon3Tree1 = epsilon3Tree1;
258 resetDataVisualization();
260 vtkGetMacro(Epsilon3Tree1,
double);
263 PersistenceThreshold = persistenceThreshold;
265 resetDataVisualization();
267 vtkGetMacro(PersistenceThreshold,
double);
270 UseMinMaxPair = useMinMaxPair;
272 resetDataVisualization();
274 vtkGetMacro(UseMinMaxPair,
bool);
277 DeleteMultiPersPairs = deleteMultiPersPairs;
279 resetDataVisualization();
281 vtkGetMacro(DeleteMultiPersPairs,
bool);
286 oldBD = BranchDecomposition;
287 oldNW = NormalizedWasserstein;
290 if(newBackend == 2) {
291 BranchDecomposition = oldBD;
292 NormalizedWasserstein = oldNW;
295 if(Backend == 1 or Backend == 3)
296 ComputeBarycenter = oldComputeBarycenter;
297 if(newBackend == 1 or newBackend == 3) {
298 oldComputeBarycenter = ComputeBarycenter;
299 ComputeBarycenter =
false;
301 Backend = newBackend;
303 resetDataVisualization();
305 vtkGetMacro(Backend,
int);
309 Alpha = std::min(1 - 1e-6, Alpha);
310 Alpha = std::max(1e-6, Alpha);
312 resetDataVisualization();
314 vtkGetMacro(Alpha,
double);
317 AssignmentSolver = assignmentSolver;
319 resetDataVisualization();
321 vtkGetMacro(AssignmentSolver,
int);
324 BranchDecomposition = branchDecomposition;
326 resetDataVisualization();
328 vtkGetMacro(BranchDecomposition,
bool);
331 Deterministic = deterministic;
333 resetDataVisualization();
335 vtkGetMacro(Deterministic,
bool);
338 NormalizedWasserstein = normalizedWasserstein;
340 resetDataVisualization();
342 vtkGetMacro(NormalizedWasserstein,
bool);
345 KeepSubtree = keepSubtree;
347 resetDataVisualization();
349 vtkGetMacro(KeepSubtree,
bool);
352 JoinSplitMixtureCoefficient = joinSplitMixtureCoefficient;
354 resetDataVisualization();
356 vtkGetMacro(JoinSplitMixtureCoefficient,
double);
359 DiagramPairTypes = diagramPairTypes;
361 resetDataVisualization();
363 vtkGetMacro(DiagramPairTypes,
int);
366 ComputeBarycenter = computeBarycenter;
368 resetDataVisualization();
370 vtkGetMacro(ComputeBarycenter,
bool);
373 NumberOfBarycenters = numberOfBarycenters;
375 resetDataVisualization();
377 vtkGetMacro(NumberOfBarycenters,
unsigned int);
380 BarycenterSizeLimitPercent = percent;
382 resetDataVisualization();
384 vtkGetMacro(BarycenterSizeLimitPercent,
double);
389 resetDataVisualization();
395 resetDataVisualization();
399 useMedianBarycenter = useMedian;
401 resetDataVisualization();
407 resetDataVisualization();
411 fixedInitNumber = fi;
413 resetDataVisualization();
425 resetDataVisualization();
429 NonMatchingWeight = weight;
431 resetDataVisualization();
433 vtkGetMacro(NonMatchingWeight,
double);
436 vtkSetMacro(BarycenterPositionAlpha,
bool);
437 vtkGetMacro(BarycenterPositionAlpha,
bool);
439 vtkSetMacro(OutputTrees,
bool);
440 vtkGetMacro(OutputTrees,
bool);
442 vtkSetMacro(OutputSegmentation,
bool);
443 vtkGetMacro(OutputSegmentation,
bool);
445 vtkSetMacro(PlanarLayout,
bool);
446 vtkGetMacro(PlanarLayout,
bool);
448 vtkSetMacro(BranchDecompositionPlanarLayout,
bool);
449 vtkGetMacro(BranchDecompositionPlanarLayout,
bool);
451 vtkSetMacro(PathPlanarLayout,
bool);
452 vtkGetMacro(PathPlanarLayout,
bool);
454 vtkSetMacro(BranchSpacing,
double);
455 vtkGetMacro(BranchSpacing,
double);
457 vtkSetMacro(RescaleTreesIndividually,
bool);
458 vtkGetMacro(RescaleTreesIndividually,
bool);
460 vtkSetMacro(DimensionSpacing,
double);
461 vtkGetMacro(DimensionSpacing,
double);
463 vtkSetMacro(DimensionToShift,
int);
464 vtkGetMacro(DimensionToShift,
int);
466 vtkSetMacro(XShift,
double);
467 vtkGetMacro(XShift,
double);
469 vtkSetMacro(YShift,
double);
470 vtkGetMacro(YShift,
double);
472 vtkSetMacro(ZShift,
double);
473 vtkGetMacro(ZShift,
double);
475 vtkSetMacro(ImportantPairs,
double);
476 vtkGetMacro(ImportantPairs,
double);
478 vtkSetMacro(MaximumImportantPairs,
int);
479 vtkGetMacro(MaximumImportantPairs,
int);
481 vtkSetMacro(MinimumImportantPairs,
int);
482 vtkGetMacro(MinimumImportantPairs,
int);
484 vtkSetMacro(ImportantPairsSpacing,
double);
485 vtkGetMacro(ImportantPairsSpacing,
double);
487 vtkSetMacro(NonImportantPairsSpacing,
double);
488 vtkGetMacro(NonImportantPairsSpacing,
double);
490 vtkSetMacro(NonImportantPairsProximity,
double);
491 vtkGetMacro(NonImportantPairsProximity,
double);
493 vtkSetMacro(ExcludeImportantPairsLower,
const std::string &);
494 vtkGetMacro(ExcludeImportantPairsLower, std::string);
496 vtkSetMacro(ExcludeImportantPairsHigher,
const std::string &);
497 vtkGetMacro(ExcludeImportantPairsHigher, std::string);
531 vtkInformationVector **inputVector,
532 vtkInformationVector *outputVector)
override;
534 template <
class dataType>
535 int run(vtkInformationVector *outputVector,
539 template <
class dataType>
541 vtkInformationVector *outputVector,
545 template <
class dataType>
547 vtkInformationVector *outputVector,