[Solved] Adding metadata to a vtkInformation or a grid object flowing through the pipeline


I need to retrieve some metadata (user information e.g. distances in meters) related to a data object (e.g. vtkImageData) in my Paraview’s filters plugins.

I noticed that a filter’s output is shallow copied in the filter next to it, whereas custom data I put in output vtkInformation is not copied in the input information of the next filter.

Right now, I am searching in the code for the location where this information’s copy occurs (or the copy of data object) so I can also copy my custom keys in the input of the next filter.

I spent a lot of time and so far I wasn’t able to find this location, so if you know how this works please tell me in which method of what class this is happening.

If you have another solution to carry metadata with VTK data objects in filters (pipeline), please let me know.

Best regards.

Information keys are probably not what you should be using; they are not really intended to be preserved in the pipeline. Instead, consider storing this metadata as field data.

1 Like

You are right. In paraview, I can’t recover informations from catalyst pipeline in the “builtin” one.

vtkFieldData stores informations only in arrays… I need only to store my data in strings or primitive types…

It’s not a pretty solution but it might works !

So you advise me, for example, to use GetFieldData on a vtkImageData, and call AddArray on the returned vtkFieldData to add arrays that may represent a single/multiple informations (multiple distances, a single string,…)

Yes, it can be cumbersome but adding small arrays as field data is currently the only practical way to pass metadata along with a VTK dataset.

Thank you David Thompson. I will adopt this technique to carry metadata.

So, the “vtkFieldData” of a data object is intended to be used to carry user data, is that right ? or what’s the real purpose of it ? Apparently, in a vtkImageData, this field is not being used by the class.

VTK data object subclasses generally provide 3 ways to store user-provided data arrays:

  • point data, where every tuple in the array is associated with a geometric point (or graph vertex)
  • cell data, where every tuple in the array is associated with a geometry cell (or graph edge or table row)
  • field data, where tuples in the array are not associated with any geometry (or that association is application-specific and not managed by VTK).

Because the image data class inherits vtkDataObject, it has a field data object to store these arrays. But because field data arrays are not associated with any geometry in the image (as far as VTK is concerned), the vtkImageData class has no need to access them.

1 Like

Everything is clear now. Thank you very much.