Any way to insert comments in a file created by vtkXMLImageDataWriter

Is there any way to insert a comment into a .VTI file using the vtkXMLImageDataWriter or other VTK class that generate .VTI?

I’m trying to record some information on how I created the VTI data, like the original dataset and command parameters used, so I can organize those files later and recognize how they were created, so my goal is to contain all data (raw data and comments in this case) in the same file.

I did not try (yet) to manually change the XML file to add some custom field containing this data, that may solve my problem and work, but if there is some better and right way to do so I would prefer, maybe some standard field used for this.


In 3D Slicer, we use field data to store additional metadata with meshes. You can read/write using existing VTK API. Search for “fielddata” in this file to see examples for reading/writing.

The VTK Examples have several uses of field data to store additional data:

1 Like

That’s exactly what I needed!
Someway I missed it from the doxygen docs.

Thank you both!