|
Medical Imaging Interaction Toolkit
2025.12.02
Medical Imaging Interaction Toolkit
|
Helper class for handling label suggestions with constraint checking. More...
#include <mitkLabelSuggestionHelper.h>


Classes | |
| struct | Preferences |
Public Types | |
| using | ConstLabelVectorType = MultiLabelSegmentation::ConstLabelVectorType |
Public Member Functions | |
| mitkClassMacroItkParent (LabelSuggestionHelper, itk::Object) | |
| Pointer | Clone () const |
| std::optional< nlohmann::json > | GetStandardSuggesitions () |
| void | LoadStandardSuggestions () |
| bool | ParseSuggestions (const std::string &filePath, bool replaceExisting=true) |
| Parse label suggestions from a JSON file. More... | |
| bool | ParseSuggestions (const nlohmann::json &jsonSuggestions, bool replaceExisting=true) |
| Parse label suggestions from a JSON object. More... | |
| ConstLabelVectorType | GetValidSuggestionsForNewLabels (const MultiLabelSegmentation *segmentation=nullptr) const |
| Get valid suggestions for adding new labels to a segmentation. More... | |
| ConstLabelVectorType | GetValidSuggestionsForRenamingLabels (const MultiLabelSegmentation *segmentation, const std::string_view labelName) const |
| Get valid suggestions for renaming a specific label. More... | |
| bool | IsNewInstanceAllowed (const MultiLabelSegmentation *segmentation, const std::string_view labelName) const |
| Check if a new instance of a label is allowed. More... | |
| ConstLabelVectorType | GetAllSuggestions () const |
| Get all currently loaded suggestions (unfiltered). More... | |
| void | ClearSuggestions () |
| Clear all loaded suggestions. More... | |
| void | AddSuggestion (Label::Pointer label) |
| Add a single suggestion manually. More... | |
Static Public Member Functions | |
| static Pointer | New () |
| static Preferences | GetSuggestionPreferences () |
| static std::map< std::string, nlohmann::json > | GetAllAvailableBuiltInSuggestions () |
Static Public Attributes | |
| static constexpr const char * | PROPERTY_MAX_INSTANCE_OCCURRENCE |
Protected Member Functions | |
| LabelSuggestionHelper () | |
| ~LabelSuggestionHelper () | |
| LabelSuggestionHelper (const LabelSuggestionHelper &)=delete | |
| LabelSuggestionHelper & | operator= (const LabelSuggestionHelper &)=delete |
Helper class for handling label suggestions with constraint checking.
This class provides functionality to:
The helper supports special label properties:
Definition at line 44 of file mitkLabelSuggestionHelper.h.
| using mitk::LabelSuggestionHelper::ConstLabelVectorType = MultiLabelSegmentation::ConstLabelVectorType |
Definition at line 54 of file mitkLabelSuggestionHelper.h.
|
protected |
|
protected |
|
protecteddelete |
| void mitk::LabelSuggestionHelper::AddSuggestion | ( | Label::Pointer | label | ) |
Add a single suggestion manually.
| label | The label to add as a suggestion |
| void mitk::LabelSuggestionHelper::ClearSuggestions | ( | ) |
Clear all loaded suggestions.
| Pointer mitk::LabelSuggestionHelper::Clone | ( | ) | const |
|
static |
Get all built-in suggestions for labels compiled into on of the modules. The function searches all modules for resources in the sub folder "/LabelSuggestions".
| ConstLabelVectorType mitk::LabelSuggestionHelper::GetAllSuggestions | ( | ) | const |
Get all currently loaded suggestions (unfiltered).
| std::optional<nlohmann::json> mitk::LabelSuggestionHelper::GetStandardSuggesitions | ( | ) |
Get the built-in label suggestion config that is currently indicated by the preferences.
|
static |
| ConstLabelVectorType mitk::LabelSuggestionHelper::GetValidSuggestionsForNewLabels | ( | const MultiLabelSegmentation * | segmentation = nullptr | ) | const |
Get valid suggestions for adding new labels to a segmentation.
Filters suggestions based on:
| segmentation | The segmentation to check against (can be nullptr) |
| ConstLabelVectorType mitk::LabelSuggestionHelper::GetValidSuggestionsForRenamingLabels | ( | const MultiLabelSegmentation * | segmentation, |
| const std::string_view | labelName | ||
| ) | const |
Get valid suggestions for renaming a specific label.
Returns suggestions that would be valid if the given label were renamed. Takes into account that renaming removes the old label name from the count.
| segmentation | The segmentation containing the label |
| labelName | The label name that should be checked for renaming |
| bool mitk::LabelSuggestionHelper::IsNewInstanceAllowed | ( | const MultiLabelSegmentation * | segmentation, |
| const std::string_view | labelName | ||
| ) | const |
Check if a new instance of a label is allowed.
Checks the _max_instance_occurrence constraint if present.
| segmentation | The segmentation to check against |
| labelName | The label name that should be checked for if another instance is allowed. |
| void mitk::LabelSuggestionHelper::LoadStandardSuggestions | ( | ) |
| mitk::LabelSuggestionHelper::mitkClassMacroItkParent | ( | LabelSuggestionHelper | , |
| itk::Object | |||
| ) |
|
static |
|
protecteddelete |
| bool mitk::LabelSuggestionHelper::ParseSuggestions | ( | const nlohmann::json & | jsonSuggestions, |
| bool | replaceExisting = true |
||
| ) |
Parse label suggestions from a JSON object.
| jsonSuggestions | suggestions stored as json object |
| replaceExisting | If true, replace all existing suggestions; if false, merge with existing |
| bool mitk::LabelSuggestionHelper::ParseSuggestions | ( | const std::string & | filePath, |
| bool | replaceExisting = true |
||
| ) |
Parse label suggestions from a JSON file.
| filePath | Path to the JSON file |
| replaceExisting | If true, replace all existing suggestions; if false, merge with existing |
|
staticconstexpr |
Property names for occurrence constraints
Definition at line 52 of file mitkLabelSuggestionHelper.h.