Mercurial > hg > orthanc
changeset 4165:e34c89e89aac
Fix compatibility with C-MOVE SCU requests issued by Ambra
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2020 17:05:13 +0200 |
parents | b3c5418109a9 |
children | 8517c47eedd2 |
files | NEWS OrthancServer/Sources/OrthancMoveRequestHandler.cpp |
diffstat | 2 files changed, 31 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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<std::string>& 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"); } } }