13 #ifndef mitkIntLookupTablePropertySerializer_h_included 14 #define mitkIntLookupTablePropertySerializer_h_included 22 class IntLookupTablePropertySerializer :
public BasePropertySerializer
25 mitkClassMacro(IntLookupTablePropertySerializer, BasePropertySerializer);
26 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
28 TiXmlElement *Serialize()
override 30 const IntLookupTableProperty *prop =
dynamic_cast<const IntLookupTableProperty *
>(m_Property.GetPointer());
33 IntLookupTable lut = prop->GetValue();
38 auto element =
new TiXmlElement(
"IntLookupTableTable");
39 for (
auto it = map.begin(); it != map.end(); ++it)
41 auto tableEntry =
new TiXmlElement(
"LUTValue");
42 tableEntry->SetAttribute(
"id", it->first);
43 tableEntry->SetAttribute(
"value", it->second);
44 element->LinkEndChild(tableEntry);
55 for (TiXmlElement *child = element->FirstChildElement(
"LUTValue"); child !=
nullptr;
56 child = child->NextSiblingElement(
"LUTValue"))
59 if (child->QueryIntAttribute(
"id", &temp) == TIXML_WRONG_TYPE)
62 if (child->QueryIntAttribute(
"value", &temp) == TIXML_WRONG_TYPE)
65 lut.SetTableValue(
id, val);
71 IntLookupTablePropertySerializer() {}
72 ~IntLookupTablePropertySerializer()
override {}
std::map< IdentifierType, ValueType > LookupTableType
MITK_REGISTER_SERIALIZER(IntLookupTablePropertySerializer)
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
unsigned int IdentifierType
#define mitkClassMacro(className, SuperClassName)