# HG changeset patch # User Sebastien Jodogne # Date 1598367913 -7200 # Node ID e34c89e89aacc974e25955da259e10ec1f994fae # Parent b3c5418109a9cfdc3072ed20de9cbaf42f11b282 Fix compatibility with C-MOVE SCU requests issued by Ambra diff -r b3c5418109a9 -r e34c89e89aac NEWS --- a/NEWS Mon Aug 24 15:34:11 2020 +0200 +++ b/NEWS Tue Aug 25 17:05:13 2020 +0200 @@ -4,7 +4,8 @@ Maintenance ----------- -* underscores are now allowed in peers/modalities symbolic names +* Underscores are now allowed in peers/modalities symbolic names +* Fix compatibility with C-MOVE SCU requests issued by Ambra Version 1.7.3 (2020-08-24) diff -r b3c5418109a9 -r e34c89e89aac OrthancServer/Sources/OrthancMoveRequestHandler.cpp --- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Mon Aug 24 15:34:11 2020 +0200 +++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Tue Aug 25 17:05:13 2020 +0200 @@ -205,6 +205,23 @@ } + static bool IsNonEmptyTag(const DicomMap& dicom, + const DicomTag& tag) + { + const DicomValue* value = dicom.TestAndGetValue(tag); + if (value == NULL || + value->IsNull() || + value->IsBinary()) + { + return false; + } + else + { + return !value->GetContent().empty(); + } + } + + bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector& publicIds, ResourceType level, const DicomMap& input) @@ -218,8 +235,17 @@ break; case ResourceType_Study: - tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ? - DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID); + // The test below using "IsNonEmptyTag()" fixes compatibility + // with Ambra C-FIND SCU: + // https://groups.google.com/g/orthanc-users/c/yIUnZ9v9-Zs/m/GQPXiAOiCQAJ + if (IsNonEmptyTag(input, DICOM_TAG_ACCESSION_NUMBER)) + { + tag = DICOM_TAG_ACCESSION_NUMBER; + } + else + { + tag = DICOM_TAG_STUDY_INSTANCE_UID; + } break; case ResourceType_Series: @@ -373,7 +399,7 @@ } else { - throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request"); + throw OrthancException(ErrorCode_BadRequest, "No DICOM identifier provided in the C-MOVE request for this query retrieve level"); } } }