~/ttk
) and decompress it by entering the following commands (omit
the $
character) in
a terminal (this assumes that you downloaded the tarball to the
~/Downloads
directory):$ mkdir ~/ttk
$ mv ~/Downloads/ttk-data-0.9.3.tar.gz ~/ttk/
$ cd ~/ttk
$ tar xvzf ttk-data-0.9.3.tar.gz
$ rm ttk-data-0.9.3.tar.gz
Clip1
); second, the
boundary of the input PL 3-manifold is extracted
(ExtractSurface1
), third the connected components of the boundary
are isolated and clipped with the same parameters as the rest of the volume
(Clip2
).GenerateSurfaceNormals1
).
The display properties of the output of a filter in the main central view can
also be modified from this panel.Ctrl+space
keystroke (under Linux) and enter keywords
as shown above to quickly call filters.Link Camera...
entry and finally click in the
other view they wish to link.File
, Save state...
and choosing the Python
state file type. In the Python script, each filter instance is modeled by an
independent Python object, for which attributes can be changed and functions
can be called.pvpython
interpreter is then recommended). Thus, ParaView can be
viewed as an interactive designer of advanced analysis Python programs.
To
learn more about the available ParaView filters, please see the following
tutorials:
HERE
and
THERE.
.pvsm
state file with the menu
File
, Save state...
(ideally, on file per exercise).
Plane
filter (also available in the Sources
menu).
Create a new plane with sufficient values for the
parameters XResolution
and YResolution
(typically
100 each).Programmable Source
or the
Programmable Filter
, users can directly type in Python commands to
either create or interact with data. We will make use of similar features to
create some 2D data to attach to our plane.
Specifically, we will use the
Python Calculator
, which will enable us to provide, in Python, the
analytic expression of a 2D function to be considered as the input to our
topological data analysis pipeline.Python Calculator
filter can be accessed by the variable
inputs[0]
. The actual points attached to this input can be
accessed by its Points
attribute: inputs[0].Points[]
.
Therefore, in your Python calculator
, accessing the x
and y
components of your current point p
can be done
by considering the following expressions respectively:
inputs[0].Points[:,0]
(for x) and
inputs[0].Points[:,1]
(for y).Python Calculator
the analytic expression of
Array Name
parameter, typically gaussian0
).Python Calculator
to blend
linearly the three Gaussians you generated into only one function, called
multiGaussian
, as illustrated below:Split Horizontal
button, located
in the top right corner of the current render view (next to the string
RenderView1
). Next, in the newly created view, click on the
Render View
button.Python Calculator
object in your pipeline and call the
Tetrahedralize
filter on it. Next, we will modify the x, y and z
coordinates of the vertices of this mesh to create a terrain.Programmable Filter
and enter some
Python instructions to assign the previously define multi-gaussian function,
named multiGaussian
, as a z coordinate. Programmable
Filters
generate only one output, which is by default a copy of the input
geometry. Thus, to access the output of your Programmable Filter
,
you need to use the Python expression output
. Then, the z
coordinate of the output can be accessed, similarly as to the previous
exercise, by considering
the Python expression output.Points[:, 2]
.
The scalar data that we generated in the
previous exercise (multiGaussian
) can be
accessed by considering the field multiGaussian
on the point data
of the first input. This is achieved by considering the expression
inputs[0].PointData["multiGaussian"]
. Script
text-box of your
Programmable Filter
to assign the multiGaussian
value
to the z coordinate of each point of the data and click on the
Apply
button. If you got it right, you should be visualizing
something like this:Programmable Filter
have not been copied over to the output of the
filter. We will now copy the field multiGaussian
, in order to
apply further processing on it. To add some data array to your output object,
you need to use the function append()
on your
output.PointData
object. This function takes as a first argument
the actual data array (in our case
inputs[0].PointData["multiGaussian"]
) and as a second argument a
string, used to name the created data array (in our case, let us name it
multiGaussian
too).Script
text-box of your
Programmable Filter
to copy the field
inputs[0].PointData["multiGaussian"]
over to your output and click
on the Apply
button. If you got it right, you should be
visualizing something like this:Programmable Filter
, by enabling the eye icon on
its left. Adjust its display properties (Coloring
,
Specular
, Ambient
and Diffuse
)
to obtain a
visualization comparable to the above screenshot.
Programmable Filter
and call
the Threshold
filter, to only select the points below on certain
isovalue of multiGaussian
. Trigger the display of the
Threshold
in both views, to obtain the following visualization:
Programmable Filter
and call the Contour
filter and extract a level set at the same
isovalue. Next call the Tube
filter on the output of the
Contour
filter, to represent the computed level set with a
collection of cylinder primitives, in both views, as illustrated below:
View
menu, check the Animation View
check-box.
The Animation View
panel appears at the bottom of the screen. We
will first setup the length of the animation by setting the
EndTime
parameter to 10
(seconds). Next, we will set
the frame rate to an admissible value (25 fps) and therefore set the parameter
No. Frames
to 250
.Animation View
, next to the +
icon, select your
Threshold
filter in the left scrolling menu and then, within
the right scrolling menu, select its
parameter
capturing the isovalue (Threshold Range (1)
) and click on the
+
button. Next, also add the Contour
filter to the
animation by selecting it
in the bottom left scrolling menu and
by clicking on the
+
button (the default selected parameter Isosurfaces
is precisely the parameter we want to animate). Play
button at the top of the screen. If you got it right, you
should be visualizing
something like this:Programmable Filter
and call the filter
TTK ScalarFieldCriticalPoints
on it.TTK
SphereFromPoint
filter on the output of the TTK
ScalarFieldCriticalPoints
filter and adjust the Radius
parameter. Next, change the coloring of these spheres, in order to use the
array CriticalIndex
. Finally, select the 2D view on the left by
clicking in it and trigger the display of these spheres, with the same display
properties.
If you got it right, you should be
visualizing something like this:
CriticalIndex
(color-coded on the spheres)
relate to:
Split
Horizontal
button, located at the top right corner of the right render
view (next to the string RenderView2
) and then click on the
Render View
button.Programmable
Filter
and call the filter TTK PersistenceDiagram
on it. A
persistence diagram should display in the newly created view.TTK PersistenceDiagram
filter, enable the display of the axes by checking the Axes Grid
check-box (you can tune its parameters, such as the name of the axes by
clicking on the Edit
button next to it).PairIdentifier
. Use
the Threshold
filter on the output of the TTK
PersistenceDiagram
filter to isolate this edge. Next, convert your
selected edge to a polygonal surface representation by calling the
Extract Surface
filter on it. Finally, represent this edge with a
cylinder primitive by calling the Tube
filter (adjust the
Radius
and coloring properties).TTK
PersistenceDiagram
filter and apply the Threshold
filter on
it to only display these pairs with non-negative values for the field
PairIdentifier
. Next, convert this selection into a polygonal
surface representation by calling the
Extract Surface
filter and represent these edges with cylinder
primitives by calling the Tube
filter (adjust the
Radius
and coloring properties).Threshold
filter which selected the pairs with
non-negative identifiers in the diagram and apply the TTK
SphereFromPoint
filter on it. Adjust the radius and set the coloring to
use the field NodeType
. If you got it right, you should be
visualizing something like this:
Split Vertical
bottom (top right corner, second button after the
string RenderView3
and click on the Render View
button. In this view, display the diagonal of the persistence diagram as well
as the persistence pairs more persistent than the two pairs identified in the
previous question (use the Threshold
filter on the
Persistence
array to isolate those, as the pairs above a given
persistence threshold and below an arbitrarily high threshold, for instance
9999
). Enhance the visualization, as suggested in the previous
question. If you got it right, you should be
visualizing something like this:
Programmable Filter
and add a Python instruction in the
Script
text-box to add a new field named
simplifiedGaussian
which is a copy of the field
multiGaussian
(see exercise 2).
Next, apply the filter Clean to Grid
on the output of your
Programmable Filter
, which will effectively perform the data copy.
Split Vertical
bottom (top right corner, second button after the
string RenderView2
and click on the Render View
button. Now, in the pipeline browser, select the output of the Clean
to Grid
filter
and call the filter TTK TopologicalSimplification
on it. A dialog window opens to specify the two inputs of this filter. The
first
input, named Domain
(see the left ratio buttons), should already
be set properly to your Clean
to Grid
filter. The second input,
named Constraints
(see the left ratio buttons), refers to the
persistent pairs which we want to keep in the reconstructed function
Threshold
filter you used to select the most persistent pairs of
the first diagram Ok
. Now, before clicking on the green Apply
button, in the properties panel, check the Numerical Perturbation
check-box, make sure that you are applying the simplification to the scalar
field simplifiedGaussian
and
click on Apply
. Link this terrain view with the
one
above by right clicking in the bottom view, selecting the entry Link
Camera...
and then clicking on the top view. If you got it right, you
should be visualizing something like this:
simplifiedGaussian
. For
this, select the filter TTK
TopologicalSimplification
in the pipeline browser and call a
Programmable Filter
on it and apply the same processing as in
the exercise 2 (but on our new field simplifiedGaussian
). Do not
forget to copy the fields simplifiedGaussian
and
multiGaussian
.
Also, the filter TTK
TopologicalSimplification
generates an offset field (or
tiebreak field) named OutputOffsetScalarField
. Make sure to
also copy this field, as it is necessary to further process the simplified data
properly.
ttkOffsetScalarField
by
default.
Split Vertical
bottom (top right corner, second button after the
string RenderView1
and click on the Render View
button. Click now on the 3D
icon (top left corner of the view) to
switch it to 2D
and trigger the display of the output of the
second Programmable Filter
in it. Adjust its display properties
(Coloring
,
Specular
, Ambient
and Diffuse
)
to obtain a visualization that is consistent with the above view. Link this 2D
bottom view with the above one (right click, Link
Camera...
).Programmable Filter
and call the filter TTK
ScalarFieldCriticalPoints
. Before clicking on the Apply
button, check the check-box Use Input Offset Field
and make sure
you are applying this filter to the scalar field
simplifiedGaussian
. Finally, enhance this visualization by
displaying a sphere for each critical point, colored by its critical index, with
TTK SphereFromPoint
, and display these spheres in both bottom views
(2D plane and 3D terrain).
UseInputOffsetField
.
Input offsets are now automatically retrieved from the data, if present. To
force the usage of a specific field as vertex offset (advanced usage), check
the box ForceInputOffsetField
.
Programmable Filter
and, similarly to exercise 3,
call the Threshold
filter on it to display
Programmable Filter
again and call the
Contour
filter on it to extract Tube
filter (to display it with cylinder
primitives) and trigger its display in both bottom views (2D plane and 3D
terrain). We will now complete the animation by animating the isovalue
View
menu, check the Animation View
check-box and similarly to exercise
4, add Play
button at the top of the screen.
If you got it right so far, you
should be visualizing something like this:
Threshold
filter with
which you controlled the persistence threshold (beginning of exercise 7) and
increase that threshold until TTK TopologicalSimplification
filter, un-check the
check-box Numerical Perturbation
and click on Apply
.
How can you explain the disappearance of the artifact?
Split Vertical
button and click on SpreadSheet View
. In the scrolling menu named
Showing
, select from your pipeline the TTK
PersistenceDiagram
and select in the Attribute
scrolling
menu the entry Cell Data
. This will display in a spreadsheet the
information associated with each pair of the persistence diagram, including its
persistence (last column), as shown below.
Programmable Filter
and
call a Python Calculator
on it. Now, enter the Python expression
to evaluate absoluteDifference
.
If you got it right, you
should be visualizing something like this:
Split Vertical
button and click on SpreadSheet View
.
In the scrolling menu named
Showing
, select from your pipeline the last Python
Calculator
.
This will display in a spreadsheet the
information associated with each vertex of the domain, including its
absoluteDifference
value, as shown below.
absoluteDifference
by clicking on the header of the
corresponding column.
Click on the spreadsheet entry that maximizes absoluteDifference
.
You should see the corresponding point highlighted in the above view.
Programmable Filter
and call the
filter TTK Merge and Contour Tree (FTM)
on it (select
Split Tree
as Tree Type
). This filter generates
multiple outputs. Select the output Segmentation
and change its
Opacity
to 0.3
. Now, you should see an embedding of
the split tree of your data. In the following, we will slightly enhance this
embedding.Arc Sampling
of your TTK Merge and
Contour Tree (FTM)
filter to a reasonable value (typically
10
). Next, select its output Skeleton Arcs
and call
the filter TTK GeometrySmoother
and check the box Use Input
Mask Field
. At this point, you may want to edit the number of smoothing
iterations (typically to 30
), to obtain a smoother embedding of
the split tree. Next, we will display the arcs of the tree with cylinder
primitives. For this, call the Extract Surface
filter (to convert
the arcs to a polygonal representation) and then the Tube
filter.
If you got it right, you
should be visualizing something like this:
TTK Merge and
Contour Tree (FTM)
, remember to use the simplifiedGaussian
field and to check the box Use Input Offset Scalar Field
. At this
point, you may want to reduce the persistence threshold (beginning of exercise
7), to obtain a visualization like this one:
UseInputOffsetField
.
Input offsets are now automatically retrieved from the data, if present. To
force the usage of a specific field as vertex offset (advanced usage), check
the box ForceInputOffsetField
.
Segmentation
output of the first TTK Merge and
Contour Tree (FTM)
filter. Now, apply the Threshold
filter,
in order to only show these vertices that have a RegionType
value
of 1
. This will extract all vertices mapping to arcs connected to
local maxima. Change the display properties of these vertices to color them by
the field SegmentationId
(you can edit the color map by clicking on
the Edit
button). Trigger their visualization in the top left
view, with the same coloring scheme.
Programmable Filter
(corresponding to the first, non-simplified 3D
terrain). Next, save this data to disk with the menu File
,
Save Data...
(select the vtu
file extension). You can
now close ParaView.TTK TopologicalSimplification
filter on it, using as constraints the persistent pairs you selected
previously from the persistence diagram (see exercise 7).Use Input Offset Scalar Field
). Finally,
threshold the Segmentation
output of the split tree, to only
visualize vertices with a RegionType
value of 1.
UseInputOffsetField
.
Input offsets are now automatically retrieved from the data, if present. To
force the usage of a specific field as vertex offset (advanced usage), check
the box ForceInputOffsetField
.
File
, Save state...
and choose
the Python state file type and save your file with the name
pipeline.py
.pvpython
, which wraps
around the
traditional Python interpretor, in order to set the required environment
variables properly. To automatically run the script with the right interpretor,
we will add the following line at the very top of the generated script:
#!/usr/bin/env pvpython
$
character):
$ chmod +x pipeline.py
$
character):
$ ./pipeline.py
RegionType
field.
After this paragraph, add a Python instruction to save the
Threshold
object to disk, with the function
SaveData()
, which takes as a first argument a filename
(for example
segmentation.vtu
)
and as
a second argument a pipeline object (here the instance of
Threshold
object). Save your file and execute your script. It
should have written to disk a file named segmentation.vtu
. Open it
in ParaView. You should be visualizing something like this:
segmentation.csv
instead of
segmentation.vtu
and run your script again. It should have
produced a plain ASCII file storing the segmentation, which can be opened and
parsed with any other software.
~/ttk/ttk-data-0.9.3/ctBones.vti