You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

04-metaboxes.rst 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Metaboxes
  2. =========
  3. In |Brand| |AuthTool| you can create new boxes by assembling them from parts of other boxes, they are called metaboxes. This section describes their usage. Metaboxes are loaded on start-up of the |Brand| |AuthTool|. They are loaded from the directories ``$InstallDir/share/openvibe/metaboxes`` and ``%APPDATA%/mensia/metaboxes``. These metaboxes are written under the formats ``.mxb`` or ``.mbb``.
  4. A Metabox behaves just like a normal box, that is:
  5. - It has an arbitrary number of inputs and outputs using the same types as other boxes.
  6. - It can have an arbitrary number of settings.
  7. - It can be inserted into a scenario.
  8. - It can have visualizations.
  9. Creating Metaboxes
  10. ------------------
  11. In order to create a Metabox you first have to create a scenario.
  12. Example: we want to make a Metabox that will apply a notch filter for 48-52Hz and then apply an arbitrary band-pass filter on the signal.
  13. Thus, our Metabox consists of:
  14. - One Signal input
  15. - One Signal output
  16. - Two temporal filter boxes
  17. - Two settings
  18. - Lower frequency bound
  19. - Upper frequency bound
  20. Step 1: Adding boxes and settings
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. We create a new empty scenario and add two settings to it, we also drag two temporal filter boxes inside and set them up like so:
  23. .. figure:: images/metaboxes/creating-01.png
  24. :alt: Creating a metabox - step 1
  25. :align: center
  26. Creating a metabox - step 1
  27. First Temporal filter box is renamed Band Pass, the second one is renamed Notch filter (right-click + rename box: Notch Filter).
  28. We set the notch filter to a band stop filter with cut off frequencies at 48 and 52Hz.
  29. Step 2: Adding inputs and outputs
  30. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. In order to "expose" inputs and outputs of our metabox we need to add some inputs and outputs to a scenario.
  32. To do so we use the Scenario I/O tab. To add an input or output simply click the appropriate add button. A setting has only a name and a type. By default, the created type is Streamed Matrix.
  33. - Add one **input** to the scenario, change its type to **Signal** and rename it to **Input Signal**
  34. - Add one **output** to the scenario, change its type to **Signal** and rename it to **Filtered Signal**
  35. .. figure:: images/metaboxes/creating-02.png
  36. :alt: Adding inputs and outputs
  37. :align: center
  38. Adding inputs and outputs
  39. In order to associate a scenario input with a box input, right click on the box you wish to send the input to. A new context menu item will be available: **Connect scenario inputs**. In this context menu item will be a list of all box inputs which will again open a list of all scenario inputs. Clicking on the scenario input will link the box input to the scenario input.
  40. Right click on the **Notch filter** box. In the **connect scenario inputs** submenu you will see the single input of the box. Incidentally it is also called *Input Signal*, under this item there will be another item called *Input Signal* – this is our scenario’s input.
  41. .. figure:: images/metaboxes/creating-03.png
  42. :alt: Linking a scenario input
  43. :align: center
  44. Linking a scenario input
  45. Now do the same for the output. A circular indicator will be displayed to represent the link between the scenario input and the box input.
  46. .. figure:: images/metaboxes/creating-04.png
  47. :alt: Linked inputs and outputs
  48. :align: center
  49. Linked inputs and outputs
  50. Each scenario input can be linked to exactly one box input. If you wish to use the same input in several boxes, use an identity box.
  51. Step 3: Adding Metadata
  52. ~~~~~~~~~~~~~~~~~~~~~~~
  53. The metabox reads its metadata from the scenario information. You can edit it by clicking on the star button in the toolbar.
  54. The most important attributes are **Name**, **Category** and **Metabox Id**. This is how your box will be identified inside the box-algorithm list.
  55. The **Metabox Id** serves as a unique identifier for this box. You can either specify it yourself (as a group of two 32bit hex integers) or use the refresh button to generate one.
  56. Save your box inside the ``%APPDATA%/mensia/metaboxes`` folder.
  57. .. figure:: images/metaboxes/creating-05.png
  58. :alt: Change about scenario
  59. :align: center
  60. Change about scenario
  61. Using a Metabox
  62. ---------------
  63. Metaboxes will appear in the sidebar just like the other boxes, except they are highlighted in a green colour.
  64. You can drag a metabox into the scenario as you would any other box. It will appear with a double border.
  65. .. figure:: images/metaboxes/using-in-scenario.png
  66. :alt: Metabox in scenario
  67. :align: center
  68. Metabox in scenario
  69. Double clicking on the metabox will reveal all of the settings of the scenario that represents the metabox. You can also right click on a metabox and open it in editor from the context menu *Edit this metabox in the editor*.