-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path Mappings and Branch Mappings in MergeTreeBarycenter and MergeTreeDistanceMatrtix #162
Open
floWetzels
wants to merge
10
commits into
topology-tool-kit:dev
Choose a base branch
from
floWetzels:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e403f37
added states and data for BDIED barycenters and distance matrices
floWetzels d0fec35
docs and python scripts for path and branch mapping examples
floWetzels 6718421
typo fix
julien-tierny d4dcf56
relative paths for python scripts
julien-tierny 6d5f47b
simplified and blacked ...branchMapping.py
julien-tierny 1c77926
simplified and blacked ...pathMapping.py
julien-tierny 7b2b328
fixed output description in branch mapping example
floWetzels 5bd3a09
fixed layout in branch mapping example
floWetzels a027c97
edits to branchMapping state
julien-tierny 1a6cc68
pvsm state edit for path mapping
julien-tierny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian" header_type="UInt64"> | ||
<vtkMultiBlockDataSet> | ||
<DataSet index="0" file="outlier/outlier_0_0.vti"/> | ||
<DataSet index="1" file="outlier/outlier_1_0.vti"/> | ||
<DataSet index="2" file="outlier/outlier_2_0.vti"/> | ||
<DataSet index="3" file="outlier/outlier_3_0.vti"/> | ||
<DataSet index="4" file="outlier/outlier_4_0.vti"/> | ||
<DataSet index="5" file="outlier/outlier_5_0.vti"/> | ||
<DataSet index="6" file="outlier/outlier_6_0.vti"/> | ||
<DataSet index="7" file="outlier/outlier_7_0.vti"/> | ||
<DataSet index="8" file="outlier/outlier_8_0.vti"/> | ||
<DataSet index="9" file="outlier/outlier_9_0.vti"/> | ||
</vtkMultiBlockDataSet> | ||
</VTKFile> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Merge Tree Barycenter with Branch Mapping | ||
|
||
![Branch Mapping and Distance Matrix example Image]() | ||
|
||
## Pipeline description | ||
This example first loads a multi block of scalar fields from disk. | ||
Then, the Split Tree is computed on each scalar field using the [MergeTree](https://topology-tool-kit.github.io/doc/html/classttkMergeTree.html) module. | ||
|
||
All these trees are passed to [MergeTreeClustering](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeClustering.html). It computes the distance and corresponding mapping between the first two trees in the metric space of merge trees defined by the branch mapping distance (thus, the underlying metric to the branch mapping distance). The [MergeTreeClustering](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeClustering.html) module only computes one distance and one mapping because the actual barycenter computation is not possible with this metric. | ||
|
||
In addition, a distance matrix for the input trees is computed with [MergeTreeDistanceMatrix](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeDistanceMatrix.html). | ||
|
||
The python script computes the branch mapping distance and saves the resulting mapping as well as the distance matrix in form of a table. The paraview state file additionally renders the matrix as a heatmap. | ||
|
||
## ParaView | ||
To reproduce the above screenshots, go to your [ttk-data](https://github.com/topology-tool-kit/ttk-data) directory and enter the following command: | ||
``` bash | ||
paraview states/mergeTreeBarycenter_branchMapping.pvsm | ||
``` | ||
|
||
## Python code | ||
|
||
``` python linenums="1" | ||
--8<-- "python/mergeTreeBarycenter_branchMapping.py" | ||
``` | ||
|
||
To run the above Python script, go to your [ttk-data](https://github.com/topology-tool-kit/ttk-data) directory and enter the following command: | ||
``` bash | ||
pvpython python/mergeTreeBarycenter_branchMapping.py | ||
``` | ||
|
||
|
||
## Inputs | ||
- [outlier.vtm](https://github.com/topology-tool-kit/ttk-data/tree/dev/bdied_outlier/outlier.vtm): a vtk multiblock containing 10 regular grids. | ||
|
||
## Outputs | ||
- `merge_tree_barycenter.vtm`: the computed barycenter merge tree as a vtk multiblock. | ||
- `distance_matrix.csv`: the distance matrix as a csv table. | ||
|
||
|
||
## C++/Python API | ||
[BlockAggregator](https://topology-tool-kit.github.io/doc/html/classttkBlockAggregator.html) | ||
|
||
[MergeTree](https://topology-tool-kit.github.io/doc/html/classttkMergeTree.html) | ||
|
||
[MergeTreeClustering](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeClustering.html) | ||
|
||
[MergeTreeDistanceMatrix](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeDistanceMatrix.html) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Merge Tree Barycenter with Path Mapping | ||
|
||
![Path Mapping Barycenter and Distance Matrix example Image]() | ||
|
||
## Pipeline description | ||
This example first loads a multi block of scalar fields from disk. | ||
Then, the the Split Tree is computed on each scalar field using the [MergeTree](https://topology-tool-kit.github.io/doc/html/classttkMergeTree.html) module. | ||
|
||
All these trees are passed to [MergeTreeClustering](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeClustering.html) to compute a barycenter in the metric space of merge trees defined by the path mapping distance (thus, the number of clusters has to be set to one and the underlying metric to the path mapping distance). | ||
|
||
In addition, a distance matrix for the input trees is computed with [MergeTreeDistanceMatrix](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeDistanceMatrix.html). | ||
|
||
The python script computes the barycenter and saves the resulting planar layout as well as the distance matrix in form of a table. The paraview state file additionally renders the matrix as a heatmap. | ||
|
||
## ParaView | ||
To reproduce the above screenshots, go to your [ttk-data](https://github.com/topology-tool-kit/ttk-data) directory and enter the following command: | ||
``` bash | ||
paraview states/mergeTreeBarycenter_pathMapping.pvsm | ||
``` | ||
|
||
## Python code | ||
|
||
``` python linenums="1" | ||
--8<-- "python/mergeTreeBarycenter_pathMapping.py" | ||
``` | ||
|
||
To run the above Python script, go to your [ttk-data](https://github.com/topology-tool-kit/ttk-data) directory and enter the following command: | ||
``` bash | ||
pvpython python/mergeTreeBarycenter_pathMapping.py | ||
``` | ||
|
||
|
||
## Inputs | ||
- [outlier.vtm](https://github.com/topology-tool-kit/ttk-data/tree/dev/bdied_outlier/outlier.vtm): a vtk multiblock containing 10 regular grids. | ||
|
||
## Outputs | ||
- `merge_tree_barycenter.vtm`: the computed barycenter merge tree as a vtk multiblock. | ||
- `distance_matrix.csv`: the distance matrix as a csv table. | ||
|
||
|
||
## C++/Python API | ||
[BlockAggregator](https://topology-tool-kit.github.io/doc/html/classttkBlockAggregator.html) | ||
|
||
[MergeTree](https://topology-tool-kit.github.io/doc/html/classttkMergeTree.html) | ||
|
||
[MergeTreeClustering](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeClustering.html) | ||
|
||
[MergeTreeDistanceMatrix](https://topology-tool-kit.github.io/doc/html/classttkMergeTreeDistanceMatrix.html) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python | ||
# state file generated using paraview version 5.10.1 | ||
|
||
#### import the simple module from the paraview | ||
from paraview.simple import * | ||
|
||
# ---------------------------------------------------------------- | ||
# setup the data processing pipelines | ||
# ---------------------------------------------------------------- | ||
|
||
# create a new 'XML MultiBlock Data Reader' | ||
outliervtm = XMLMultiBlockDataReader(FileName=['/home/wetzels/ttk/ttk-data_wetzels/bdied_outlier/outlier.vtm']) | ||
outliervtm.CellArrayStatus = ['vtkGhostType'] | ||
outliervtm.PointArrayStatus = ['test', 'vtkValidPointMask', 'vtkGhostType'] | ||
outliervtm.TimeArray = 'None' | ||
|
||
# create a new 'TTK MergeTree' | ||
tTKMergeandContourTreeFTM1 = TTKMergeTree(Input=outliervtm) | ||
tTKMergeandContourTreeFTM1.ScalarField = ['POINTS', 'test'] | ||
tTKMergeandContourTreeFTM1.InputOffsetField = ['POINTS', 'test'] | ||
tTKMergeandContourTreeFTM1.TreeType = 'Split Tree' | ||
tTKMergeandContourTreeFTM1.UseAllCores = 0 | ||
|
||
# create a new 'TTK BlockAggregator' | ||
tTKBlockAggregator1 = TTKBlockAggregator(Input=[tTKMergeandContourTreeFTM1, OutputPort(tTKMergeandContourTreeFTM1,1), OutputPort(tTKMergeandContourTreeFTM1,2)]) | ||
tTKBlockAggregator1.FlattenInput = 0 | ||
|
||
# create a new 'TTK MergeTreeDistanceMatrix' | ||
tTKMergeTreeDistanceMatrix1 = TTKMergeTreeDistanceMatrix(Input=tTKBlockAggregator1, | ||
OptionalInput=None) | ||
tTKMergeTreeDistanceMatrix1.Backend = 'Branch Mapping Distance (EuroVis 2022)' | ||
tTKMergeTreeDistanceMatrix1.DistanceSquareRoot = 0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon1 = 0.0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon2 = 100.0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon3 = 100.0 | ||
|
||
# create a new 'TTK MergeTreeClustering' | ||
tTKMergeTreeClustering1 = TTKMergeTreeClustering(Input=tTKBlockAggregator1, | ||
OptionalInputclustering=None) | ||
tTKMergeTreeClustering1.Backend = 'Branch Mapping Distance (EuroVis 2022)' | ||
tTKMergeTreeClustering1.Deterministic = 1 | ||
tTKMergeTreeClustering1.DimensionSpacing = 0.1 | ||
tTKMergeTreeClustering1.DimensionToshift = 'Z' | ||
tTKMergeTreeClustering1.Epsilon1 = 0.0 | ||
tTKMergeTreeClustering1.Epsilon2 = 100.0 | ||
tTKMergeTreeClustering1.Epsilon3 = 100.0 | ||
tTKMergeTreeClustering1.ImportantPairs = 31.0 | ||
tTKMergeTreeClustering1.ImportantPairsSpacing = 32.0 | ||
tTKMergeTreeClustering1.NonImportantPairsSpacing = 8.0 | ||
|
||
# save the output | ||
SaveData("merge_tree_mapping.vtm", proxy=OutputPort(tTKMergeTreeClustering1, 2)) | ||
SaveData("distance_matrix.csv", tTKMergeTreeDistanceMatrix1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python | ||
# state file generated using paraview version 5.10.1 | ||
|
||
#### import the simple module from the paraview | ||
from paraview.simple import * | ||
|
||
# ---------------------------------------------------------------- | ||
# setup the data processing pipelines | ||
# ---------------------------------------------------------------- | ||
|
||
# create a new 'XML MultiBlock Data Reader' | ||
outliervtm = XMLMultiBlockDataReader(FileName=['/home/wetzels/ttk/ttk-data_wetzels/bdied_outlier/outlier.vtm']) | ||
outliervtm.CellArrayStatus = ['vtkGhostType'] | ||
outliervtm.PointArrayStatus = ['test', 'vtkValidPointMask', 'vtkGhostType'] | ||
outliervtm.TimeArray = 'None' | ||
|
||
# create a new 'TTK MergeTree' | ||
tTKMergeandContourTreeFTM1 = TTKMergeTree(Input=outliervtm) | ||
tTKMergeandContourTreeFTM1.ScalarField = ['POINTS', 'test'] | ||
tTKMergeandContourTreeFTM1.InputOffsetField = ['POINTS', 'test'] | ||
tTKMergeandContourTreeFTM1.TreeType = 'Split Tree' | ||
tTKMergeandContourTreeFTM1.UseAllCores = 0 | ||
|
||
# create a new 'TTK BlockAggregator' | ||
tTKBlockAggregator1 = TTKBlockAggregator(Input=[tTKMergeandContourTreeFTM1, OutputPort(tTKMergeandContourTreeFTM1,1), OutputPort(tTKMergeandContourTreeFTM1,2)]) | ||
tTKBlockAggregator1.FlattenInput = 0 | ||
|
||
# create a new 'TTK MergeTreeDistanceMatrix' | ||
tTKMergeTreeDistanceMatrix1 = TTKMergeTreeDistanceMatrix(Input=tTKBlockAggregator1, | ||
OptionalInput=None) | ||
tTKMergeTreeDistanceMatrix1.Backend = 'Path Mapping Distance (TopoInVis 2022)' | ||
tTKMergeTreeDistanceMatrix1.DistanceSquareRoot = 0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon1 = 0.0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon2 = 100.0 | ||
tTKMergeTreeDistanceMatrix1.Epsilon3 = 100.0 | ||
|
||
# create a new 'TTK MergeTreeClustering' | ||
tTKMergeTreeClustering1 = TTKMergeTreeClustering(Input=tTKBlockAggregator1, | ||
OptionalInputclustering=None) | ||
tTKMergeTreeClustering1.Backend = 'Path Mapping Distance (TopoInVis 2022)' | ||
tTKMergeTreeClustering1.ComputeBarycenter = 1 | ||
tTKMergeTreeClustering1.Deterministic = 1 | ||
tTKMergeTreeClustering1.DimensionSpacing = 0.17 | ||
tTKMergeTreeClustering1.Epsilon1 = 0.0 | ||
tTKMergeTreeClustering1.Epsilon2 = 100.0 | ||
tTKMergeTreeClustering1.Epsilon3 = 100.0 | ||
tTKMergeTreeClustering1.ImportantPairs = 31.0 | ||
tTKMergeTreeClustering1.ImportantPairsSpacing = 32.0 | ||
tTKMergeTreeClustering1.NonImportantPairsSpacing = 8.0 | ||
|
||
# save the output | ||
SaveData("merge_tree_barycenter.vtm", proxy=OutputPort(tTKMergeTreeClustering1, 1)) | ||
SaveData("distance_matrix.csv", tTKMergeTreeDistanceMatrix1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the first output is the mapping (based on the above text and the python script).
Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the description wasn't correct here. The file name was wrong, too. I fixed it now. Thanks!