TTK features in pure C++

27 views
Skip to first unread message

打木陸雄

unread,
Dec 19, 2022, 9:51:00 PM12/19/22
to ttk-users
I'm currently developing a project code based on an example using pure C++ features of TTK (https://github.com/topology-tool-kit/ttk/tree/stable/examples/c++).
The target datasets are simple 2D or 3D scalar field.
I'm also referring to the doxygen content (https://topology-tool-kit.github.io/doc/html/index.html), but have a few questions.

1. In TTK, persistence is defined by a simple difference in critical field values (CFV) and can filter like:

if(diagramOutput[i].persistence > 0.05) {
      // 5. selecting the most persistent pairs
      authorizedCriticalPoints.push_back(diagramOutput[i].birth.id);
      authorizedCriticalPoints.push_back(diagramOutput[i].death.id);
}

I want to change this definition a little by taking into account the area or volume values that contours or isosurfaces sweeps. (e.g., CFV difference times such area or volume).
Is there any means to take such area and volume into account to simplify contour trees?


2. Given the coordinates of a pixel/voxel, one contour or isosurface passing through it is determined, and then one edge of the contour tree to which it belongs is determined.
Is there any way to get information as to which edge of the contour tree and what is the persistence value from the coordinates of the pixel or voxel?

Your help would be greatly appreciated.

With Best Regards, 
Rikuo Uchiki
Ph.D Student, Fujishiro Laboratory, Keio University
+81-90-1175-6488

Julien Tierny

unread,
Dec 21, 2022, 5:19:29 AM12/21/22
to ttk-users, 打木陸雄
Dear Rikuo,

thanks for your email.

> Is there any means to take such area and volume into account to simplify
> contour trees?
At the moment, there are no direct way to achieve this.
Note that the contour tree attaches the volume information (expressed in number of vertices) on each arc (cell data array "RegionSize").
Then, you could exploit this information to remove the extrema attached to smaller and smaller regions (and still using TopologicalSimplification afterwards to simplify the data).

> Is there any way to get information as to which edge of the contour tree
> and what is the persistence value from the coordinates of the pixel or
> voxel?
You can use the segmentation information (4th output of the filter).
For each vertex, a point data array named "SegmentationId" uniquely identifies the arc of it maps to.

I hope this helps.

Best,
--
Dr Julien Tierny
CNRS Researcher
Sorbonne Universite
http://lip6.fr/Julien.Tierny

打木陸雄

unread,
Jan 20, 2023, 10:51:50 AM1/20/23
to Julien Tierny, ttk-users
Dear Dr. Julien

Thank you for your support.


> Note that the contour tree attaches the volume information (expressed in number of vertices) on each arc (cell data array "RegionSize").
> Then, you could exploit this information to remove the extrema attached to smaller and smaller regions (and still using TopologicalSimplification afterwards to simplify the data).
I did a lot of research on doxygen contents and could not figure out how to access regionSize. Currently, for example, I'm calculating the persistence diagram with the following code.
As you can see the code, referring to the example (https://github.com/topology-tool-kit/ttk/blob/stable/examples/c++/main.cpp), I simply changed the data to be interpreted as three-dimensional grid data.
Simplification is almost the same.


  std::vector<float> pointSet(data_3d, data_3d + datalen); //data_3d contains 1d float array of 3d data.
  ttk::Triangulation triangulation;
  triangulation.setInputGrid(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, xdim, ydim, zdim); // want to interpret data_3d as a grid data. xdim, ydim, and zdim are grid sizes.
  std::vector<ttk::SimplexId> order(pointSet.size());
  ttk::preconditionOrderArray(pointSet.size(), pointSet.data(), order.data(), 1);
  ttk::PersistenceDiagram diagram;
  std::vector<ttk::PersistencePair> diagramOutput(50000);
  diagram.preconditionTriangulation(&triangulation);
  diagram.execute(diagramOutput, pointSet.data(), 0, order.data(), &triangulation);


For example, is it possible to access regionSize from the variable "diagram"? PersistenceDiagram has an internal "FTMTreePP contourTree_" but it is protected.
(https://topology-tool-kit.github.io/doc/html/classttk_1_1PersistenceDiagram.html)
If access from the diagram is not possible, do I need to define a new FTMTreeCT or ContourTree class variables? (I'm not even sure which class to use in that case.)
If there is a silver bullet, I would greatly appreciate it if you could let me know.


With Best Regards, 
Rikuo Uchiki
Ph.D Student, Fujishiro Laboratory, Keio University

2022年12月21日(水) 19:19 Julien Tierny <julien...@sorbonne-universite.fr>:


--
慶應義塾大学 大学院理工学研究科開放環境科学専攻情報工学専修
藤代研究室 博士三年 打木陸雄

打木陸雄

unread,
Feb 10, 2023, 5:05:02 AM2/10/23
to Julien Tierny, ttk-users
Dear Dr. Julien

Hello. The problem with the previous email has been resolved and you may ignore it.
However, I'm having trouble with the implementation of node deletion ( delNode() function ) in FTMTree.
(https://topology-tool-kit.github.io/doc/html/FTMTree__MT_8cpp_source.html#l00314)

In this code, if mainNode has two UpArcs and one DownArc (Y-like structure), the if statement below line 340 should be executed (despite the comment "//have one up arc").
This implementation does not seem to cause a segmentation fault, but would it produce reasonable results for FTMTree?
Sorry if I am asking a misguided question, but your help would be greatly appreciated.


With Best Regards,
Rikuo Uchiki
Ph.D Student, Fujishiro Laboratory, Keio University

2023年1月21日(土) 0:51 打木陸雄 <dbkn_...@keio.jp>:
Reply all
Reply to author
Forward
0 new messages