| 177 | |
| 178 | template<typename TValueType> |
| 179 | static bool GetValueFromJson(const nlohmann::json& labelJson, const std::string& key, TValueType& value) |
| 180 | { |
| 181 | if (labelJson.find(key) != labelJson.end()) |
| 182 | { |
| 183 | try |
| 184 | { |
| 185 | value = labelJson[key].get<TValueType>(); |
| 186 | return true; |
| 187 | } |
| 188 | catch (...) |
| 189 | { |
| 190 | MITK_ERROR << "Unable to read label information from json. Value has wrong type. Failed key: " << key << "; invalid value: " << labelJson[key].dump(); |
| 191 | throw; |
| 192 | } |
| 193 | } |
| 194 | return false; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * \brief Remove all meta properties from a label instance. |
no test coverage detected