# Any way to insert comments in a file created by vtkXMLImageDataWriter

**URL:** https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161
**Category:** Support
**Created:** [January 28, 2019, 10:40pm UTC](https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161 "2019-01-28T22:40:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vnpavanelli](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@vnpavanelli](https://discourse.vtk.org/u/vnpavanelli)
#### Post date: [January 28, 2019, 10:40pm UTC](https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161/1 "2019-01-28T22:40:02Z")

</div>

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.

Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 28, 2019, 11:26pm UTC](https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161/2 "2019-01-28T23:26:53Z")

</div>

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](https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Core/vtkMRMLSegmentationStorageNode.cxx) file to see examples for reading/writing.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [January 29, 2019, 2:12am UTC](https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161/3 "2019-01-29T02:12:18Z")

</div>

The VTK Examples have several uses of field data to store additional data:  
[https://lorensen.github.io/VTKExamples/site/Cxx/IO/ExportPolyDataScene](https://lorensen.github.io/VTKExamples/site/Cxx/IO/ExportPolyDataScene)  
[https://lorensen.github.io/VTKExamples/site/Cxx/IO/ImportPolyDataScene/](https://lorensen.github.io/VTKExamples/site/Cxx/IO/ImportPolyDataScene/)  
[https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/](https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/)  
[https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/](https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/)

---

<div class="post-metadata">

### Author: ![vnpavanelli](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@vnpavanelli](https://discourse.vtk.org/u/vnpavanelli)
#### Post date: [January 29, 2019, 6:24pm UTC](https://discourse.vtk.org/t/any-way-to-insert-comments-in-a-file-created-by-vtkxmlimagedatawriter/161/4 "2019-01-29T18:24:28Z")

</div>

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

Thank you both!
