13 #ifndef mitkMultiLabelIOHelper_h
14 #define mitkMultiLabelIOHelper_h
20 #include <itkSmartPointer.h>
21 #include <nlohmann/json.hpp>
33 class MetaDataDictionary;
60 static bool SaveLabelSetImagePreset(
const std::string &presetFilename,
69 static bool LoadLabelSetImagePreset(
const std::string &presetFilename,
85 static tinyxml2::XMLElement *GetLabelAsXMLElement(tinyxml2::XMLDocument &doc,
const Label *label);
95 static tinyxml2::XMLElement *PropertyToXMLElement(tinyxml2::XMLDocument& doc,
const std::string &key,
const BaseProperty *property);
108 static int GetIntByKey(
const itk::MetaDataDictionary& dic,
const std::string& key);
111 static std::string GetStringByKey(
const itk::MetaDataDictionary& dic,
const std::string& key);
154 static std::vector<LabelGroupMetaData> DeserializeMultiLabelGroupsFromJSON(
const nlohmann::json& listOfLabelGroups);
177 template<
typename TValueType>
180 if (labelJson.find(key) != labelJson.end())
184 value = labelJson[key].get<TValueType>();
189 MITK_ERROR <<
"Unable to read label information from json. Value has wrong type. Failed key: " << key <<
"; invalid value: " << labelJson[key].dump();