Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Macros
Helper macros for writing MRML node properties to XML attributes.

Macros

#define vtkMRMLWriteXMLBeginMacro(of)
 
#define vtkMRMLWriteXMLBooleanMacro(xmlAttributeName, propertyName)   xmlWriteOutputStream << " " #xmlAttributeName "=\"" << (Get##propertyName() ? "true" : "false") << "\"";
 Macro for writing bool node property to XML. More...
 
#define vtkMRMLWriteXMLEndMacro()   }
 This macro must be placed after the last value writing macro. More...
 
#define vtkMRMLWriteXMLEnumMacro(xmlAttributeName, propertyName)
 
#define vtkMRMLWriteXMLFloatMacro(xmlAttributeName, propertyName)   xmlWriteOutputStream << " " #xmlAttributeName "=\"" << Get##propertyName() << "\"";
 Macro for writing floating-point (double or float) node property to XML. More...
 
#define vtkMRMLWriteXMLIntMacro(xmlAttributeName, propertyName)   xmlWriteOutputStream << " " #xmlAttributeName "=\"" << Get##propertyName() << "\"";
 Macro for writing int node property to XML. More...
 
#define vtkMRMLWriteXMLStdFloatVectorMacro(xmlAttributeName, propertyName, vectorType)
 Macro for writing std::vector (float or double) node property to XML. More...
 
#define vtkMRMLWriteXMLStdIntVectorMacro(xmlAttributeName, propertyName, vectorType)
 Macro for writing std::vector (int) node property to XML. More...
 
#define vtkMRMLWriteXMLStdStringMacro(xmlAttributeName, propertyName)   xmlWriteOutputStream << " " #xmlAttributeName "=\"" << vtkMRMLNode::XMLAttributeEncodeString(Get##propertyName().c_str()) << "\""; \
 Macro for writing std::string node property to XML. More...
 
#define vtkMRMLWriteXMLStdStringVectorMacro(xmlAttributeName, propertyName, vectorType)
 Macro for writing std::vector (of std::string) node property to XML. More...
 
#define vtkMRMLWriteXMLStringMacro(xmlAttributeName, propertyName)
 
#define vtkMRMLWriteXMLVectorMacro(xmlAttributeName, propertyName, vectorType, vectorSize)
 Macro for writing vector (of numbers) node property to XML. More...
 

Detailed Description

They are To be used in WriteXML(ostream& of, int nIndent) method. Arguments of value writing macros:

Macro Definition Documentation

◆ vtkMRMLWriteXMLBeginMacro

#define vtkMRMLWriteXMLBeginMacro (   of)
Value:
{ \
ostream& xmlWriteOutputStream = of;

This macro must be placed before the first value writing macro.

Parameters
ofis the output stream where node values will be written to

Definition at line 28 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLBooleanMacro

#define vtkMRMLWriteXMLBooleanMacro (   xmlAttributeName,
  propertyName 
)    xmlWriteOutputStream << " " #xmlAttributeName "=\"" << (Get##propertyName() ? "true" : "false") << "\"";

Macro for writing bool node property to XML.

Definition at line 37 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLEndMacro

#define vtkMRMLWriteXMLEndMacro ( )    }

This macro must be placed after the last value writing macro.

Definition at line 33 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLEnumMacro

#define vtkMRMLWriteXMLEnumMacro (   xmlAttributeName,
  propertyName 
)
Value:
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
if (Get##propertyName##AsString(Get##propertyName()) != NULL) \
{ \
xmlWriteOutputStream << vtkMRMLNode::XMLAttributeEncodeString(Get##propertyName##AsString(Get##propertyName())); \
} \
xmlWriteOutputStream << "\"";
std::string XMLAttributeEncodeString(const std::string &inString)
Encode an XML attribute string (replaces special characters by code sequences)

Macro for writing enum node property to XML. Requires Get(propertyName)AsString method to convert from numeric value to code string.

Definition at line 56 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLFloatMacro

#define vtkMRMLWriteXMLFloatMacro (   xmlAttributeName,
  propertyName 
)    xmlWriteOutputStream << " " #xmlAttributeName "=\"" << Get##propertyName() << "\"";

Macro for writing floating-point (double or float) node property to XML.

Definition at line 69 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLIntMacro

#define vtkMRMLWriteXMLIntMacro (   xmlAttributeName,
  propertyName 
)    xmlWriteOutputStream << " " #xmlAttributeName "=\"" << Get##propertyName() << "\"";

Macro for writing int node property to XML.

Definition at line 65 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLStdFloatVectorMacro

#define vtkMRMLWriteXMLStdFloatVectorMacro (   xmlAttributeName,
  propertyName,
  vectorType 
)
Value:
{ \
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
vectorType vector = Get##propertyName(); \
for (vectorType::iterator it=vector.begin(); it!=vector.end(); it++) \
{ \
xmlWriteOutputStream << *it; \
xmlWriteOutputStream << " "; \
} \
xmlWriteOutputStream << "\""; \
}

Macro for writing std::vector (float or double) node property to XML.

Definition at line 92 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLStdIntVectorMacro

#define vtkMRMLWriteXMLStdIntVectorMacro (   xmlAttributeName,
  propertyName,
  vectorType 
)
Value:
{ \
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
vectorType vector = Get##propertyName(); \
for (vectorType::iterator it=vector.begin(); it!=vector.end(); it++) \
{ \
xmlWriteOutputStream << *it; \
xmlWriteOutputStream << " "; \
} \
xmlWriteOutputStream << "\""; \
}

Macro for writing std::vector (int) node property to XML.

Definition at line 105 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLStdStringMacro

#define vtkMRMLWriteXMLStdStringMacro (   xmlAttributeName,
  propertyName 
)    xmlWriteOutputStream << " " #xmlAttributeName "=\"" << vtkMRMLNode::XMLAttributeEncodeString(Get##propertyName().c_str()) << "\""; \

Macro for writing std::string node property to XML.

Definition at line 51 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLStdStringVectorMacro

#define vtkMRMLWriteXMLStdStringVectorMacro (   xmlAttributeName,
  propertyName,
  vectorType 
)
Value:
{ \
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
vectorType<std::string> vector = Get##propertyName(); \
for (vectorType<std::string>::iterator it=vector.begin(); it!=vector.end(); it++) \
{ \
std::string attributeValue = *it; \
vtksys::SystemTools::ReplaceString(attributeValue, "%", "%25"); \
vtksys::SystemTools::ReplaceString(attributeValue, ";", "%3B"); \
xmlWriteOutputStream << vtkMRMLNode::XMLAttributeEncodeString(attributeValue); \
xmlWriteOutputStream << ";"; \
} \
xmlWriteOutputStream << "\""; \
}
std::string XMLAttributeEncodeString(const std::string &inString)
Encode an XML attribute string (replaces special characters by code sequences)

Macro for writing std::vector (of std::string) node property to XML.

Definition at line 118 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLStringMacro

#define vtkMRMLWriteXMLStringMacro (   xmlAttributeName,
  propertyName 
)
Value:
if (Get##propertyName() != NULL) \
{ \
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
xmlWriteOutputStream << vtkMRMLNode::XMLAttributeEncodeString(Get##propertyName()); \
xmlWriteOutputStream << "\""; \
}
std::string XMLAttributeEncodeString(const std::string &inString)
Encode an XML attribute string (replaces special characters by code sequences)

Macro for writing char* node property to XML. If pointer is NULL then the attribute will not be written to XML.

Definition at line 42 of file vtkMRMLNodePropertyMacros.h.

◆ vtkMRMLWriteXMLVectorMacro

#define vtkMRMLWriteXMLVectorMacro (   xmlAttributeName,
  propertyName,
  vectorType,
  vectorSize 
)
Value:
{ \
xmlWriteOutputStream << " " #xmlAttributeName "=\""; \
vectorType* vectorPtr = Get##propertyName(); \
if (vectorPtr != NULL) \
{ \
for (int i=0; i<vectorSize; i++) \
{ \
if (i > 0) \
{ \
xmlWriteOutputStream << " "; \
} \
xmlWriteOutputStream << vectorPtr[i]; \
} \
} \
xmlWriteOutputStream << "\""; \
}

Macro for writing vector (of numbers) node property to XML.

Definition at line 73 of file vtkMRMLNodePropertyMacros.h.