Page MenuHomePhabricator

Scene loading broken for more complex scenes (since Bug 11181)
Closed, ResolvedPublic

Description

I encountered scene files that would not load as expected due to two reasons:

  1. a zip CRC error (probably to be solved by T19315)
    • this would keep the reader from loading a single one of a multitude of property list files
  1. a broken logic in mitk::SceneReaderV1 that was trying to sort nodes according to their "layer" property before adding them to the datastorage.

The second issue is topic of this bug report. A scene file that would reproduce the described behavior will be attached. Screenshots are also attached to demonstrate wrong and correct loading.

The concerned sorting logic was attempting to calculate unique layer numbers (as far as I understood it). This was not working correctly:

  1. the layer numbers could be non-unique for scenes where layers are identical for multiple nodes or for scenes where layer numbers are not consecutive (I think -- the code seemed just not clear)
  1. when layer number collided, the loader would assign two parents to a node, would not be able to figure out an order to insert all nodes, and finally (wrongly) insert many nodes as top-level items

I tracked the change down to T11181 (some three years ago). Seemingly, most scenes have not been affected since then. Data for 11181 is not available in Bugzilla, but I'll ask the authors for examples.

In a branch for this bug, I changed the sorting to a more stable version (with slightly less code, too). This solves my problem, but I'll invite others to verify their scenes, too.

One important thing that needs to be known (not mentioned in T11181): SceneIO can under no circumstances guarantee that the node order will correctly be restored as long as Data Manager (or different versions/configurations of Data Manager or similar views) will react to each DataStorage::Add() and re-order nodes/layers! With the current change the default configurations of SceneIO and Data Manager go along with each other, but if someone activates the "insert new nodes on top" for Data Manager's list, this would be broken again.

Another point: this shows that we need more complex tests for SceneIO. I'll add those in T19299.

scene-load-broken-before-change.jpg (1×1 px, 214 KB)

Event Timeline

Test scene packaged with 7zip. Sorry for the format, but I cannot get the original zip file smaller than the 1MB limit of Bugzilla.

User maleike has pushed new remote branch:

bug-19322-load-complex-scenes

I received a mail by Michael Brehler (private communication) regarding what happened in T11181. In summary: it was just about having a (simple/flat) list of images loaded in parallel, sorting them in Data Manager. Then this scene is saved and reloaded. Before T11181, the node order was not correctly restored.

I tried this workflow with 5 images and found that it is working correctly now. Since everything seems fine, a previous bug is still fixed and I don't see any more problems, I'll integrate that changes once I test compiled on Linux&Windows

[096365]: Merge branch 'bug-19322-load-complex-scenes'

Merged commits:

2015-09-11 12:38:40 Daniel Maleike [1288b0]
Fix loading of complex scenes

Conflicts:
Modules/SceneSerialization/src/mitkSceneReaderV1.cpp
Modules/SceneSerialization/src/mitkSceneReaderV1.h

Passes MITK dashboard clients.. Regarding the ZIP CRC error, I'll perform tests locally and comment the results in T19315 if tests confirm my assumption.