17 #ifndef mitkIntLookupTablePropertySerializer_h_included
18 #define mitkIntLookupTablePropertySerializer_h_included
26 class IntLookupTablePropertySerializer :
public BasePropertySerializer
29 mitkClassMacro(IntLookupTablePropertySerializer, BasePropertySerializer);
30 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
32 virtual TiXmlElement *Serialize()
override
34 const IntLookupTableProperty *prop =
dynamic_cast<const IntLookupTableProperty *
>(m_Property.GetPointer());
37 IntLookupTable lut = prop->GetValue();
42 auto element =
new TiXmlElement(
"IntLookupTableTable");
43 for (
auto it = map.begin(); it != map.end(); ++it)
45 auto tableEntry =
new TiXmlElement(
"LUTValue");
46 tableEntry->SetAttribute(
"id", it->first);
47 tableEntry->SetAttribute(
"value", it->second);
48 element->LinkEndChild(tableEntry);
59 for (TiXmlElement *child = element->FirstChildElement(
"LUTValue"); child !=
nullptr;
60 child = child->NextSiblingElement(
"LUTValue"))
63 if (child->QueryIntAttribute(
"id", &temp) == TIXML_WRONG_TYPE)
66 if (child->QueryIntAttribute(
"value", &temp) == TIXML_WRONG_TYPE)
69 lut.SetTableValue(
id, val);
75 IntLookupTablePropertySerializer() {}
76 virtual ~IntLookupTablePropertySerializer() {}
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)