diff --git a/core/vtk/ttkPlanarGraphLayout/ttkMergeTreeVisualization.h b/core/vtk/ttkPlanarGraphLayout/ttkMergeTreeVisualization.h index 45a6955d14..3d05654932 100644 --- a/core/vtk/ttkPlanarGraphLayout/ttkMergeTreeVisualization.h +++ b/core/vtk/ttkPlanarGraphLayout/ttkMergeTreeVisualization.h @@ -658,8 +658,8 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { // Node fields vtkNew criticalType{}; criticalType->SetName(ttk::PersistenceCriticalTypeName); - vtkNew persistenceNode{}; - persistenceNode->SetName("Persistence"); + vtkNew persistenceNode{}; + persistenceNode->SetName(ttk::PersistenceName); vtkNew clusterIDNode{}; clusterIDNode->SetName("ClusterID"); vtkNew isDummyNode{}; @@ -692,8 +692,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { vtkNew persistenceBaryOrderNode{}; persistenceBaryOrderNode->SetName("PersistenceBarycenterOrder"); - vtkNew pairPersistenceNode{}; - pairPersistenceNode->SetName(ttk::PersistenceName); vtkNew pairBirthNode{}; pairBirthNode->SetName(ttk::PersistenceBirthName); @@ -715,8 +713,8 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { customStringArrays.size()); // Arc fields - vtkNew persistenceArc{}; - persistenceArc->SetName("Persistence"); + vtkNew persistenceArc{}; + persistenceArc->SetName(ttk::PersistenceName); vtkNew clusterIDArc{}; clusterIDArc->SetName("ClusterID"); vtkNew isImportantPairsArc{}; @@ -750,8 +748,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { pairType->SetName(ttk::PersistencePairTypeName); vtkNew pairIsFinite{}; pairIsFinite->SetName(ttk::PersistenceIsFinite); - vtkNew pairPersistence{}; - pairPersistence->SetName(ttk::PersistenceName); vtkNew pairBirth{}; pairBirth->SetName(ttk::PersistenceBirthName); @@ -1194,11 +1190,17 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { // Add arc persistence printMsg( "// Push arc persistence", ttk::debug::Priority::VERBOSE); - idNode const nodeToGetPers = nodeBranching; + idNode const nodeToGetPers + = (isPersistenceDiagram ? node : nodeBranching); double const persToAdd = trees[i]->getNodePersistence(nodeToGetPers); persistenceArc->InsertNextTuple1(persToAdd); + // Add birth + auto birthDeath + = trees[i]->getBirthDeath(nodeToGetPers); + pairBirth->InsertNextTuple1(std::get<0>(birthDeath)); + // Add arc persistence barycenter and order if(clusteringOutput and ShiftMode != 1) { idNode const nodeToGet = nodeBranching; @@ -1236,12 +1238,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { // Add pairIdentifier pairIdentifier->InsertNextTuple1(treeSimplexId[node]); - // Add birth and death - auto birthDeath = trees[i]->getBirthDeath(node); - pairBirth->InsertNextTuple1(std::get<0>(birthDeath)); - pairPersistence->InsertNextTuple1(std::get<1>(birthDeath) - - std::get<0>(birthDeath)); - // Add isMinMaxPair bool const isMinMaxPair = (trees[i]->isRoot(node) and not trees[i]->isLeaf(node)) @@ -1374,6 +1370,10 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { persistenceNode->InsertNextTuple1( trees[i]->getNodePersistence(node)); + // Add birth + auto birthDeath = trees[i]->getBirthDeath(node); + pairBirthNode->InsertNextTuple1(std::get<0>(birthDeath)); + // Add node persistence barycenter if(clusteringOutput and ShiftMode != 1) { if(treeMatching[node] < allBaryBranchingID[c].size()) { @@ -1399,12 +1399,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { // Add isInterpolatedTree isInterpolatedTreeNode->InsertNextTuple1(isInterpolatedTree); - // Add birth and death - auto birthDeath = trees[i]->getBirthDeath(node); - pairBirthNode->InsertNextTuple1(std::get<0>(birthDeath)); - pairPersistenceNode->InsertNextTuple1(std::get<1>(birthDeath) - - std::get<0>(birthDeath)); - // Add isImportantPair bool isImportant = false; isImportant = trees[i]->isImportantPair( @@ -1462,7 +1456,7 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { pairIdentifier->InsertNextTuple1(-1); pairType->InsertNextTuple1(-1); - pairPersistence->InsertNextTuple1(-1); + persistenceArc->InsertNextTuple1(-1); pairIsFinite->InsertNextTuple1(0); pairBirth->InsertNextTuple1(0); @@ -1575,7 +1569,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { if(!treesNodes.empty() and ShiftMode != 1) vtkOutputNode->GetPointData()->AddArray(coordinates); } - vtkOutputNode->GetPointData()->AddArray(pairPersistenceNode); vtkOutputNode->GetPointData()->AddArray(pairBirthNode); // - Manage arc output @@ -1613,7 +1606,6 @@ class ttkMergeTreeVisualization : public ttk::MergeTreeVisualization { vtkArcs->GetCellData()->AddArray(pairType); vtkArcs->GetCellData()->AddArray(pairIsFinite); } - vtkArcs->GetCellData()->AddArray(pairPersistence); vtkArcs->GetCellData()->AddArray(pairBirth); if(vtkOutputArc == vtkOutputNode) vtkArcs->GetPointData()->ShallowCopy(vtkOutputNode->GetPointData());