Page MenuHomePhabricator

Add AutoSelectNewNodes mode to SingleNodeSelectionWidget
Closed, ResolvedPublic

Description

The DataStorageCombobox has a AutoSelectNewNodes mode (default is false). If activated a fitting node will be automatically selected if added to the storage and nothing is selected. This is i.a. used by the segmentation views.

We should introduce this option to the SingleNodeSelectionWidget to ease the refactoring of e.g. the segmentation views:

Steps to do:

  1. Add a AddNode observer to the AbstractNodeSelectionWidget that derived classes can reimplement to react on new nodes.
  2. SingleNodeSelectionWidget introduces AutoSelectNewNodes flag (default false).
    • If true and no valid selection alread set: SingleNodeSelectionWidget will check on 1) storage change, 2) AddNode and 3) predicate change if there is a fitting node. If this is the case the node will be automatically selected.
  3. Add this state to the DataStorageInspectorTestView to allow demonstration/testing

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

floca triaged this task as Normal priority.Jan 27 2020, 10:17 PM
floca created this task.
floca added a revision: Restricted Differential Revision.Jan 29 2020, 4:32 PM

What exactly is the logic here? I have the following case:

  • single node selection widget with auto mode and
  • two images (e.g. Pic3D and US4D
  • I select US4D in the data manager, image is selected in the selection widget
  • I select Pic3D in the data manager, image is selected in the selection widget
  • I deselect everything, US4D is automatically selected -> why not Pic3D (the last valid selection)?

Also, in optional mode it is not possible to remove the node if auto selection is enabled.

What exactly is the logic here? I have the following case:

If autoselect is on and nothing is selected, the first node retrurned by the datastorage when calling GetNodes() with the predicate will be chosen.
So the history of selections is irrelevant. It only depends on the storage and how it returns the request. So it might be "arbitrary" at first glance. But it is the same way the storage combobox worked.

Also, in optional mode it is not possible to remove the node if auto selection is enabled.

Yes. But I think that is a "ok" behavior because that are indeed competing features. In my opinion it makes no sense to have both activated at the same time. But it also seems wrong to throw exception or alike. Because it not a nunexpected behavior it does exactly what it should. Allowing to remove selection, but always look for a selection if nothing is selected.

I think putting more time and effort into some other logic makes no sense as long as we have no concrete relevant demand.