# Reading and writing xml file for slicer.vtkMRMLAnnotationROINode

**URL:** <https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548>\
**Category:** Development\
**Created:** [May 15, 2020, 12:02am UTC](https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548 "2020-05-15T00:02:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [May 15, 2020, 12:02am UTC](https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548/1 "2020-05-15T00:02:34Z")

</div>

Does anyone have any good examples to share for how the WriteXML() and ReadXMLAttributes() functions of vtkMRMLAnnotationROINode are used?

I did see this link:  
[https://apidocs.slicer.org/master/classvtkMRMLAnnotationROINode.html#a59dcbe3b69f14f6b927f605b29390b2f](https://apidocs.slicer.org/master/classvtkMRMLAnnotationROINode.html#a59dcbe3b69f14f6b927f605b29390b2f)

But I would like to see an example of these being used in a module because it’s not clear to me what exactly the inputs should look like based on that documentation.

Thanks,  
Rohan

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 15, 2020, 3:24am UTC](https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548/2 "2020-05-15T03:24:42Z")

</div>

The methods are used internally when the node is written to/read from a scene file. It should not be necessary for you to use them.

What would you like to achieve?

---

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [May 15, 2020, 4:23pm UTC](https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548/3 "2020-05-15T16:23:28Z")

</div>

I was hoping Slicer might have built-in functions that I can call in a module to save the center and radius of vtkMRMLAnnotationROINode to an xml file, or to read the center and radius from an xml file and set the initial position of the vtkMRMLAnnotationROINode to the values read from the file.

Although I know how to write functions that do these things, I was wondering if there is an easier way.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 16, 2020, 10:18pm UTC](https://discourse.slicer.org/t/reading-and-writing-xml-file-for-slicer-vtkmrmlannotationroinode/11548/4 "2020-05-16T22:18:04Z")

</div>

Reading and writing this information to XML files is very easy with vtkXMLDataElement class.
