TTK
Loading...
Searching...
No Matches
ttkMergeTreeTemporalReductionDecoding.h
Go to the documentation of this file.
1
35
36#pragma once
37
38// VTK Module
39#include <ttkMergeTreeTemporalReductionDecodingModule.h>
40
41// VTK Includes
42#include <ttkAlgorithm.h>
43#include <vtkSmartPointer.h>
44
45/* Note on including VTK modules
46 *
47 * Each VTK module that you include a header from needs to be specified in this
48 * module's vtk.module file, either in the DEPENDS or PRIVATE_DEPENDS (if the
49 * header is included in the cpp file only) sections.
50 *
51 * In order to find the corresponding module, check its location within the VTK
52 * source code. The VTK module name is composed of the path to the header. You
53 * can also find the module name within the vtk.module file located in the same
54 * directory as the header file.
55 *
56 * For example, vtkSphereSource.h is located in directory VTK/Filters/Sources/,
57 * so its corresponding VTK module is called VTK::FiltersSources. In this case,
58 * the vtk.module file would need to be extended to
59 *
60 * NAME
61 * ttkMergeTreeTemporalReductionDecoding
62 * DEPENDS
63 * ttkAlgorithm
64 * VTK::FiltersSources
65 */
66
67// TTK Base Includes
69
70// VTK Includes
71#include <vtkMultiBlockDataSet.h>
72#include <vtkUnstructuredGrid.h>
73
74class TTKMERGETREETEMPORALREDUCTIONDECODING_EXPORT
76 : public ttkAlgorithm // we inherit from the generic ttkAlgorithm class
77 ,
78 protected ttk::MergeTreeTemporalReductionDecoding // and we inherit from the
79 // base class
80{
81private:
82 using idNode = ttk::ftm::idNode;
83
84 // Output options
85 bool OutputTrees = true;
86 bool PlanarLayout = false;
87 bool BranchDecompositionPlanarLayout = false;
88 double BranchSpacing = 1.;
89 bool RescaleTreesIndividually = false;
90 double DimensionSpacing = 1.;
91 int DimensionToShift = 0;
92 double ImportantPairs = 50.;
93 int MaximumImportantPairs = 0;
94 int MinimumImportantPairs = 0;
95 double ImportantPairsSpacing = 1.;
96 double NonImportantPairsSpacing = 1.;
97 double NonImportantPairsProximity = 0.05;
98 std::string ExcludeImportantPairsLower = "";
99 std::string ExcludeImportantPairsHigher = "";
100
101 // ----------------------
102 // Data for visualization
103 // ----------------------
104 // Trees
105 std::vector<vtkUnstructuredGrid *> treesNodes;
106 std::vector<vtkUnstructuredGrid *> treesArcs;
107 std::vector<vtkDataSet *> treesSegmentation;
108 // Output
109 std::vector<std::vector<int>> treesNodeCorrMesh;
110 std::vector<ttk::ftm::MergeTree<double>> intermediateSTrees;
111 std::vector<std::vector<std::tuple<idNode, idNode, double>>> allMatching;
112
113 void setDataVisualization(int numInputs) {
114 // Trees
115 treesNodes = std::vector<vtkUnstructuredGrid *>(numInputs);
116 treesArcs = std::vector<vtkUnstructuredGrid *>(numInputs);
117 treesSegmentation = std::vector<vtkDataSet *>(numInputs);
118 }
119
120 void resetDataVisualization() {
121 setDataVisualization(0);
122 treesNodeCorrMesh = std::vector<std::vector<int>>();
123 intermediateSTrees = std::vector<ttk::ftm::MergeTree<double>>();
124 allMatching
125 = std::vector<std::vector<std::tuple<idNode, idNode, double>>>();
126 }
127
128 bool isDataVisualizationFilled() {
129 return treesNodeCorrMesh.size() != 0 and intermediateSTrees.size() != 0
130 and allMatching.size() != 0;
131 }
132
133public:
138 // Input Options
139 void SetAssignmentSolver(int assignmentSolver) {
140 assignmentSolverID_ = assignmentSolver;
141 Modified();
142 resetDataVisualization();
143 }
145 return assignmentSolverID_;
146 }
147
148 // Output Options
149 vtkSetMacro(OutputTrees, bool);
150 vtkGetMacro(OutputTrees, bool);
151
152 vtkSetMacro(PlanarLayout, bool);
153 vtkGetMacro(PlanarLayout, bool);
154
155 vtkSetMacro(BranchDecompositionPlanarLayout, bool);
156 vtkGetMacro(BranchDecompositionPlanarLayout, bool);
157
158 vtkSetMacro(BranchSpacing, double);
159 vtkGetMacro(BranchSpacing, double);
160
161 vtkSetMacro(RescaleTreesIndividually, bool);
162 vtkGetMacro(RescaleTreesIndividually, bool);
163
164 vtkSetMacro(DimensionSpacing, double);
165 vtkGetMacro(DimensionSpacing, double);
166
167 vtkSetMacro(DimensionToShift, int);
168 vtkGetMacro(DimensionToShift, int);
169
170 vtkSetMacro(ImportantPairs, double);
171 vtkGetMacro(ImportantPairs, double);
172
173 vtkSetMacro(MaximumImportantPairs, int);
174 vtkGetMacro(MaximumImportantPairs, int);
175
176 vtkSetMacro(MinimumImportantPairs, int);
177 vtkGetMacro(MinimumImportantPairs, int);
178
179 vtkSetMacro(ImportantPairsSpacing, double);
180 vtkGetMacro(ImportantPairsSpacing, double);
181
182 vtkSetMacro(NonImportantPairsSpacing, double);
183 vtkGetMacro(NonImportantPairsSpacing, double);
184
185 vtkSetMacro(NonImportantPairsProximity, double);
186 vtkGetMacro(NonImportantPairsProximity, double);
187
188 vtkSetMacro(ExcludeImportantPairsLower, const std::string &);
189 vtkGetMacro(ExcludeImportantPairsLower, std::string);
190
191 vtkSetMacro(ExcludeImportantPairsHigher, const std::string &);
192 vtkGetMacro(ExcludeImportantPairsHigher, std::string);
193
200
201protected:
208
213 int FillInputPortInformation(int port, vtkInformation *info) override;
214
219 int FillOutputPortInformation(int port, vtkInformation *info) override;
220
225 int RequestData(vtkInformation *request,
226 vtkInformationVector **inputVector,
227 vtkInformationVector *outputVector) override;
228
229 template <class dataType>
230 int run(vtkInformationVector *outputVector,
231 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
232 std::vector<std::tuple<double, int, int, int, int>> &coefs,
233 std::vector<bool> &interpolatedTrees);
234
235 template <class dataType>
236 int runCompute(std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
237 std::vector<std::tuple<double, int, int, int, int>> &coefs);
238
239 template <class dataType>
240 int runOutput(vtkInformationVector *outputVector,
241 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> &inputTrees,
242 std::vector<std::tuple<double, int, int, int, int>> &coefs,
243 std::vector<bool> &interpolatedTrees);
244};
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::MergeTreeTemporalReductionDecoding module.
static ttkMergeTreeTemporalReductionDecoding * New()
unsigned int idNode
Node index in vect_nodes_.