Sometimes it can be useful to store the configuration of the pipeline
for later reuse. Writing long configurations in a terminal may also be
quite annoying. For these reasons, Boing lets users to write the
configuration of the pipeline in a text file and then to load such
configuration using the special node conf:
.
As an example, consider you have finally wrote the configuration of a
pipeline for comparing the result of different smoothing filters. Now
you want to save it in a file (e.g. config-filters.txt
) and maybe
you want to add some comments that will help you understanding the
structure of the pipeline. The file may look like the following:
# Pipeline for comparing the result of different smoothing filters.
#
# Author: Me
# Date: Sept 12, 2012
# File: config-filters.txt
# ONE INPUT: a standard TUIO source
in.tuio://:3333
# PARALLEL BRANCHES
+ (
# Raw input
nop:
# Default filter
| filtering: + edit:?source=Default
# Moving mean filter
| filtering:/moving/average?winsize=5 + edit:?source=Mean
# Moving median filter
| filtering:/moving/median?winsize=5 + edit:?source=Median
# Exponential double filter
| filtering:/exponential/double?alpha=1&gamma=1 + edit:?source=Exponential
# OneEuro filter
| filtering:/oneeuro?freq=1 + edit:?source=OneEuro
# ---
)
# ONE OUTPUT: the visualizer
+ viz:
Now, in order to run the pipeline you just have to enter the command:
boing conf:./config-filters.txt
Quite easy, isn’t it?
The node conf:
is actually a composite node that contains the
pipeline defined in the configuration file. For this reason, it is
also possible to use the conf:
node into another
pipeline. Consider as an example that you have a multi-touch table
sending contact information via the TUIO protocol, you found a good
smoothing filter since the input is quite noisy and you also
determined the calibration matrix to fit the touch position to the
correct screen space. You are not going to change these parameters so
you would like to consider all these elements as an atomic input
source that does not mess up a larger configuration. Thus, first you
could write the configuration of your input source into a file
(e.g. my-mt-table.txt
), which may look like the following:
# My multi-touch table without its ugly noise and well calibrated.
#
# Author: Me
# Date: Sept 12, 2012
# File: my-mt-table.txt
# INPUT: standard TUIO source
in.tuio://:3333
# FILTERING: OneEuro filter
+ filtering:/oneeuro?freq=60&merge
# CALIBRATION: my 4x4 matrix
+ calib:?merge&matrix=0.98,0,0,0.021,0,0.83,0,0.010,0,0,1,0,0,0,0,1
# NO OUTPUT, so I can reuse this into an external pipeline.
Then, you can reuse your configured input device as an atomic item in
a new pipeline. As an example, let’s show the contact events using the
viz:
node, and at the same time use the recorder widget and
forward the contacts to an other application listening for a TUIO
source on the local port 3334. The command to run is the following:
boing "conf:./my-mt-table.txt + (viz: | rec: | out.tuio://127.0.0.1:3334)"
As you can see, saving pipeline configurations into files can be quite
useful in different situations. Needless to say that you can also use
the conf:
node inside a configuration written in a file, so that
it is possible to arrange items in a hierarchical structure.