Skip to content

Commit

Permalink
Merge pull request #993 from m-s-will/critType
Browse files Browse the repository at this point in the history
[ttkMergeTree] Changed criticalType computation for ExTreeM based on treetype
  • Loading branch information
julien-tierny authored Nov 27, 2023
2 parents 038b609 + 6b9b9fb commit 889c91f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
9 changes: 7 additions & 2 deletions core/base/exTreeM/ExTreeM.h
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,8 @@ namespace ttk {
ttk::SimplexId *descendingManifold,
ttk::SimplexId *tempArray,
const ttk::SimplexId *order,
const triangulationType *triangulation) {
const triangulationType *triangulation,
const char type) {

// start global timer
ttk::Timer globalTimer;
Expand All @@ -1423,7 +1424,11 @@ namespace ttk {
// flatten the criticalpoints for the segmentation
for(int i = 0; i < 4; i++) {
for(ttk::SimplexId point : criticalPoints[i]) {
cpMap[point] = 3 - i;
if(type == 0) {
cpMap[point] = 3 - i;
} else {
cpMap[point] = i;
}
}
}

Expand Down
36 changes: 18 additions & 18 deletions core/vtk/ttkMergeTree/ttkMergeTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ int ttkMergeTree::RequestData(vtkInformation *ttkNotUsed(request),
&& (!(params_.treeType == ttk::ftm::TreeType::Contour))
&& (input->IsA("vtkImageData"))) {
printMsg("Triggering ExTreeM Backend.");
// TODO: add CriticalType PointData Array and change isLeaf to RegionType
const size_t nVertices = input->GetNumberOfPoints();

// Get triangulation of the input object
Expand Down Expand Up @@ -269,14 +268,15 @@ int ttkMergeTree::RequestData(vtkInformation *ttkNotUsed(request),
for(size_t i = 0; i < nVertices; i++) {
orderArrayData[i] = nVertices - orderArrayData[i] - 1;
}
ttkTypeMacroT(triangulation->getType(),
(status = exTreeMTree.computePairs<T0>(
persistencePairsJoin, cpMap, mergeTreeJoin,
ttkUtils::GetPointer<ttk::SimplexId>(segmentationId),
ttkUtils::GetPointer<char>(regionType),
ttkUtils::GetPointer<ttk::SimplexId>(ascendingManifold),
ttkUtils::GetPointer<ttk::SimplexId>(descendingManifold),
orderArrayData, (T0 *)triangulation->getData())));
ttkTypeMacroT(
triangulation->getType(),
(status = exTreeMTree.computePairs<T0>(
persistencePairsJoin, cpMap, mergeTreeJoin,
ttkUtils::GetPointer<ttk::SimplexId>(segmentationId),
ttkUtils::GetPointer<char>(regionType),
ttkUtils::GetPointer<ttk::SimplexId>(ascendingManifold),
ttkUtils::GetPointer<ttk::SimplexId>(descendingManifold),
orderArrayData, (T0 *)triangulation->getData(), params_.treeType)));
// swap the data back (even if the execution failed)
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_)
Expand Down Expand Up @@ -306,18 +306,18 @@ int ttkMergeTree::RequestData(vtkInformation *ttkNotUsed(request),

int status = 0;

ttkTypeMacroT(triangulation->getType(),
(status = exTreeMTree.computePairs<T0>(
persistencePairsSplit, cpMap, mergeTreeSplit,
ttkUtils::GetPointer<ttk::SimplexId>(segmentationId),
ttkUtils::GetPointer<char>(regionType),
ttkUtils::GetPointer<ttk::SimplexId>(descendingManifold),
ttkUtils::GetPointer<ttk::SimplexId>(ascendingManifold),
orderArrayData, (T0 *)triangulation->getData())));
ttkTypeMacroT(
triangulation->getType(),
(status = exTreeMTree.computePairs<T0>(
persistencePairsSplit, cpMap, mergeTreeSplit,
ttkUtils::GetPointer<ttk::SimplexId>(segmentationId),
ttkUtils::GetPointer<char>(regionType),
ttkUtils::GetPointer<ttk::SimplexId>(descendingManifold),
ttkUtils::GetPointer<ttk::SimplexId>(ascendingManifold),
orderArrayData, (T0 *)triangulation->getData(), params_.treeType)));

if(status != 1)
return 0;

auto outputPoints = vtkUnstructuredGrid::GetData(outputVector, 0);
auto outputMergeTreeSplit = vtkUnstructuredGrid::GetData(outputVector, 1);

Expand Down

0 comments on commit 889c91f

Please sign in to comment.