T29206 Rework of SegmentationView and MultiLabelSegmentation Qt model - 2nd round
Summary:
This is a new review for the ongoing work in T29206. Review comments of D771 are not incooperated now, but will be taken care of.
Please also use this diff to test the UX and give feedback.
Known Issues:
- Button icons missing
- Label search box is yet not working
- Rotating through labels with key short cut not working
- Double kick feature (go to label/alt: rename) only works right now if the label is already selected. Works not if you double click on labels that are not selected.
- If one does a lot of add and delete operations for label or groups (wasn't able to narrow down so far) the state of the background label becomes messed up (observer registred for a group/labelset that does not exist any more). In this state context menu action on group level (e.g. hide group, unlock group) will result in a crash. If be any chance you find a minimal set of instructions to provoke it deterministicly, that info is wellcome.
Things/ideas that are no errors but new features/improvement ideas please add as sub task to T29495.
commits history:
removed dead code
BREAKING LabelSet events no pass back the label value to now which label was added/modified/removed.
How to refactor: The receiving listener function must now have the
following function signature
MyListener(mitk::LabelSetImage::LabelValueType labelValue)
+ added more fine grained events for LabelSetImage
BREAKING: Changed signature and behavior of AddLabelSetToLayer
Why: So far AddLabelSetToLayer took the passed instance
(wrong/uneffective const declaration) and directly intergrated it
w/o (a) taking care of registering the events and ensuring sole
ownership. This resulted in (a) no correct events are send after if
the function is used (e.g. loaded segmentation would not work properly)
and (b) after some filters (e.g. QmitkImageCropper the label set
information of input and output segmentation would be entangled
(pointing to the same instance).
What changed: Now the LabelSet instance is always cloned befor added
and the events are correctly managed.
How to refactor: Check your usage of AddLabelSetToLayer if the cloning
of the LabelSet instance has impact on your business logic (e.g. if
you alter the states of the instance after adding it -> make all state
changes before adding it).
Introduced more finegrained events for labels and labelsets.
Implemented more fine grained events
+ started adding parts of the upcomming interface (needed for the model)
+ added workarround to asure unique label values over all layers/groups
Refactored QmitkMultiLabelSegmentationTreeModel to use fine grained events.
Remark: Not finished/fully functional yet and unit test is missing
Started with unit test for QmitkMultiLabelSegmentationTreeModel
+ fixed LabelSetTest and LabelSetImageTest
Adapt to new event signature
fixed encoding
Fixed gcc compile error
changed way to indicate deprecation to avoid warning as errors for now.
fixed gcc compile error
Added delegates for the MultiLabelSegmentationTreeView
Added a derived QTreeView class to have the correct selection strategy.
e.g. clicking on visibility cells should not change the selection see T29077.
Improved QmitkMultiLabelSegmentationTreeModel to support setDate
+ introduced needed user roles
+ add LabelSetImage::GetGroupIndexOfLabel
Added first draft QmitkMultiLabelSegmentationInspector
Improved column size distribution of QmitkMultiLabelSegmentationInspector
Temporary integration of new widget for first testing.
QmitkMultiLabelSegmentationInspector now checks internal selection updates before applying them in order to avoid the loose of a explicitly defined selection.
+ Corrected the event order in LabelSet for allowing listeners
consistent behavior (a label should not be refered to before it exists).
Renamed classes because mid-term they will not be bound to segmentations but also used for e.g. multi label detection
Added constant UnlabeledLabelValue to explicitly encode the value for unlabeled pixels (=0)
+ Added additional check into tree model to ignore legacy labels
(e.g. loaded from old stored label images) that are exterior.
Introduce LabelSetImages::ReinitMaps() to ensure the internal maps are also uptodate if complete label sets are added.
Changed QmitkMultiLabelTreeModel to return LabelValueRole and LabelDataRole for every column.
First draft of context menu moved to QmitkMultiLabelInspector
BREAKING: Refactored LabelSetImage::RemoveLabel(s) -> no group id is needed Why: already started to implement new interface to make implementation of new widgets easier. Who to adapt: Just remove the layer/group variable from the call of...
...RemoveLabel(s).
+Fixed handling of m_ReservedLabelValuesFunctor
+refactored LabelSet::AddLabel signature
Added future RemoveSpatialGroup method to allow the removal of any layer/group.
+ fixed a group label map update on group removal.
Interim draft of QmitkMultiLabelInspector adding modify operations and old version of context menu. Missing: - user based renaming - goto label support - layer specific context menu - implemented support for multiselection mode and modification...
...locks (for use as pure selection widget in e.g. segmentation utils)
Other stuff:
- added more fine grained ItemModelRoles to QmitkMultiLabelTreeModel
- added fine grained modification support to QmitkMultiLabelTreeModel
- added additional index methods to QmitkMultiLabelTreeModel
First draft of QmitkMultiLabelManager widget
Patched QmitkMultiLabelManager into QmitkSegmentationView for testing purpose.
Introduced helper function to QmitkNewSegmentationDialog
Fixed errors after merging with current develop
Remove old label/layer widgets from segmentation view
+ added QmitkMultiLabelTreeModel::FirstLabelInstanceIndex
+ fixed missing connections
Introduced change guards, as old LabelSetImage implementations do trigger unnecessary events even if active values keep the same.
Added early out in SurfaceInterpolationController::AddNewContours when no segmentation image is set.
Temporary deactivation of sliceInterpolator due to problems with rework of T29206
Added renaming features again.
+ activated GoToLabel again
Visibility modifications in QmitkMultiLabelTreeModel request a rendering update now.
+ color can now be edited (again)
Fixed problem of not correctly rendered expanded label nodes after adding the second instance.
added interim text to buttons for easier testing. Icons will be added later
Test Plan: Review and application monkey testing (please try any combination of tools and interaction pattern with different image types).
Reviewers: O1 MITK Reviewer Group I, O3 MITK Reviewer Group II, kislinsk
Reviewed By: O1 MITK Reviewer Group I, O3 MITK Reviewer Group II, kislinsk
Subscribers: kislinsk, s434n
Differential Revision: https://phabricator.mitk.org/D781