Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp @ 5011:c014ab79fca5
fixed /move documentation + improved error reporting
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 31 May 2022 09:36:00 +0200 |
parents | d0c34145320c |
children | 6fed78e13233 |
comparison
equal
deleted
inserted
replaced
5010:88d838c6b4c7 | 5011:c014ab79fca5 |
---|---|
2294 return result.release(); | 2294 return result.release(); |
2295 } | 2295 } |
2296 | 2296 |
2297 | 2297 |
2298 void FromDcmtkBridge::FromJson(DicomMap& target, | 2298 void FromDcmtkBridge::FromJson(DicomMap& target, |
2299 const Json::Value& source) | 2299 const Json::Value& source, |
2300 const char* fieldName) | |
2300 { | 2301 { |
2301 if (source.type() != Json::objectValue) | 2302 if (source.type() != Json::objectValue) |
2302 { | 2303 { |
2303 throw OrthancException(ErrorCode_BadFileFormat); | 2304 if (fieldName != NULL) |
2305 { | |
2306 throw OrthancException(ErrorCode_BadFileFormat, std::string("Expecting an object in field '") + std::string(fieldName) + std::string("'")); | |
2307 } | |
2308 else | |
2309 { | |
2310 throw OrthancException(ErrorCode_BadFileFormat, "Expecting an object"); | |
2311 } | |
2304 } | 2312 } |
2305 | 2313 |
2306 target.Clear(); | 2314 target.Clear(); |
2307 | 2315 |
2308 Json::Value::Members members = source.getMemberNames(); | 2316 Json::Value::Members members = source.getMemberNames(); |
2311 { | 2319 { |
2312 const Json::Value& value = source[members[i]]; | 2320 const Json::Value& value = source[members[i]]; |
2313 | 2321 |
2314 if (value.type() != Json::stringValue) | 2322 if (value.type() != Json::stringValue) |
2315 { | 2323 { |
2316 throw OrthancException(ErrorCode_BadFileFormat); | 2324 throw OrthancException(ErrorCode_BadFileFormat, std::string("Expecting a string in field '") + members[i] + std::string("'")); |
2317 } | 2325 } |
2318 | 2326 |
2319 target.SetValue(ParseTag(members[i]), value.asString(), false); | 2327 target.SetValue(ParseTag(members[i]), value.asString(), false); |
2320 } | 2328 } |
2321 } | 2329 } |
2330 | |
2331 | |
2322 | 2332 |
2323 | 2333 |
2324 void FromDcmtkBridge::ChangeStringEncoding(DcmItem& dataset, | 2334 void FromDcmtkBridge::ChangeStringEncoding(DcmItem& dataset, |
2325 Encoding source, | 2335 Encoding source, |
2326 bool hasSourceCodeExtensions, | 2336 bool hasSourceCodeExtensions, |