38 TiXmlDocument document(m_Filename);
39 if (!document.LoadFile())
41 MITK_ERROR <<
"Could not open/read/parse " << m_Filename <<
"\nTinyXML reports: " << document.ErrorDesc()
46 for (TiXmlElement *propertyElement = document.FirstChildElement(
"property"); propertyElement !=
nullptr;
47 propertyElement = propertyElement->NextSiblingElement(
"property"))
49 const char *keya = propertyElement->Attribute(
"key");
50 std::string key(keya ? keya :
"");
52 const char *typea = propertyElement->Attribute(
"type");
53 std::string type(typea ? typea :
"");
56 std::stringstream propertyDeserializerClassName;
57 propertyDeserializerClassName << type <<
"Serializer";
59 std::list<itk::LightObject::Pointer> readers =
60 itk::ObjectFactoryBase::CreateAllInstance(propertyDeserializerClassName.str().c_str());
61 if (readers.size() < 1)
63 MITK_ERROR <<
"No property reader found for " << type;
66 if (readers.size() > 1)
68 MITK_WARN <<
"Multiple property readers found for " << type <<
". Using arbitrary first one.";
71 for (
auto iter = readers.begin(); iter != readers.end(); ++iter)
76 if (property.IsNotNull())
78 m_PropertyList->ReplaceProperty(key, property);
82 MITK_ERROR <<
"There were errors while loading property '" << key <<
"' of type " << type
83 <<
". Your data may be corrupted";
#define MITK_REGISTER_SERIALIZER(classname)
Deserializes a mitk::PropertyList.
DataCollection - Class to facilitate loading/accessing structured data.
virtual ~PropertyListDeserializerV1()
Base class for objects that serialize BaseProperty types.
virtual bool Deserialize() override
Reads a propertylist from file. Get result via GetOutput()