Skip to content

Merge Tree Temporal Reduction

Merge Tree Temporal Reduction example Image

Pipeline description

This example first loads an ensemble of scalar fields inside a cinema database from disk. Then, the MergeTree is computed on each scalar field.

All these trees are passed to MergeTreeTemporalReduction to compute a subsampling of a sequence of merge trees. The algorithm greedily removes trees in the sequence that can be accurately reconstructed by the geodesic computation. The remaining trees are called the key frames.

In terms of visualisation, the three key frames trees and two reconstructed trees are visualized with a planar layout along with their corresponding scalar fields.

The python script saves the information needed to reconstruct the trees removed in the sequence.

ParaView

To reproduce the above screenshot, go to your ttk-data directory and enter the following command:

paraview states/mergeTreeTemporalReduction.pvsm

Python code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python

from paraview.simple import *

# create a new 'TTK CinemaReader'
tTKCinemaReader1 = TTKCinemaReader(DatabasePath="./Isabel.cdb")

# create a new 'TTK CinemaProductReader'
tTKCinemaProductReader1 = TTKCinemaProductReader(Input=tTKCinemaReader1)
tTKCinemaProductReader1.AddFieldDataRecursively = 1

# create a new 'TTK Merge and Contour Tree (FTM)'
tTKMergeandContourTreeFTM26 = TTKMergeTree(Input=tTKCinemaProductReader1)
tTKMergeandContourTreeFTM26.ScalarField = ["POINTS", "velocityMag"]
tTKMergeandContourTreeFTM26.TreeType = "Split Tree"

# create a new 'Group Datasets'
all_MT = GroupDatasets(
    Input=[
        tTKMergeandContourTreeFTM26,
        OutputPort(tTKMergeandContourTreeFTM26, 1),
        OutputPort(tTKMergeandContourTreeFTM26, 2),
    ]
)

# create a new 'TTK MergeTreeTemporalReduction'
tTKMergeTreeTemporalReduction1 = TTKMergeTreeTemporalReduction(Input=all_MT)
tTKMergeTreeTemporalReduction1.RemovalPercentage = 75.0
tTKMergeTreeTemporalReduction1.Epsilon1 = 0.0
tTKMergeTreeTemporalReduction1.Epsilon2 = 100.0
tTKMergeTreeTemporalReduction1.Epsilon3 = 100.0
tTKMergeTreeTemporalReduction1.PersistenceThreshold = 3.0

SaveData("ReductionCoefficients.csv", OutputPort(tTKMergeTreeTemporalReduction1, 1))

To run the above Python script, go to your ttk-data directory and enter the following command:

pvpython python/mergeTreeTemporalReduction.py

Inputs

  • Isabel.cdb: a cinema database containing 12 regular grids.

Outputs

  • ReductionCoefficients.csv: a table containing information needed to reconstruct removed trees. For each removed tree we have the id of the two key frames needed to reconstruct it ('Index1' and 'Index2'), along with the interpolation parameter ('Alpha').

C++/Python API

CinemaProductReader

CinemaReader

MergeTree

MergeTreeTemporalReduction