Allow custom label name and color suggestions
Summary:
Two sets of related segmentation preferences are introduced:
- Assign default names and colors to new labels (default) or ask users for names and colors
- Extend or replace the existing standard label name and color suggestions / auto-complete feature
The core part of this Diff is the "Create/Rename Label" dialog (QmitkNewSegmentationDialog), which is now configurable with the preferences mentioned above. Since it is instantiated from within different widgets and I wanted to prevent a verbose parameter passing cascade, I moved it from the SegmentationUI module to the segmentation plugin so it is able to access preferences itself. Dependencies were adjusted accordingly.
The class itself can be basically seen as completely rewritten after a few iterations including using a .ui file, but breaking API changes are minor, if relevant at all. It is more easy to use and requires less boilerplate code as it now encapsulates its two different common appearances ("Create Label" vs. "Rename Label") as a simple mode parameter, which also improves UI consistency.
Information on the JSON-based file format for custom label suggestions (and the new preferences) was added to the User Manual.
Custom label suggestions can also be specified as command-line argument Segmentation.labelSuggestions <filename.json>. In this case the custom suggestions are enforced, overriding and disabling corresponding preferences.
Test Plan:
I extensively tested the new features manually, including (but not exclusively):
- Checking "Create new segmentation", "Create new label", and "Rename label" in pretty much every combination of preferences.
- Checking custom suggestions in addition to label set presets.
- Checking combinations of enforced settings via command-line argument and user preferences.
- Checking both corrupt and valid JSON files for suggestions.
Fixes T29158.
Reviewers: floca, O1 MITK Reviewer Group I
Reviewed By: floca, O1 MITK Reviewer Group I
Maniphest Tasks: T29158
Differential Revision: https://phabricator.mitk.org/D659