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