Page MenuHomePhabricator

[Segmentation] Custom list for optional label names
Closed, ResolvedPublic

Description

In former versions of the workbench there was a predefined proposed list of label names. Currently it is only free text. For several usage szenarios it would be helpfull to offer the posiblility to define a custom list of proposed label names.
Feature set/description:

  • List of custom label names can be set via preference or via command line argument (like label preset list)
  • If a custom list is specified: On "add new label" we show a dialog (like in earlier MITK versions) that allows to (a) type in a custom name or (b) choose from the list of unused custom label names (so label names already used should not be shown).

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

floca triaged this task as Normal priority.May 3 2022, 5:28 PM
floca created this task.

Naming/coloring is still supported with a list of proposed label names while typing but it is not the default anymore. It is now triggered when renaming a label by right-clicking on it and choosing "Rename...". So, I propose that the solution here is split into two preferences: (1) Showing the naming dialog when creating a new label vs. assigning a default name and (2) custom list with a few options like mentioned above.

kislinsk added a revision: Restricted Differential Revision.

{D655} addresses part 1 of the solution proposed above. To resolve this task completely the custom list for label name suggestions is missing, which will be tackled in another Diff.

The current list of suggestions for label names is based on an XML format and the preset is loaded from an embedded XML file: https://github.com/MITK/MITK/blob/master/Modules/Core/resource/mitkAnatomicalStructureColorPresets.xml

Excerpt of mitkAnatomicalStructureColorPresets.xml
<preset name="Abdomen">
  <category code_value="T-D000A" coding_scheme="SRT" code_name="Anatomical Structure"/>
  <type code_value="T-D4000" coding_scheme="SRT" code_name="Abdomen"/>
  <color rgb_r="177" rgb_g="122" rgb_b="101"/>
</preset>

This preset file is based on the following lookup table suggestion:
https://www.slicer.org/w/index.php/Documentation/4.5/SlicerApplication/LookupTables/GenericAnatomyColors

While the XML format allows for features like DICOM coding schemes and modifiers, only the name and color is currently read from this file for the suggestions in the segmentation plugin.

@floca I would like to discuss if we should also facilitate this file format and check if the parser can handle only names and colors to keep it somewhat feasible for our users or if we should provide/parse another simple format like a JSON file or something like a simple text file parsed line by line with an optional color value in each line in addition to the name:

.txt example
Abdomen,red
Lung,#00ff00
Heart
Aortic Arch,CornflowerBlue
.json example
[
  {
    "name": "Abdomen",
    "color": "red"
  },
  {
    "name": "Lung",
    "color": "#00ff00"
  },
  {
    "name": "Heart"
  },
  {
    "name": "Aortic Valve",
    "color": "CornflowerBlue"
  }
]

@floca I would like to discuss if we should also facilitate this file format and check if the parser can handle only names and colors to keep it somewhat feasible for our users or if we should provide/parse another simple format like a JSON file or something like a simple text file parsed line by line with an optional color value in each line in addition to the name:

  1. Yes I would allow to only have light wighted content (to it extrem only names are provided).
  2. I would opt for JSON or XML. Definetly not text file. The feature to predefine properties will become important in the future even more.
  3. We should use the same format for the label preset file and this custom labels file. Everything else would be inefficient.

Naming/coloring is still supported with a list of proposed label names while typing but it is not the default anymore. It is now triggered when renaming a label by right-clicking on it and choosing "Rename...". So, I propose that the solution here is split into two preferences: (1) Showing the naming dialog when creating a new label vs. assigning a default name and (2) custom list with a few options like mentioned above.

OK. I would propose, that if the custom optional label list is specified via command line directly, it always also implies that the dialog should be shown.

  1. We should use the same format for the label preset file and this custom labels file. Everything else would be inefficient.

Label set presets use the (XML-based) serializer of property lists, in other words, they are serialized property lists. So this would add quite a bit of extra XML elements and make it hard to manually craft a suggestion list from scratch. Since it is also completely separate from label set presets, I don't see the "obligation" to use property lists for suggestions as well. Personally I would propose the simple JSON format from above.

OK. I would propose, that if the custom optional label list is specified via command line directly, it always also implies that the dialog should be shown.

Good point.

I finished this task in feature/T29158-CustomLabelSuggestions. After a mental break I will go through the code and double-check for any business logic bugs or edge cases but I am confident. Will create a Diff later or tomorrow morning.

kislinsk added a revision: Restricted Differential Revision.Jun 1 2022, 2:20 PM

Deleted branch from rMITK MITK: feature/T29158-CustomLabelSuggestions.

Deleted branch from rMITK MITK: feature/T29158-OptionallyAskForLabelNamesAndColors.