MCPcopy Create free account
hub / github.com/MITK/MITK / GetValueFromJson

Function GetValueFromJson

Modules/Multilabel/include/mitkMultiLabelIOHelper.h:179–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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.

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected