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