23 TiXmlElement *versionObject = document.FirstChildElement(
"Version");
26 if (versionObject->QueryIntAttribute(
"FileVersion", &fileVersion) != TIXML_SUCCESS)
28 MITK_ERROR <<
"Scene file " << workingDirectory +
"/index.xml"
29 <<
" does not contain version information! Trying version 1 format." << std::endl;
33 std::stringstream sceneReaderClassName;
34 sceneReaderClassName <<
"SceneReaderV" << fileVersion;
36 std::list<itk::LightObject::Pointer> sceneReaders =
37 itk::ObjectFactoryBase::CreateAllInstance(sceneReaderClassName.str().c_str());
38 if (sceneReaders.size() < 1)
40 MITK_ERROR <<
"No scene reader found for scene file version " << fileVersion;
42 if (sceneReaders.size() > 1)
44 MITK_WARN <<
"Multiple scene readers found for scene file version " << fileVersion
45 <<
". Using arbitrary first one.";
48 for (
auto iter = sceneReaders.begin(); iter != sceneReaders.end(); ++iter)
50 if (
SceneReader *reader = dynamic_cast<SceneReader *>(iter->GetPointer()))
52 if (!reader->LoadScene(document, workingDirectory, storage))
54 MITK_ERROR <<
"There were errors while loading scene file "
55 << workingDirectory +
"/index.xml. Your data may be corrupted";
Data management class that handles 'was created by' relations.
virtual bool LoadScene(TiXmlDocument &document, const std::string &workingDirectory, DataStorage *storage)