14 template <
class dataType>
19 dataType tree1NodeDeath
21 dataType tree2NodeDeath
23 return tree1NodeDeath > tree2NodeDeath;
29 template <
class dataType>
36 return getMin ? 0.0 : 1.0;
39 std::tuple<dataType, dataType> birthDeath
52 return getMin ? std::get<0>(birthDeath) : std::get<1>(birthDeath);
55 template <
class dataType>
58 dataType min = getMinMaxLocal<dataType>(tree, nodeId);
59 dataType max = getMinMaxLocal<dataType>(tree, nodeId,
false);
60 return std::make_tuple(min, max);
63 template <
class dataType>
64 std::tuple<double, double>
67 dataType newMin = 0.0,
68 dataType newMax = 1.0) {
70 double birth = std::get<0>(birthDeath);
71 double death = std::get<1>(birthDeath);
72 dataType shiftMin = getMinMaxLocal<dataType>(tree, nodeId);
73 dataType shiftMax = getMinMaxLocal<dataType>(tree, nodeId,
false);
74 if((shiftMax - shiftMin) == 0)
75 return std::make_tuple(0, 0);
76 birth = (newMax - newMin) * (birth - shiftMin)
77 / (shiftMax - shiftMin);
78 death = (newMax - newMin) * (death - shiftMin)
79 / (shiftMax - shiftMin);
80 return std::make_tuple(birth, death);
83 template <
class dataType>
86 dataType newMin = 0.0,
90 dataType birth = std::get<0>(birthDeath);
91 dataType death = std::get<1>(birthDeath);
92 dataType shiftMin = getMinMaxLocal<dataType>(tree, nodeId);
93 dataType shiftMax = getMinMaxLocal<dataType>(tree, nodeId,
false);
94 if((shiftMax - shiftMin) == 0)
95 return std::make_tuple(0, 0);
96 birth = (newMax - newMin) * (birth - shiftMin)
97 / (shiftMax - shiftMin);
98 death = (newMax - newMin) * (death - shiftMin)
99 / (shiftMax - shiftMin);
100 return std::make_tuple(birth, death);
103 template <
class dataType>
106 return normalize ? getNormalizedBirthDeath<dataType>(tree, node)
110 template <
class dataType>
113 std::vector<dataType> &scalarsVector,
114 bool getMin =
true) {
118 return getMin ? 0.0 : 1.0;
121 dataType death = scalarsVector[nodeIdParent];
122 dataType birth = scalarsVector[tree->
getNode(nodeIdParent)->getOrigin()];
124 dataType temp = death;
129 return getMin ? birth : death;
135 template <
class dataType>
136 std::shared_ptr<ftm::FTMTree_MT>
138 std::vector<SimplexId> &nodes,
139 std::vector<std::tuple<ftm::idNode, ftm::idNode>> &arcs) {
141 auto scalars = std::make_shared<ftm::Scalars>();
142 scalars->size = nodes.size();
143 scalars->values = (
void *)nodesScalar;
146 auto params = std::make_shared<ftm::Params>();
156 for(std::tuple<ftm::idNode, ftm::idNode> arc : arcs)
157 tree->makeSuperArc(std::get<0>(arc), std::get<1>(arc));
162 template <
class dataType>
163 ftm::MergeTree<dataType>
165 std::vector<std::tuple<ftm::idNode, ftm::idNode>> &arcs) {
167 = ttk::ftm::createEmptyMergeTree<dataType>(scalarsVector.size());
168 ttk::ftm::setTreeScalars<dataType>(mergeTree, scalarsVector);
172 for(
unsigned int i = 0; i < scalarsVector.size(); ++i)
176 for(std::tuple<ftm::idNode, ftm::idNode> arc : arcs)
bool notNeedToNormalize(idNode nodeId)
std::tuple< dataType, dataType > getBirthDeath(idNode nodeId)
bool isParentInconsistent(ftm::idNode nodeId)
idNode getParentSafe(idNode nodeId)
std::stringstream printNode2(idNode nodeId, bool doPrint=true)
idNode makeNode(SimplexId vertexId, SimplexId linked=nullVertex)
idSuperArc makeSuperArc(idNode downNodeId, idNode upNodeId)
Node * getNode(idNode nodeId)
std::stringstream printTree(bool doPrint=true)
unsigned int idNode
Node index in vect_nodes_.
dataType getMinMaxLocalFromVector(ftm::FTMTree_MT *tree, ftm::idNode nodeId, std::vector< dataType > &scalarsVector, bool getMin=true)
std::shared_ptr< ftm::FTMTree_MT > makeFakeTree(dataType *nodesScalar, std::vector< SimplexId > &nodes, std::vector< std::tuple< ftm::idNode, ftm::idNode > > &arcs)
ftm::MergeTree< dataType > makeFakeMergeTree(std::vector< dataType > &scalarsVector, std::vector< std::tuple< ftm::idNode, ftm::idNode > > &arcs)
std::tuple< double, double > getNormalizedBirthDeathDouble(ftm::FTMTree_MT *tree, ftm::idNode nodeId, dataType newMin=0.0, dataType newMax=1.0)
dataType getMinMaxLocal(ftm::FTMTree_MT *tree, ftm::idNode nodeId, bool getMin=true)
std::tuple< dataType, dataType > getMinMaxLocalT(ftm::FTMTree_MT *tree, ftm::idNode nodeId)
std::tuple< dataType, dataType > getNormalizedBirthDeath(ftm::FTMTree_MT *tree, ftm::idNode nodeId, dataType newMin=0.0, dataType newMax=1.0)
bool isDeathHigher(ftm::FTMTree_MT *tree1, ftm::idNode tree1Node, ftm::FTMTree_MT *tree2, ftm::idNode tree2Node)
std::tuple< dataType, dataType > getParametrizedBirthDeath(ftm::FTMTree_MT *tree, ftm::idNode node, bool normalize)