Reading and writing xml file for slicer.vtkMRMLAnnotationROINode

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

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

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?

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.

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

1 Like