| 292 | } |
| 293 | |
| 294 | mitk::Label::Pointer mitk::MultiLabelIOHelper::LoadLabelFromXMLDocument(const tinyxml2::XMLElement *labelElem) |
| 295 | { |
| 296 | // reread |
| 297 | auto *propElem = labelElem->FirstChildElement("property"); |
| 298 | |
| 299 | std::string name; |
| 300 | mitk::BaseProperty::Pointer prop; |
| 301 | |
| 302 | mitk::Label::Pointer label = mitk::Label::New(); |
| 303 | while (propElem) |
| 304 | { |
| 305 | MultiLabelIOHelper::PropertyFromXMLElement(name, prop, propElem); |
| 306 | if (name == "value") |
| 307 | { |
| 308 | auto castedProp = dynamic_cast<mitk::UShortProperty*>(prop.GetPointer()); |
| 309 | if (castedProp != nullptr) |
| 310 | { |
| 311 | label->SetValue(castedProp->GetValue()); |
| 312 | } |
| 313 | else |
| 314 | mitkThrow() << "Cannot load legacy label information from xml. Value property is encoded with the wrong property type. Used property type: " << *prop.GetPointer(); |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | label->SetProperty(name, prop); |
| 319 | } |
| 320 | propElem = propElem->NextSiblingElement("property"); |
| 321 | } |
| 322 | |
| 323 | return label.GetPointer(); |
| 324 | } |
| 325 | |
| 326 | tinyxml2::XMLElement *mitk::MultiLabelIOHelper::PropertyToXMLElement(tinyxml2::XMLDocument &doc, const std::string &key, const BaseProperty *property) |
| 327 | { |
nothing calls this directly
no test coverage detected