MCPcopy Create free account
hub / github.com/MITK/MITK / LoadBaseDataFromDataTag

Method LoadBaseDataFromDataTag

Modules/SceneSerialization/src/mitkSceneReaderV1.cpp:300–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300mitk::DataNode::Pointer mitk::SceneReaderV1::LoadBaseDataFromDataTag(const tinyxml2::XMLElement *dataElement,
301 const PropertyList *properties,
302 const std::string &workingDirectory,
303 bool &error)
304{
305 DataNode::Pointer node;
306
307 if (dataElement)
308 {
309 const char *filename = dataElement->Attribute("file");
310 if (filename && strlen(filename) != 0)
311 {
312 try
313 {
314 auto baseData = IOUtil::Load(workingDirectory + Poco::Path::separator() + filename, properties);
315
316 node = DataNode::New();
317 node->SetData(baseData);
318 }
319 catch (std::exception &e)
320 {
321 MITK_ERROR << "Error during attempt to read '" << filename << "'. Exception says: " << e.what();
322 error = true;
323 }
324
325 if (node.IsNull())
326 {
327 MITK_ERROR << "Error during attempt to read '" << filename << "'. Factory returned nullptr object.";
328 error = true;
329 }
330 }
331 else
332 {
333 MITK_ERROR << "File attribute of data tag is empty!";
334 error = true;
335 }
336
337 const char* dataUID = dataElement->Attribute("UID");
338 if (!error && dataUID != nullptr)
339 {
340 UIDManipulator manip(node->GetData());
341 manip.SetUID(dataUID);
342 }
343 }
344
345 // in case there was no <data> element we create a new empty node (for appending a propertylist later)
346 if (node.IsNull())
347 {
348 node = DataNode::New();
349 }
350
351 return node;
352}
353
354void mitk::SceneReaderV1::ClearNodePropertyListWithExceptions(DataNode &node, PropertyList &propertyList)
355{

Callers 1

LoadSceneMethod · 0.95

Calls 7

LoadFunction · 0.85
whatMethod · 0.80
NewFunction · 0.50
SetDataMethod · 0.45
IsNullMethod · 0.45
GetDataMethod · 0.45
SetUIDMethod · 0.45

Tested by

no test coverage detected