13 #ifndef mitkLabelSuggestionHelper_h
14 #define mitkLabelSuggestionHelper_h
21 #include <nlohmann/json.hpp>
24 #include <string_view>
48 itkFactorylessNewMacro(Self);
52 static constexpr
const char* PROPERTY_MAX_INSTANCE_OCCURRENCE =
"_max_instance_occurrence";
59 std::string externalLabelSuggestionFile =
"";
61 std::string standardLabelSuggestionResource =
"MitkCore:mitk_classic";
62 bool replaceStandardSuggestions =
true;
63 bool enforceSuggestions =
false;
66 bool suggestionOnce =
true;
125 const std::string_view labelName)
const;
170 std::optional<unsigned int> GetMaxInstanceOccurrence(
const std::string_view labelname)
const;
183 const std::optional<std::string_view> labelName = std::nullopt);
#define MITKMULTILABEL_EXPORT
Helper class for handling label suggestions with constraint checking.
std::optional< nlohmann::json > GetStandardSuggesitions()
ConstLabelVectorType GetValidSuggestionsForNewLabels(const MultiLabelSegmentation *segmentation=nullptr) const
Get valid suggestions for adding new labels to a segmentation.
LabelSuggestionHelper(const LabelSuggestionHelper &)=delete
mitkClassMacroItkParent(LabelSuggestionHelper, itk::Object)
static Preferences GetSuggestionPreferences()
static std::map< std::string, nlohmann::json > GetAllAvailableBuiltInSuggestions()
bool ParseSuggestions(const nlohmann::json &jsonSuggestions, bool replaceExisting=true)
Parse label suggestions from a JSON object.
ConstLabelVectorType GetAllSuggestions() const
Get all currently loaded suggestions (unfiltered).
void LoadStandardSuggestions()
bool ParseSuggestions(const std::string &filePath, bool replaceExisting=true)
Parse label suggestions from a JSON file.
void AddSuggestion(Label::Pointer label)
Add a single suggestion manually.
ConstLabelVectorType GetValidSuggestionsForRenamingLabels(const MultiLabelSegmentation *segmentation, const std::string_view labelName) const
Get valid suggestions for renaming a specific label.
bool IsNewInstanceAllowed(const MultiLabelSegmentation *segmentation, const std::string_view labelName) const
Check if a new instance of a label is allowed.
MultiLabelSegmentation::ConstLabelVectorType ConstLabelVectorType
void ClearSuggestions()
Clear all loaded suggestions.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
ConstLabelVector ConstLabelVectorType
Find image slices visible on a given plane.