# Trying to use the vtkInformation/vtkInformationKey system for own purposes

**URL:** https://discourse.paraview.org/t/trying-to-use-the-vtkinformation-vtkinformationkey-system-for-own-purposes/10568
**Category:** Development
**Created:** [October 21, 2022, 3:24pm UTC](https://discourse.paraview.org/t/trying-to-use-the-vtkinformation-vtkinformationkey-system-for-own-purposes/10568 "2022-10-21T15:24:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [October 21, 2022, 3:24pm UTC](https://discourse.paraview.org/t/trying-to-use-the-vtkinformation-vtkinformationkey-system-for-own-purposes/10568/1 "2022-10-21T15:24:41Z")

</div>

VTK/Paraview comes with a pretty nice information exchange system, based on the  
`vtkInformation` and `vtkInformationKey` classes. In my own custom application, I would like to make use of it - if possible! -, instead of re-inventing one more wheel. I found this [https://www.kitware.com/a-vtk-pipeline-primer-part-1/](https://www.kitware.com/a-vtk-pipeline-primer-part-1/) to be a very helpful introduction into the subject.

**1) information on the server side, down the pipeline**

I have a source and an attached filter. The source produces a `vtkTable`, and the filter takes it as input. From the outputInfo of the source, I am getting access to the `vtkTable` object that I am supposed to fill with stuff, and from the inputInfo of the filter I can retrieve a pointer to a `vtkTable` with the stuff that I filled in before.

_ **Amazing:** the pointers are NOT the same!_ Looks like the input table of the filter is indeed another table than the output of the source (just a “shallow copy” of it?).

_ **Not any more so amazing:** _ If I am adding some custom information item (key, data) to the information object of the output table of the source, I cannot retrieve that information item from the input table of the filter…

This looked like a good way to “send” some info from the source to the filter, but it does not work: **Is there another way provided in the pipeline architecture logic?**

**2) Passing information from server to client side**

I have a filter class that again takes a `vtkTable` as input. Some of the properties are defined with their own domain, which is implemented in a `vtkSM<domain>` class. This domain class has a `IsFilteredArray()` function which receives an info object of `vtkPVDataInformation` class, with lots of info about the input table.

I know that the filter class object sits on the server side, and the domain class object sits on the client side, and it is always tricky to pass information between the two, but `Paraview` does a nice job of passing a nice little set of information about the table, including even the first 6 data rows - avoiding to push the entire data from the server to the client!

Again I would like to _send some piece of custom information data from the server side to that domain function:_ **Is there any way to do this within the software design logic of Paraview?** Of course I can always “break the rules”, but with this, I am afraid to make things at the end even more complex…

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 24, 2022, 2:41am UTC](https://discourse.paraview.org/t/trying-to-use-the-vtkinformation-vtkinformationkey-system-for-own-purposes/10568/2 "2022-10-24T02:41:06Z")

</div>

Hi @cobo

1. Info down pipeline

To transfer information for a filter **to the next** filter,use the “KEYS\_TO\_COPY” information key:

> [@Set size of StringVectorProperty list at loading of state file](https://discourse.paraview.org/t/set-size-of-stringvectorproperty-list-at-loading-of-state-file/845):
>
> Hello, I’ve been working on a ParaView plugin very recently. In the XML definition, I used the following widget: \<StringVectorProperty name="ParameterNames" command="SetParameterNames" clean\_command="ResetParameterNamesToDefault" information\_property="ParameterNameInfo" number\_of\_elements\_per\_command="1" repeat\_command="1" use\_index="1" …

It will not go through the whole pipeline though.

It is possible to have keys copy themselves over and over but you need to create your own key class implementing `CopyDefaultInformation` (or use a existing one like `vtkInformationDataObjectMetaDataKey`)

1. Info from server to client

Use Information Properties to send information from the server to the client. You can take a look at `Examples/Plugins/PropertyWidgets/Plugin/PropertyWidgetsFilter.xml` and it’s `information_only` property.

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [October 24, 2022, 7:48am UTC](https://discourse.paraview.org/t/trying-to-use-the-vtkinformation-vtkinformationkey-system-for-own-purposes/10568/3 "2022-10-24T07:48:09Z")

</div>

Thank you very much for these hints - I will immediately go and try them out!

My “solution” so far was rather ugly: I attached a “field data” object to the table that was passed to the next filter, with one attribute and one single row. That data item could be read as well in the next “downstream” filter, and it made it’s way also into a “domain” class that is used in a property widget, because it seems that the first 6 rows of any data table (including field data etc.) are accessible through some default information passing mechanism.

However, your solution looks much nicer to me!
