TTK
Loading...
Searching...
No Matches
ttkMergeTreeAutoencoder.h
Go to the documentation of this file.
1
44
45#pragma once
46
47// VTK Module
48#include <ttkMergeTreeAutoencoderModule.h>
49
50// VTK Includes
51#include <ttkAlgorithm.h>
52#include <vtkMultiBlockDataSet.h>
53#include <vtkUnstructuredGrid.h>
54
55// TTK Base Includes
56#include <FTMTree.h>
58
59class TTKMERGETREEAUTOENCODER_EXPORT ttkMergeTreeAutoencoder
60 : public ttkAlgorithm // we inherit from the generic ttkAlgorithm class
61 ,
62 protected ttk::MergeTreeAutoencoder // and we inherit from the base class
63{
64private:
69 // Input options
70 double oldEpsilonTree1;
71
72 // ----------------------
73 // Data for visualization
74 // ----------------------
75 // Trees
76 std::vector<ttk::ftm::MergeTree<double>> intermediateDTrees;
77 std::vector<vtkUnstructuredGrid *> treesNodes, treesNodes2;
78 std::vector<vtkUnstructuredGrid *> treesArcs, treesArcs2;
79 std::vector<vtkDataSet *> treesSegmentation, treesSegmentation2;
80
81 void setDataVisualization(int ttkNotUsed(numInputs),
82 int ttkNotUsed(numInputs2)) {
83 }
84
85 void resetDataVisualization() {
86 setDataVisualization(0, 0);
87 treesSegmentation.clear();
88 treesSegmentation2.clear();
89 }
90
91public:
96 // Input Options
97 using vtkAlgorithm::SetInputArrayToProcess;
98 void SetInputArrayToProcess(const char *name) {
99 vtkAlgorithm::SetInputArrayToProcess(0, 2, 0, 6, name);
100 }
101
102 void SetDoCompute(bool doCompute) {
103 doCompute_ = doCompute;
104 Modified();
105 resetDataVisualization();
106 }
108 return doCompute_;
109 }
110
112 normalizedWasserstein_ = nW;
113 Modified();
114 resetDataVisualization();
115 }
119
120 void SetNumberOfEncoderLayers(unsigned int numberOfEncoderLayers) {
121 encoderNoLayers_ = numberOfEncoderLayers;
122 Modified();
123 resetDataVisualization();
124 }
126 return encoderNoLayers_;
127 }
128
129 void SetScaleLayerAfterLatent(unsigned int scaleLayerAfterLatent) {
130 scaleLayerAfterLatent_ = scaleLayerAfterLatent;
131 Modified();
132 resetDataVisualization();
133 }
136 }
137
138 void SetInputNumberOfAxes(unsigned int numberOfAxes) {
139 inputNumberOfAxes_ = numberOfAxes;
140 Modified();
141 resetDataVisualization();
142 }
143 unsigned int GetInputNumberOfAxes() {
144 return inputNumberOfAxes_;
145 }
146
147 void SetInputOriginPrimeSizePercent(double originSize) {
148 inputOriginPrimeSizePercent_ = originSize;
149 Modified();
150 resetDataVisualization();
151 }
155
156 // Latent space number of axes
157 void SetNumberOfAxes(unsigned int numberOfAxes) {
158 numberOfAxes_ = numberOfAxes;
159 Modified();
160 resetDataVisualization();
161 }
162 unsigned int GetNumberOfAxes() {
163 return numberOfAxes_;
164 }
165
166 void SetLatentSpaceOriginPrimeSizePercent(double originSize) {
167 latentSpaceOriginPrimeSizePercent_ = originSize;
168 Modified();
169 resetDataVisualization();
170 }
174
175 void SetNumberOfProjectionSteps(unsigned int noSteps) {
176 k_ = noSteps;
177 Modified();
178 resetDataVisualization();
179 }
181 return k_;
182 }
183
184 void SetBarycenterSizeLimitPercent(double percent) {
185 barycenterSizeLimitPercent_ = percent;
186 Modified();
187 resetDataVisualization();
188 }
192
193 void SetMinIteration(unsigned int minIteration) {
194 minIteration_ = minIteration;
195 Modified();
196 resetDataVisualization();
197 }
198 unsigned int GetMinIteration() {
199 return minIteration_;
200 }
201
202 void SetMaxIteration(unsigned int maxIteration) {
203 maxIteration_ = maxIteration;
204 Modified();
205 resetDataVisualization();
206 }
207 unsigned int GetMaxIteration() {
208 return maxIteration_;
209 }
210
211 void SetIterationGap(unsigned int iterationGap) {
212 iterationGap_ = iterationGap;
213 Modified();
214 resetDataVisualization();
215 }
217 return iterationGap_;
218 }
219
220 void SetBatchSize(double bs) {
221 batchSize_ = bs;
222 Modified();
223 resetDataVisualization();
224 }
225 double GetBatchSize() {
226 return batchSize_;
227 }
228
229 void SetOptimizer(int optimizer) {
230 optimizer_ = optimizer;
231 Modified();
232 resetDataVisualization();
233 }
235 return optimizer_;
236 }
237
238 void SetGradientStepSize(double lr) {
239 gradientStepSize_ = lr;
240 Modified();
241 resetDataVisualization();
242 }
244 return gradientStepSize_;
245 }
246
247 void SetBeta1(double beta) {
248 beta1_ = beta;
249 Modified();
250 resetDataVisualization();
251 }
252 double GetBeta1() {
253 return beta1_;
254 }
255
256 void SetBeta2(double beta) {
257 beta2_ = beta;
258 Modified();
259 resetDataVisualization();
260 }
261 double GetBeta2() {
262 return beta2_;
263 }
264
265 void SetReconstructionLossWeight(double reconstructionLossWeight) {
266 reconstructionLossWeight_ = reconstructionLossWeight;
267 Modified();
268 resetDataVisualization();
269 }
273
274 void SetTrackingLossWeight(double trackingLossWeight) {
275 trackingLossWeight_ = trackingLossWeight;
276 Modified();
277 resetDataVisualization();
278 }
280 return trackingLossWeight_;
281 }
282
283 void SetMetricLossWeight(double metricLossWeight) {
284 metricLossWeight_ = metricLossWeight;
285 Modified();
286 resetDataVisualization();
287 }
289 return metricLossWeight_;
290 }
291
292 void SetClusteringLossWeight(double clusteringLossWeight) {
293 clusteringLossWeight_ = clusteringLossWeight;
294 Modified();
295 resetDataVisualization();
296 }
299 }
300
301 void SetCustomLossSpace(bool customLossSpace) {
302 customLossSpace_ = customLossSpace;
303 Modified();
304 resetDataVisualization();
305 }
307 return customLossSpace_;
308 }
309
310 void SetCustomLossActivate(bool customLossActivate) {
311 customLossActivate_ = customLossActivate;
312 Modified();
313 resetDataVisualization();
314 }
316 return customLossActivate_;
317 }
318
319 void SetNormalizeMetricLoss(bool normalizeMetricLoss) {
320 normalizeMetricLoss_ = normalizeMetricLoss;
321 Modified();
322 resetDataVisualization();
323 }
327
328 void SetClusteringLossTemperature(double clusteringLossTemperature) {
329 clusteringLossTemp_ = clusteringLossTemperature;
330 Modified();
331 resetDataVisualization();
332 }
336
337 void SetCustomLossDynamicWeight(bool customLossDynamicWeight) {
338 customLossDynamicWeight_ = customLossDynamicWeight;
339 Modified();
340 resetDataVisualization();
341 }
345
346 void SetNumberOfInit(unsigned int noInit) {
347 noInit_ = noInit;
348 Modified();
349 resetDataVisualization();
350 }
351 unsigned int GetNumberOfInit() {
352 return noInit_;
353 }
354
355 void SetEuclideanVectorsInit(bool euclideanVectorsInit) {
356 euclideanVectorsInit_ = euclideanVectorsInit;
357 Modified();
358 resetDataVisualization();
359 }
363
364 void SetInitOriginPrimeStructByCopy(bool initOriginPrimeStructByCopy) {
365 initOriginPrimeStructByCopy_ = initOriginPrimeStructByCopy;
366 Modified();
367 resetDataVisualization();
368 }
372
373 void SetTrackingLossDecoding(double trackingLossDecoding) {
374 trackingLossDecoding_ = trackingLossDecoding;
375 Modified();
376 resetDataVisualization();
377 }
380 }
381
382 void SetTrackingLossInitRandomness(double trackingLossInitRandomness) {
383 trackingLossInitRandomness_ = trackingLossInitRandomness;
384 Modified();
385 resetDataVisualization();
386 }
390
391 void SetDeterministic(bool deterministic) {
392 deterministic_ = deterministic;
393 Modified();
394 resetDataVisualization();
395 }
397 return deterministic_;
398 }
399
400 void SetActivate(bool activate) {
401 activate_ = activate;
402 Modified();
403 resetDataVisualization();
404 }
405 bool GetActivate() {
406 return activate_;
407 }
408
409 void SetActivationFunction(unsigned int activationFunction) {
410 activationFunction_ = activationFunction;
411 Modified();
412 resetDataVisualization();
413 }
414 unsigned int GetActivationFunction() {
415 return activationFunction_;
416 }
417
418 void SetFullSymmetricAE(bool fullSymmetricAE) {
419 fullSymmetricAE_ = fullSymmetricAE;
420 Modified();
421 resetDataVisualization();
422 }
424 return fullSymmetricAE_;
425 }
426
427 void SetActivateOutputInit(bool activateOutputInit) {
428 activateOutputInit_ = activateOutputInit;
429 Modified();
430 resetDataVisualization();
431 }
433 return activateOutputInit_;
434 }
435
436 void SetJoinSplitMixtureCoefficient(double joinSplitMixtureCoefficient) {
437 mixtureCoefficient_ = joinSplitMixtureCoefficient;
438 Modified();
439 resetDataVisualization();
440 }
444
445 void SetEpsilon1UseFarthestSaddle(bool epsilon1UseFarthestSaddle) {
446 epsilon1UseFarthestSaddle_ = epsilon1UseFarthestSaddle;
447 Modified();
448 resetDataVisualization();
449 }
453
454 void SetEpsilonTree1(double epsilonTree1) {
455 epsilonTree1_ = epsilonTree1;
456 oldEpsilonTree1 = epsilonTree1_;
457 Modified();
458 resetDataVisualization();
459 }
461 return epsilonTree1_;
462 }
463
464 void SetEpsilon2Tree1(double epsilon2Tree1) {
465 epsilon2Tree1_ = epsilon2Tree1;
466 Modified();
467 resetDataVisualization();
468 }
470 return epsilon2Tree1_;
471 }
472
473 void SetEpsilon3Tree1(double epsilon3Tree1) {
474 epsilon3Tree1_ = epsilon3Tree1;
475 Modified();
476 resetDataVisualization();
477 }
479 return epsilon3Tree1_;
480 }
481
482 void SetPersistenceThreshold(double persistenceThreshold) {
483 persistenceThreshold_ = persistenceThreshold;
484 Modified();
485 resetDataVisualization();
486 }
489 }
490
491 void SetDeleteMultiPersPairs(bool delMultiPersPairs) {
492 deleteMultiPersPairs_ = delMultiPersPairs;
493 Modified();
494 resetDataVisualization();
495 }
499
500 // Testing options
501 void SetNodePerTask(int nodePerTask) {
502 nodePerTask_ = nodePerTask;
503 Modified();
504 resetDataVisualization();
505 }
507 return nodePerTask_;
508 }
509
510 // Output options
511 void SetCreateOutput(bool createOutput) {
512 createOutput_ = createOutput;
513 Modified();
514 resetDataVisualization();
515 }
517 return createOutput_;
518 }
519
526
527protected:
533
538 int FillInputPortInformation(int port, vtkInformation *info) override;
539
544 int FillOutputPortInformation(int port, vtkInformation *info) override;
545
550 int RequestData(vtkInformation *request,
551 vtkInformationVector **inputVector,
552 vtkInformationVector *outputVector) override;
553
554 int run(vtkInformationVector *outputVector,
555 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
556 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees2);
557
559 vtkInformationVector *outputVector,
560 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
561 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees2);
562
564 vtkInformationVector *outputVector,
565 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
566 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees2);
567};
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
Definition BaseClass.h:47
Baseclass of all VTK filters that wrap ttk modules.
virtual int RequestData(vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
int FillInputPortInformation(int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
int FillOutputPortInformation(int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
TTK VTK-filter that wraps the ttk::MergeTreeAutoencoder module.
void SetJoinSplitMixtureCoefficient(double joinSplitMixtureCoefficient)
void SetInitOriginPrimeStructByCopy(bool initOriginPrimeStructByCopy)
void SetCreateOutput(bool createOutput)
void SetEuclideanVectorsInit(bool euclideanVectorsInit)
void SetLatentSpaceOriginPrimeSizePercent(double originSize)
void SetClusteringLossWeight(double clusteringLossWeight)
void SetEpsilon3Tree1(double epsilon3Tree1)
void SetMinIteration(unsigned int minIteration)
void SetCustomLossSpace(bool customLossSpace)
void SetActivationFunction(unsigned int activationFunction)
void SetCustomLossActivate(bool customLossActivate)
static ttkMergeTreeAutoencoder * New()
void SetNodePerTask(int nodePerTask)
void SetScaleLayerAfterLatent(unsigned int scaleLayerAfterLatent)
void SetNumberOfInit(unsigned int noInit)
void SetNumberOfEncoderLayers(unsigned int numberOfEncoderLayers)
void SetMaxIteration(unsigned int maxIteration)
void SetDeleteMultiPersPairs(bool delMultiPersPairs)
void SetDoCompute(bool doCompute)
void SetReconstructionLossWeight(double reconstructionLossWeight)
void SetDeterministic(bool deterministic)
void SetNormalizeMetricLoss(bool normalizeMetricLoss)
void SetInputOriginPrimeSizePercent(double originSize)
int run(vtkInformationVector *outputVector, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees2)
void SetInputArrayToProcess(const char *name)
void SetFullSymmetricAE(bool fullSymmetricAE)
void SetClusteringLossTemperature(double clusteringLossTemperature)
void SetTrackingLossDecoding(double trackingLossDecoding)
void SetEpsilon2Tree1(double epsilon2Tree1)
int runCompute(vtkInformationVector *outputVector, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees2)
void SetTrackingLossWeight(double trackingLossWeight)
void SetNumberOfAxes(unsigned int numberOfAxes)
void SetNumberOfProjectionSteps(unsigned int noSteps)
void SetBarycenterSizeLimitPercent(double percent)
void SetIterationGap(unsigned int iterationGap)
int runOutput(vtkInformationVector *outputVector, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees, std::vector< vtkSmartPointer< vtkMultiBlockDataSet > > &inputTrees2)
void SetEpsilon1UseFarthestSaddle(bool epsilon1UseFarthestSaddle)
void SetTrackingLossInitRandomness(double trackingLossInitRandomness)
void SetEpsilonTree1(double epsilonTree1)
void SetCustomLossDynamicWeight(bool customLossDynamicWeight)
void SetPersistenceThreshold(double persistenceThreshold)
void SetActivateOutputInit(bool activateOutputInit)
void SetInputNumberOfAxes(unsigned int numberOfAxes)
void SetMetricLossWeight(double metricLossWeight)