Mercurial > hg > orthanc
changeset 3011:8a15bb3576c2
make "/tools/create-dicom" more tolerant to invalid specific character set
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Dec 2018 17:17:51 +0100 |
parents | 45a4a1571b4e |
children | b9f0b0c0b36f |
files | NEWS OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Thu Dec 13 15:14:39 2018 +0100 +++ b/NEWS Thu Dec 13 17:17:51 2018 +0100 @@ -2,6 +2,13 @@ =============================== +Maintenance +----------- + +* "/tools/create-dicom" is more tolerant to invalid specific character set + + + Version 1.5.0 (2018-12-10) ==========================
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Dec 13 15:14:39 2018 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Dec 13 17:17:51 2018 +0100 @@ -440,6 +440,7 @@ // Select one existing child instance of the parent resource, to // retrieve all its tags Json::Value siblingTags; + std::string siblingInstanceId; { // Retrieve all the instances of the parent resource @@ -452,7 +453,8 @@ throw OrthancException(ErrorCode_InternalError); } - context.ReadDicomAsJson(siblingTags, siblingInstances.front()); + siblingInstanceId = siblingInstances.front(); + context.ReadDicomAsJson(siblingTags, siblingInstanceId); } @@ -463,11 +465,14 @@ if (siblingTags.isMember(SPECIFIC_CHARACTER_SET)) { Encoding encoding; + if (!siblingTags[SPECIFIC_CHARACTER_SET].isMember("Value") || siblingTags[SPECIFIC_CHARACTER_SET]["Value"].type() != Json::stringValue || !GetDicomEncoding(encoding, siblingTags[SPECIFIC_CHARACTER_SET]["Value"].asCString())) { - throw OrthancException(ErrorCode_CreateDicomParentEncoding); + LOG(WARNING) << "Instance with an incorrect Specific Character Set, " + << "using the default Orthanc encoding: " << siblingInstanceId; + encoding = GetDefaultDicomEncoding(); } dicom.SetEncoding(encoding);