Fix invalid states of Segmentation View for certain selection scenarios
Summary:
Overview
The essence of this change is that I refactored both On<...>SelectionChanged() methods
into a single method, resp. call this new common method from both methods.
Certain invalid view states could be achieved by fiddling around with multiple nodes
and different selections and the only reason for these invalid states was that
changes of selection were handled separately while (partly) neglecting the overall
selection situation.
Now, the whole selection situation is always assessed while it is ensured that
necessary state changes only occur when the selection(s) really changed.
While the checks did not change in principle, the code does not early out as much as
before anymore, giving it the chance to synchronize the tool manager with the members
of the view class for example. Therefore, it was ensured that the code is able to handle all
combinations of selection scenarios.
Additional effects
If a segmentation is selected without a reference image, the layer, label, and label set
widgets are kept enabled now since all actions of these widgets do not require a reference
image. Their purpose is solely to organize the internal data structure of a label set image.
There's also an additional warning now if the reference image is invisible. Before, only
an invisible segmentation triggered a warning.
Fixes T29353
Test Plan:
Load images and segmentations and heavily use the selection, layer, label, and label set
widgets on them as well as adding/removing nodes from the DataManager to check for invalid
states.
Reviewers: kalali, floca, O1 MITK Reviewer Group I
Reviewed By: floca, O1 MITK Reviewer Group I
Maniphest Tasks: T29353
Differential Revision: https://phabricator.mitk.org/D735