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>
66 dataType newMin = 0.0,
70 dataType birth = std::get<0>(birthDeath);
71 dataType 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 return normalize ? getNormalizedBirthDeath<dataType>(tree, node)
90 template <
class dataType>
93 std::vector<dataType> &scalarsVector,
98 return getMin ? 0.0 : 1.0;
101 dataType death = scalarsVector[nodeIdParent];
102 dataType birth = scalarsVector[tree->
getNode(nodeIdParent)->getOrigin()];
104 dataType temp = death;
109 return getMin ? birth : death;
115 template <
class dataType>
116 std::shared_ptr<ftm::FTMTree_MT>
118 std::vector<SimplexId> &nodes,
119 std::vector<std::tuple<ftm::idNode, ftm::idNode>> &arcs) {
121 auto scalars = std::make_shared<ftm::Scalars>();
122 scalars->size = nodes.size();
123 scalars->values = (
void *)nodesScalar;
126 auto params = std::make_shared<ftm::Params>();
136 for(std::tuple<ftm::idNode, ftm::idNode> arc : arcs)
137 tree->makeSuperArc(std::get<0>(arc), std::get<1>(arc));
142 template <
class dataType>
143 ftm::MergeTree<dataType>
145 std::vector<std::tuple<ftm::idNode, ftm::idNode>> &arcs) {
147 = ttk::ftm::createEmptyMergeTree<dataType>(scalarsVector.size());
148 ttk::ftm::setTreeScalars<dataType>(mergeTree, scalarsVector);
152 for(
unsigned int i = 0; i < scalarsVector.size(); ++i)
156 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)
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)
coefficient_t normalize(const coefficient_t n, const coefficient_t modulus)