17 #ifndef mitkBoolLookupTablePropertySerializer_h_included
18 #define mitkBoolLookupTablePropertySerializer_h_included
26 class BoolLookupTablePropertySerializer :
public BasePropertySerializer
29 mitkClassMacro(BoolLookupTablePropertySerializer, BasePropertySerializer);
30 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
32 virtual TiXmlElement *Serialize()
override
34 const BoolLookupTableProperty *prop =
dynamic_cast<const BoolLookupTableProperty *
>(m_Property.GetPointer());
37 BoolLookupTable lut = prop->GetValue();
42 auto element =
new TiXmlElement(
"BoolLookupTable");
43 for (
auto it = map.begin(); it != map.end(); ++it)
45 auto tableEntry =
new TiXmlElement(
"LUTValue");
46 tableEntry->SetAttribute(
"id", it->first);
47 if (it->second ==
true)
48 tableEntry->SetAttribute(
"value",
"true");
50 tableEntry->SetAttribute(
"value",
"false");
51 element->LinkEndChild(tableEntry);
62 for (TiXmlElement *child = element->FirstChildElement(
"LUTValue"); child !=
nullptr;
63 child = child->NextSiblingElement(
"LUTValue"))
66 if (child->QueryIntAttribute(
"id", &xmlID) == TIXML_WRONG_TYPE)
70 lut.SetTableValue(
id, val);
76 BoolLookupTablePropertySerializer() {}
77 virtual ~BoolLookupTablePropertySerializer() {}
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)