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 single file from disk. Then, the Split Tree is computed on each scalar field.

All these trees are passed to MergeTreeTemporalReductionEncoding 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 --state=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
#!/usr/bin/env python

from paraview.simple import *

# create a new 'XML Image Data Reader'
isabelvti = XMLImageDataReader(FileName=['isabel.vti'])

all_MT_group = []

scalarFields = ['velocityMag_02', 'velocityMag_03', 'velocityMag_04', 'velocityMag_05', 'velocityMag_30', 'velocityMag_31', 'velocityMag_32', 'velocityMag_33', 'velocityMag_45', 'velocityMag_46', 'velocityMag_47', 'velocityMag_48']
for scalarField in scalarFields:
  # create a new 'TTK Merge and Contour Tree (FTM)'
  tTKMergeandContourTreeFTM1 = TTKMergeandContourTreeFTM(Input=isabelvti)
  tTKMergeandContourTreeFTM1.ScalarField = ['POINTS', scalarField]
  tTKMergeandContourTreeFTM1.TreeType = 'Split Tree'

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

  all_MT_group.append(groupDatasets1)

# create a new 'Group Datasets'
all_MT = GroupDatasets(Input=all_MT_group)

# create a new 'TTK MergeTreeTemporalReductionEncoding'
tTKMergeTreeTemporalReductionEncoding1 = TTKMergeTreeTemporalReductionEncoding(Input=all_MT)
tTKMergeTreeTemporalReductionEncoding1.RemovalPercentage = 75.0
tTKMergeTreeTemporalReductionEncoding1.Epsilon1 = 0.0
tTKMergeTreeTemporalReductionEncoding1.Epsilon2 = 100.0
tTKMergeTreeTemporalReductionEncoding1.Epsilon3 = 100.0
tTKMergeTreeTemporalReductionEncoding1.PersistenceThreshold = 3.0

SaveData('ReductionCoefficients.csv', OutputPort(tTKMergeTreeTemporalReductionEncoding1, 1))

Inputs

  • isabel.vti: a three-dimensional regular grid with 12 scalar fields.

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

FTMTree

MergeTreeTemporalReductionEncoding