TTK
Loading...
Searching...
No Matches
ContourTree.h
Go to the documentation of this file.
1
19
20#pragma once
21
22#include <Triangulation.h>
23#include <UnionFind.h>
24
25#include <vector>
26
27namespace ttk {
28
29 class SubLevelSetTree;
30 class Node;
31
32 class Arc : virtual public Debug {
33 public:
34 inline int getDownNodeId() const {
35 return downNodeId_;
36 }
37
38 inline int getUpNodeId() const {
39 return upNodeId_;
40 }
41
42 inline void setDownNodeId(const int &downNodeId) {
43 downNodeId_ = downNodeId;
44 }
45
46 inline void setUpNodeId(const int &upNodeId) {
47 upNodeId_ = upNodeId;
48 }
49
50 protected:
51 int downNodeId_{-1}, upNodeId_{-1};
52 };
53
54 class SuperArc : public Arc {
55 public:
56 friend class SubLevelSetTree;
57
58 inline void appendRegularNode(const int &nodeId) {
59 regularNodeList_.push_back(nodeId);
60 }
61
62 inline void appendBarycenter(const std::vector<double> &barycenter) {
63 barycenterList_.push_back(barycenter);
64 }
65
66 inline void appendSample(const std::vector<int> &sample) {
67 sampleList_.push_back(sample);
68 }
69
70 inline int getNumberOfRegularNodes() const {
71 return (int)regularNodeList_.size();
72 }
73
74 inline int getNumberOfBarycenters() const {
75 return (int)barycenterList_.size();
76 }
77
78 inline int getNumberOfSamples() const {
79 return (int)sampleList_.size();
80 }
81
82 inline int getRegularNodeId(const int &arcNodeId) const {
83 if((arcNodeId < 0)
84 || (((unsigned int)arcNodeId) >= regularNodeList_.size()))
85 return -1;
86 return regularNodeList_[arcNodeId];
87 }
88
89 inline void getBarycenter(const int &id,
90 std::vector<double> &barycenter) const {
91 for(unsigned int k = 0; k < 3; ++k)
92 barycenter[k] = barycenterList_[id][k];
93 }
94
95 inline void getBarycenter(const int &id, double barycenter[3]) const {
96 for(unsigned int k = 0; k < 3; ++k)
97 barycenter[k] = barycenterList_[id][k];
98 }
99
100 inline void getSample(const int &id, std::vector<int> &sample) const {
101 sample = sampleList_[id];
102 }
103
104 inline void clearBarycenters() {
105 barycenterList_.clear();
106 }
107
108 inline void clearSamples() {
109 sampleList_.clear();
110 }
111
112 inline void clearRegularNodes() {
113 regularNodeList_.clear();
114 }
115
116 inline bool isPruned() const {
117 return pruned_;
118 }
119
120 void smooth(const std::vector<Node> &nodeList,
121 const std::vector<std::vector<double>> *vertexPositions,
122 bool order = true);
123
124 void sortRegularNodes(const std::vector<double> *vertexScalars,
125 const std::vector<int> *vertexOffsets,
126 const std::vector<Node> *nodeList,
127 bool order = true);
128
129 protected:
130 bool pruned_{false};
131 std::vector<int> regularNodeList_{};
132 std::vector<std::vector<double>> barycenterList_{};
133 std::vector<std::vector<int>> sampleList_{};
134 };
135
136 class Node : virtual public Debug {
137 public:
138 inline void addDownArcId(const int &downArcId) {
139 downArcList_.push_back(downArcId);
140 }
141
142 inline void addDownSuperArcId(const int &downSuperArcId) {
143 downSuperArcList_.push_back(downSuperArcId);
144 }
145
146 inline void addUpArcId(const int &upArcId) {
147 upArcList_.push_back(upArcId);
148 }
149
150 inline void addUpSuperArcId(const int &upSuperArcId) {
151 upSuperArcList_.push_back(upSuperArcId);
152 }
153
154 inline int getDownArcId(const int &neighborId) const {
155 if((neighborId < 0) || (neighborId >= (int)downArcList_.size()))
156 return -1;
157 return downArcList_[neighborId];
158 }
159
160 inline int getDownSuperArcId(const int &neighborId) const {
161 if((neighborId < 0) || (neighborId >= (int)downSuperArcList_.size()))
162 return -1;
163 return downSuperArcList_[neighborId];
164 }
165
166 inline int getUpArcId(const int &neighborId) const {
167 if((neighborId < 0) || (neighborId >= (int)upArcList_.size()))
168 return -1;
169 return upArcList_[neighborId];
170 }
171
172 inline int getUpSuperArcId(const int &neighborId) const {
173 if((neighborId < 0) || (neighborId >= (int)upSuperArcList_.size()))
174 return -1;
175 return upSuperArcList_[neighborId];
176 }
177
178 inline int getNumberOfDownArcs() const {
179 return (int)downArcList_.size();
180 }
181
182 inline int getNumberOfDownSuperArcs() const {
183 return (int)downSuperArcList_.size();
184 }
185
186 inline int getNumberOfUpArcs() const {
187 return (int)upArcList_.size();
188 }
189
190 inline int getNumberOfUpSuperArcs() const {
191 return (int)upSuperArcList_.size();
192 }
193
194 inline int getVertexId() const {
195 return vertexId_;
196 }
197
198 inline int removeDownArcId(const int &arcId) {
199 if((arcId < 0) || (arcId >= (int)downArcList_.size()))
200 return -1;
201 downArcList_.erase(downArcList_.begin() + arcId);
202 return 0;
203 }
204
205 inline int removeUpArcId(const int &arcId) {
206 if((arcId < 0) || (arcId >= (int)upArcList_.size()))
207 return -1;
208 upArcList_.erase(upArcList_.begin() + arcId);
209 return 0;
210 }
211
212 inline void setVertexId(const int &vertexId) {
213 vertexId_ = vertexId;
214 }
215
216 protected:
217 friend class SubLevelSetTree;
218
219 int vertexId_{-1};
220 bool pruned_{false};
221 double layoutX_{}, layoutY_{};
222 std::vector<int> downArcList_{}, upArcList_{};
223 std::vector<int> downSuperArcList_{}, upSuperArcList_{};
224 };
225
226 class ContourTreeSimplificationMetric : virtual public Debug {
227 public:
228 friend class SubLevelSetTree;
229
230 virtual double
231 computeSuperArcMetric(const int &downVertexId,
232 const int &upVertexId,
233 const std::vector<int> &interiorNodeIds)
234 = 0;
235
236 protected:
238 };
239
241 public:
242 double
243 computeSuperArcMetric(const int &downVertexId,
244 const int &upVertexId,
245 const std::vector<int> &interiorNodeIds) override;
246 };
247
248 class SubLevelSetTree : virtual public Debug {
249 public:
251
252 int build();
253
254 // the output list is sorted in ascending (respectively descending)
255 // order of function value for the merge tree (respectively for the split
256 // tree)
257 int buildExtremumList(std::vector<int> &extremumList,
258 const bool &isSubLevelSet = true);
259
260 bool buildPlanarLayout(const double &scaleX, const double &scaleY);
261
262 int buildSaddleList(std::vector<int> &vertexList) const;
263
264 int clearArc(const int &vertexId0, const int &vertexId1);
265
266 int clearRegularNode(const int &vertexId);
267
268 int clearRoot(const int &vertexId);
269
270 int exportPersistenceCurve(const std::string &fileName
271 = "output.plot") const;
272
273 int exportPersistenceDiagram(const std::string &fileName
274 = "output.plot") const;
275
276 int exportToSvg(const std::string &fileName,
277 const double &scaleX = 1,
278 const double &scaleY = 1);
279
280 int exportToVtk(const std::string &fileName,
281 // fixes a bug in paraview, the voxel size of the cube file
282 // format is not taken into account...
283 const std::vector<float> *origin = nullptr,
284 const std::vector<float> *voxelSize = nullptr);
285
286 int flush();
287
288 inline const Arc *getArc(const int &arcId) const {
289#ifndef TTK_ENABLE_KAMIKAZE
290 if((arcId < 0) || (arcId >= (int)arcList_.size()))
291 this->printErr("Out-of-bounds access in getArc: element "
292 + std::to_string(arcId) + " in list of size "
293 + std::to_string(arcList_.size()));
294#endif // !TTK_ENABLE_KAMIKAZE
295 return &(arcList_[arcId]);
296 }
297
298 // this list is sorted only if buildExtremumList has been called before.
299 inline const std::vector<int> *getExtremumList() const {
300 if(minimumList_)
301 return minimumList_;
302 return maximumList_;
303 }
304
305 inline const Node *getNode(const int &nodeId) const {
306#ifndef TTK_ENABLE_KAMIKAZE
307 if((nodeId < 0) || (nodeId >= (int)nodeList_.size()))
308 this->printErr("Out-of-bounds access in getNode: element "
309 + std::to_string(nodeId) + " in list of size "
310 + std::to_string(nodeList_.size()));
311#endif // !TTK_ENABLE_KAMIKAZE
312 return &(nodeList_[nodeId]);
313 }
314
315 inline const Node *getNodeDownNeighbor(const Node *n,
316 const int &neighborId) const {
317#ifndef TTK_ENABLE_KAMIKAZE
318 if(n == nullptr)
319 this->printErr("Nullptr dereference in getNodeDownNeighbor");
320#endif // !TTK_ENABLE_KAMIKAZE
321 return getNodeDownNeighbor(n - &(nodeList_[0]), neighborId);
322 }
323
324 inline const Node *getNodeDownNeighbor(const int &nodeId,
325 const int &neighborId) const {
326#ifndef TTK_ENABLE_KAMIKAZE
327 if((nodeId < 0) || (nodeId >= (int)nodeList_.size()))
328 this->printErr("Out-of-bounds access in getNodeDownNeighbor: element "
329 + std::to_string(nodeId) + " in list of size "
330 + std::to_string(nodeList_.size()));
331#endif // !TTK_ENABLE_KAMIKAZE
332 return &(nodeList_[arcList_[nodeList_[nodeId].getDownArcId(neighborId)]
333 .getDownNodeId()]);
334 }
335
336 inline const Node *getNodeUpNeighbor(const Node *n,
337 const int &neighborId) const {
338#ifndef TTK_ENABLE_KAMIKAZE
339 if(n == nullptr)
340 this->printErr("Nullptr dereference in getNodeUpNeighbor");
341#endif // !TTK_ENABLE_KAMIKAZE
342 return getNodeUpNeighbor(n - &(nodeList_[0]), neighborId);
343 }
344
345 inline const Node *getNodeUpNeighbor(const int &nodeId,
346 const int &neighborId) const {
347#ifndef TTK_ENABLE_KAMIKAZE
348 if((nodeId < 0) || (nodeId >= (int)nodeList_.size()))
349 this->printErr("Out-of-bounds access in getNodeUpNeighbor: element "
350 + std::to_string(nodeId) + " in list of size "
351 + std::to_string(nodeList_.size()));
352#endif // !TTK_ENABLE_KAMIKAZE
353 return &(nodeList_[arcList_[nodeList_[nodeId].getUpArcId(neighborId)]
354 .getUpNodeId()]);
355 }
356
357 inline double getNodeScalar(const int &nodeId) const {
358 if(!vertexScalars_)
359 return -DBL_MAX;
360 if((nodeId < 0) || (nodeId >= (int)nodeList_.size()))
361 return -DBL_MAX;
362 return (*vertexScalars_)[nodeList_[nodeId].vertexId_];
363 }
364
365 inline int getNumberOfArcs() const {
366 return (int)arcList_.size();
367 }
368
369 inline int getNumberOfSuperArcs() const {
370 return (int)superArcList_.size();
371 }
372
373 inline int getNumberOfNodes() const {
374 return (int)nodeList_.size();
375 }
376
378 std::vector<std::pair<double, double>> &diagram,
379 std::vector<std::pair<std::pair<int, int>, double>> *pairs
380 = nullptr) const;
381
382 // std::vector:
383 // - vertex std::pair:
384 // - extremum vertex Id (first.first)
385 // - std::paired saddle Id (first.second)
386 // - persistence (second)
387 virtual int getPersistencePairs(
388 std::vector<std::pair<std::pair<int, int>, double>> &pairs,
389 std::vector<std::pair<std::pair<int, int>, double>> *mergePairs = nullptr,
390 std::vector<std::pair<std::pair<int, int>, double>> *splitPairs
391 = nullptr) const;
392
394 std::vector<std::pair<double, int>> &plot,
395 std::vector<std::pair<std::pair<int, int>, double>> *persistencePairs
396 = nullptr) const;
397
398 inline const SuperArc *getSuperArc(const int &superArcId) const {
399#ifndef TTK_ENABLE_KAMIKAZE
400 if((superArcId < 0) || (superArcId >= (int)superArcList_.size()))
401 this->printErr("Out-of-bounds access in getSuperArc: element "
402 + std::to_string(superArcId) + " in list of size "
403 + std::to_string(superArcList_.size()));
404#endif // !TTK_ENABLE_KAMIKAZE
405 return &(superArcList_[superArcId]);
406 }
407
408 inline int getVertexScalar(const int &vertexId, double &scalar) {
409
410#ifndef TTK_ENABLE_KAMIKAZE
411 if(!vertexScalars_)
412 return -1;
413 if((vertexId < 0) || (vertexId >= (int)vertexScalars_->size()))
414 return -2;
415#endif
416
417 scalar = (*vertexScalars_)[vertexId];
418
419 return 0;
420 }
421
422 inline const SuperArc *getVertexSuperArc(const int &vertexId) const {
423#ifndef TTK_ENABLE_KAMIKAZE
424 if((vertexId < 0) || (vertexId >= vertexNumber_))
425 this->printErr("Out-of-bounds access in getVertexSuperArc: element "
426 + std::to_string(vertexId) + " in list of size "
428 if(vertex2superArc_[vertexId] == -1)
429 this->printErr("Invalid super arc id for vertex "
430 + std::to_string(vertexId));
431#endif // !TTK_ENABLE_KAMIKAZE
432
433 return &(superArcList_[vertex2superArc_[vertexId]]);
434 }
435
436 inline int getVertexSuperArcId(const int &vertexId) const {
437#ifndef TTK_ENABLE_KAMIKAZE
438 if((vertexId < 0) || (vertexId >= vertexNumber_))
439 this->printErr("Out-of-bounds access in getVertexSuperArcId: element "
440 + std::to_string(vertexId) + " in list of size "
442#endif // !TTK_ENABLE_KAMIKAZE
443 return vertex2superArc_[vertexId];
444 }
445
446 inline const Node *getVertexNode(const int &vertexId) const {
447#ifndef TTK_ENABLE_KAMIKAZE
448 if((vertexId < 0) || (vertexId >= vertexNumber_))
449 this->printErr("Out-of-bounds access in getVertexNode: element "
450 + std::to_string(vertexId) + " in list of size "
452 if(vertex2node_[vertexId] == -1)
453 this->printErr("Invalid node id value in getVertexNode at index"
454 + std::to_string(vertexId));
455#endif // !TTK_ENABLE_KAMIKAZE
456 return &(nodeList_[vertex2node_[vertexId]]);
457 }
458
459 inline int getVertexNodeId(const int &vertexId) const {
460 if((vertexId < 0) || (vertexId >= vertexNumber_))
461 return -1;
462 return vertex2node_[vertexId];
463 }
464
465 bool isJoinTree() const {
466 return ((maximumList_ == nullptr)
467 || ((maximumList_) && (maximumList_->empty())));
468 }
469
470 bool isSplitTree() const {
471 return ((minimumList_ == nullptr)
472 || ((minimumList_) && (minimumList_->empty())));
473 }
474
475 bool isSosLowerThan(const int &vertexId0, const int &vertexId1) const;
476
477 bool isSosHigherThan(const int &vertexId0, const int &vertexId1) const;
478
479 virtual inline int maintainRegularVertices(const bool &onOff) {
481 return 0;
482 }
483
484 int moveRegularNode(const Node *n,
485 const Node *oldDown,
486 const Node *oldUp,
487 const Node *newDown,
488 const Node *newUp);
489
490 int print() const;
491
492 inline void setMaximumList(std::vector<int> &maximumList) {
493 maximumList_ = &(maximumList);
494 }
495
496 inline void setMinimumList(std::vector<int> &minimumList) {
497 minimumList_ = &(minimumList);
498 }
499
500 inline void setNumberOfVertices(const int &vertexNumber) {
501 vertexNumber_ = vertexNumber;
502 vertex2superArc_.resize(vertexNumber, -1);
503 vertex2superArcNode_.resize(vertexNumber, -1);
504 vertex2node_.resize(vertexNumber, -1);
505 }
506
507 inline void
508 setTriangulation(const AbstractTriangulation *const triangulation) {
509 triangulation_ = triangulation;
510 }
511
512 inline void
513 setVertexPositions(std::vector<std::vector<double>> *vertexPositions) {
514 vertexPositions_ = vertexPositions;
515 }
516
517 inline void setVertexScalars(const std::vector<real> *const vertexScalars) {
518 vertexScalars_ = vertexScalars;
519 minScalar_ = 0, maxScalar_ = 0;
520 for(int i = 0; i < (int)vertexScalars_->size(); i++) {
521 if((!i) || (minScalar_ > (*vertexScalars_)[i])) {
522 minScalar_ = (*vertexScalars_)[i];
523 }
524 if((!i) || (maxScalar_ < (*vertexScalars_)[i])) {
525 maxScalar_ = (*vertexScalars_)[i];
526 }
527 }
528 }
529
530 inline void setVertexSoSoffsets(std::vector<int> *vertexSoSoffsets) {
531 vertexSoSoffsets_ = vertexSoSoffsets;
532 externalOffsets_ = true;
533 }
534
535 virtual int simplify(const double &simplificationThreshold,
536 ContourTreeSimplificationMetric *metric = nullptr);
537
538 int sample(unsigned int samplingLevel = 3);
539 int computeBarycenters();
540
542 const std::vector<double> &scalars,
543 std::vector<std::vector<double>> &skeletonScalars) const;
544 virtual int computeSkeleton(unsigned int arcResolution = 3);
545 virtual int smoothSkeleton(unsigned int skeletonSmoothing);
546 virtual int clearSkeleton();
547
548 protected:
549 int appendRegularNode(const int &superArcId, const int &nodeId);
550
551 int closeSuperArc(const int &superArcId, const int &nodeId);
552
553 int exportNodeColorToVtk(const int &nodeId, std::ofstream &o);
554
555 int exportNodePosToVtk(const int &nodeId,
556 const int &pointId,
557 std::vector<int> &vertexIds,
558 const std::vector<float> *origin,
559 const std::vector<float> *voxelSize,
560 std::ofstream &o);
561
562 int exportArcPosToVtk(const int &arcId,
563 const int &pointId,
564 std::vector<int> &vertexIds,
565 const std::vector<float> *origin,
566 const std::vector<float> *voxelSize,
567 std::ofstream &o);
568
569 int makeArc(const int &nodeId0, const int &nodeId1);
570
571 int makeNode(const int &vertexId);
572
573 int openSuperArc(const int &nodeId);
574
578 const std::vector<real> *vertexScalars_{};
579 std::vector<int> *vertexSoSoffsets_{};
580 bool externalOffsets_{false};
582 std::vector<int> *minimumList_{}, *maximumList_{};
583 std::vector<Node> nodeList_{}, originalNodeList_{};
584 std::vector<Arc> arcList_{};
585 std::vector<SuperArc> superArcList_{}, originalSuperArcList_{};
587 std::vector<std::vector<double>> *vertexPositions_{};
589 };
590
592 public:
593 ContourTree();
594
595 int build();
596
597 inline const SubLevelSetTree *getMergeTree() const {
598 return &mergeTree_;
599 }
600
602 std::vector<std::pair<std::pair<int, int>, double>> &pairs,
603 std::vector<std::pair<std::pair<int, int>, double>> *mergePairs = nullptr,
604 std::vector<std::pair<std::pair<int, int>, double>> *splitPairs
605 = nullptr) const override;
606
608 std::vector<std::pair<double, int>> &plot,
609 std::vector<std::pair<std::pair<int, int>, double>> *mergePairs = nullptr,
610 std::vector<std::pair<std::pair<int, int>, double>> *splitPairs = nullptr,
611 std::vector<std::pair<std::pair<int, int>, double>> *pairs
612 = nullptr) const;
613
615 std::vector<std::pair<double, double>> &diagram,
616 std::vector<std::pair<std::pair<int, int>, double>> *mergePairs = nullptr,
617 std::vector<std::pair<std::pair<int, int>, double>> *splitPairs = nullptr,
618 std::vector<std::pair<std::pair<int, int>, double>> *pairs
619 = nullptr) const;
620
621 inline const SubLevelSetTree *getSplitTree() const {
622 return &splitTree_;
623 }
624
625 inline int maintainRegularVertices(const bool &onOff) override {
628 return 0;
629 }
630
631 int
632 setVertexNeighbors(const std::vector<std::vector<int>> *vertexNeighbors);
633
634 int setVertexNeighbors(const int &vertexId,
635 const std::vector<int> &neighborList);
636
637 int computeSkeleton(unsigned int arcResolution = 3) override;
638 int smoothSkeleton(unsigned int skeletonSmoothing) override;
639 int clearSkeleton() override;
640
641 int simplify(const double &simplificationThreshold,
642 ContourTreeSimplificationMetric *metric = nullptr) override;
643
644 protected:
645 int combineTrees();
646
647 int finalize();
648
649 int finalizeSuperArc(const int &nodeId, const int &arcId);
650
651 bool isNodeEligible(const Node *n) const;
652
654 };
655} // namespace ttk
AbstractTriangulation is an interface class that defines an interface for efficient traversal methods...
void setDownNodeId(const int &downNodeId)
Definition ContourTree.h:42
void setUpNodeId(const int &upNodeId)
Definition ContourTree.h:46
int downNodeId_
Definition ContourTree.h:51
int getUpNodeId() const
Definition ContourTree.h:38
int upNodeId_
Definition ContourTree.h:51
int getDownNodeId() const
Definition ContourTree.h:34
virtual double computeSuperArcMetric(const int &downVertexId, const int &upVertexId, const std::vector< int > &interiorNodeIds)=0
TTK processing package that computes the contour tree of scalar data and more (data segmentation,...
int getPersistenceDiagram(std::vector< std::pair< double, double > > &diagram, std::vector< std::pair< std::pair< int, int >, double > > *mergePairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *splitPairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *pairs=nullptr) const
int setVertexNeighbors(const std::vector< std::vector< int > > *vertexNeighbors)
int setVertexNeighbors(const int &vertexId, const std::vector< int > &neighborList)
int computeSkeleton(unsigned int arcResolution=3) override
int simplify(const double &simplificationThreshold, ContourTreeSimplificationMetric *metric=nullptr) override
int smoothSkeleton(unsigned int skeletonSmoothing) override
const SubLevelSetTree * getMergeTree() const
int maintainRegularVertices(const bool &onOff) override
int getPersistencePlot(std::vector< std::pair< double, int > > &plot, std::vector< std::pair< std::pair< int, int >, double > > *mergePairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *splitPairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *pairs=nullptr) const
bool isNodeEligible(const Node *n) const
SubLevelSetTree mergeTree_
int finalizeSuperArc(const int &nodeId, const int &arcId)
SubLevelSetTree splitTree_
int clearSkeleton() override
const SubLevelSetTree * getSplitTree() const
int getPersistencePairs(std::vector< std::pair< std::pair< int, int >, double > > &pairs, std::vector< std::pair< std::pair< int, int >, double > > *mergePairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *splitPairs=nullptr) const override
Minimalist debugging class.
Definition Debug.h:88
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
Definition Debug.h:149
std::vector< int > downArcList_
int getUpArcId(const int &neighborId) const
std::vector< int > upSuperArcList_
void addDownSuperArcId(const int &downSuperArcId)
int removeDownArcId(const int &arcId)
int getNumberOfUpArcs() const
int getUpSuperArcId(const int &neighborId) const
int getDownArcId(const int &neighborId) const
std::vector< int > downSuperArcList_
double layoutX_
double layoutY_
int getNumberOfDownArcs() const
void addUpSuperArcId(const int &upSuperArcId)
void setVertexId(const int &vertexId)
int getNumberOfDownSuperArcs() const
void addDownArcId(const int &downArcId)
int removeUpArcId(const int &arcId)
int getVertexId() const
int getNumberOfUpSuperArcs() const
std::vector< int > upArcList_
void addUpArcId(const int &upArcId)
int getDownSuperArcId(const int &neighborId) const
double computeSuperArcMetric(const int &downVertexId, const int &upVertexId, const std::vector< int > &interiorNodeIds) override
int clearRoot(const int &vertexId)
int exportPersistenceDiagram(const std::string &fileName="output.plot") const
bool isSosHigherThan(const int &vertexId0, const int &vertexId1) const
int getSkeletonScalars(const std::vector< double > &scalars, std::vector< std::vector< double > > &skeletonScalars) const
void setTriangulation(const AbstractTriangulation *const triangulation)
int moveRegularNode(const Node *n, const Node *oldDown, const Node *oldUp, const Node *newDown, const Node *newUp)
bool isSplitTree() const
void setMaximumList(std::vector< int > &maximumList)
const std::vector< int > * getExtremumList() const
void setNumberOfVertices(const int &vertexNumber)
std::vector< Node > originalNodeList_
int exportToSvg(const std::string &fileName, const double &scaleX=1, const double &scaleY=1)
int getVertexSuperArcId(const int &vertexId) const
std::vector< int > * minimumList_
int clearRegularNode(const int &vertexId)
int appendRegularNode(const int &superArcId, const int &nodeId)
void setMinimumList(std::vector< int > &minimumList)
int getPersistenceDiagram(std::vector< std::pair< double, double > > &diagram, std::vector< std::pair< std::pair< int, int >, double > > *pairs=nullptr) const
const Node * getNode(const int &nodeId) const
int exportPersistenceCurve(const std::string &fileName="output.plot") const
virtual int clearSkeleton()
void setVertexScalars(const std::vector< real > *const vertexScalars)
const AbstractTriangulation * triangulation_
virtual int computeSkeleton(unsigned int arcResolution=3)
int buildSaddleList(std::vector< int > &vertexList) const
std::vector< int > vertex2superArcNode_
std::vector< int > * vertexSoSoffsets_
void setVertexPositions(std::vector< std::vector< double > > *vertexPositions)
std::vector< Arc > arcList_
std::vector< SuperArc > superArcList_
std::vector< SuperArc > originalSuperArcList_
int getNumberOfArcs() const
const Node * getVertexNode(const int &vertexId) const
int getNumberOfNodes() const
int getVertexNodeId(const int &vertexId) const
double getNodeScalar(const int &nodeId) const
std::vector< int > * maximumList_
std::vector< Node > nodeList_
int getNumberOfSuperArcs() const
int exportArcPosToVtk(const int &arcId, const int &pointId, std::vector< int > &vertexIds, const std::vector< float > *origin, const std::vector< float > *voxelSize, std::ofstream &o)
bool isJoinTree() const
int makeNode(const int &vertexId)
virtual int maintainRegularVertices(const bool &onOff)
std::vector< int > vertex2node_
const SuperArc * getSuperArc(const int &superArcId) const
std::vector< std::vector< double > > * vertexPositions_
int sample(unsigned int samplingLevel=3)
int exportNodePosToVtk(const int &nodeId, const int &pointId, std::vector< int > &vertexIds, const std::vector< float > *origin, const std::vector< float > *voxelSize, std::ofstream &o)
int makeArc(const int &nodeId0, const int &nodeId1)
virtual int getPersistencePairs(std::vector< std::pair< std::pair< int, int >, double > > &pairs, std::vector< std::pair< std::pair< int, int >, double > > *mergePairs=nullptr, std::vector< std::pair< std::pair< int, int >, double > > *splitPairs=nullptr) const
int buildExtremumList(std::vector< int > &extremumList, const bool &isSubLevelSet=true)
const SuperArc * getVertexSuperArc(const int &vertexId) const
virtual int simplify(const double &simplificationThreshold, ContourTreeSimplificationMetric *metric=nullptr)
int openSuperArc(const int &nodeId)
const Node * getNodeUpNeighbor(const int &nodeId, const int &neighborId) const
int exportToVtk(const std::string &fileName, const std::vector< float > *origin=nullptr, const std::vector< float > *voxelSize=nullptr)
int getPersistencePlot(std::vector< std::pair< double, int > > &plot, std::vector< std::pair< std::pair< int, int >, double > > *persistencePairs=nullptr) const
void setVertexSoSoffsets(std::vector< int > *vertexSoSoffsets)
const Node * getNodeDownNeighbor(const Node *n, const int &neighborId) const
const Node * getNodeUpNeighbor(const Node *n, const int &neighborId) const
int exportNodeColorToVtk(const int &nodeId, std::ofstream &o)
std::vector< int > vertex2superArc_
int getVertexScalar(const int &vertexId, double &scalar)
int closeSuperArc(const int &superArcId, const int &nodeId)
bool isSosLowerThan(const int &vertexId0, const int &vertexId1) const
bool buildPlanarLayout(const double &scaleX, const double &scaleY)
const Node * getNodeDownNeighbor(const int &nodeId, const int &neighborId) const
const std::vector< real > * vertexScalars_
virtual int smoothSkeleton(unsigned int skeletonSmoothing)
int clearArc(const int &vertexId0, const int &vertexId1)
const Arc * getArc(const int &arcId) const
int getNumberOfRegularNodes() const
Definition ContourTree.h:70
void clearSamples()
void getBarycenter(const int &id, double barycenter[3]) const
Definition ContourTree.h:95
void appendSample(const std::vector< int > &sample)
Definition ContourTree.h:66
int getNumberOfBarycenters() const
Definition ContourTree.h:74
void getSample(const int &id, std::vector< int > &sample) const
int getRegularNodeId(const int &arcNodeId) const
Definition ContourTree.h:82
bool isPruned() const
std::vector< std::vector< double > > barycenterList_
void appendBarycenter(const std::vector< double > &barycenter)
Definition ContourTree.h:62
void smooth(const std::vector< Node > &nodeList, const std::vector< std::vector< double > > *vertexPositions, bool order=true)
std::vector< int > regularNodeList_
void clearBarycenters()
std::vector< std::vector< int > > sampleList_
void getBarycenter(const int &id, std::vector< double > &barycenter) const
Definition ContourTree.h:89
void sortRegularNodes(const std::vector< double > *vertexScalars, const std::vector< int > *vertexOffsets, const std::vector< Node > *nodeList, bool order=true)
int getNumberOfSamples() const
Definition ContourTree.h:78
void clearRegularNodes()
void appendRegularNode(const int &nodeId)
Definition ContourTree.h:58
std::string to_string(__int128)
Definition ripserpy.cpp:99
The Topology ToolKit.